Skip to content

Commit

Permalink
ios_simulator: call category_change directly after sync no need for t…
Browse files Browse the repository at this point in the history
…imer
  • Loading branch information
z-dule committed May 30, 2024
1 parent 0c245dd commit 8f5c534
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/mediamgr/mm_platform_iosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,12 @@ static bool set_category_sync(NSString *cat, bool speaker)

#if TARGET_IPHONE_SIMULATOR
NSLog(@"mm_platform_ios: simulator using timer for cat change success=%d\n", success);
cat_change_timeout(NULL);
/*
if (success) {
tmr_start(&mm_ios.tmr_cat, 500, cat_change_timeout, NULL);
}
*/
#endif

return success ? true : false;
Expand All @@ -376,7 +379,7 @@ static void set_category(NSString *cat, bool speaker)

static void leave_call(void)
{
info("mm_platforn_ios: leave_call\n");
info("mm_platform_ios: leave_call\n");

mm_ios.incall = false;
mediamgr_sys_left_call(mm_ios.mm);
Expand Down Expand Up @@ -1081,6 +1084,8 @@ enum mediamgr_auplay mm_platform_get_route(void)

void mm_platform_incoming(void)
{
NSLog(@"mm_platform_ios: incoming\n");

#if TARGET_OS_IPHONE
AVAudioSession *sess = [AVAudioSession sharedInstance];
NSString *cat = [sess category];
Expand All @@ -1099,17 +1104,19 @@ void mm_platform_enter_call(void)
{
#if TARGET_OS_IPHONE
AVAudioSession *sess = [AVAudioSession sharedInstance];
NSString *cat = [sess category];

info("mm_platform_ios: enter_call: incall=%s\n",
mm_ios.incall ? "yes" : "no");
info("mm_platform_ios: enter_call: incall=%s cat=$@\n",
mm_ios.incall ? "yes" : "no", cat);

mm_ios.incall = true;

if (mm_ios.interrupted) {
set_active(true);
mm_ios.interrupted = false;
}

mm_ios.incall = true;
if ([sess category] == AVAudioSessionCategoryPlayAndRecord)
if (cat == AVAudioSessionCategoryPlayAndRecord)
mediamgr_sys_entered_call(mm_ios.mm);
else
incall_category();
Expand All @@ -1120,14 +1127,14 @@ void mm_platform_exit_call(void)
{
#if TARGET_OS_IPHONE
AVAudioSession *sess = [AVAudioSession sharedInstance];
NSString *cat;
NSString *cat = [sess category];

info("mm_platform_ios: exit_call: incall=%s\n",
mm_ios.incall ? "yes" : "no");
info("mm_platform_ios: exit_call: incall=%s cat=%s\n",
mm_ios.incall ? "yes" : "no", [cat UTF8String]);


mm_ios.incall = false;

cat = [sess category];
if (cat == AVAudioSessionCategoryAmbient ||
cat == AVAudioSessionCategorySoloAmbient) {
leave_call();
Expand Down

0 comments on commit 8f5c534

Please sign in to comment.