Selaa lähdekoodia

Fixed audio can not resume if it is interrupted cause by an incoming phone call

(cherry picked from commit 7d374b5974448680a81f18751a7ca456a850020f)
sanikoyes 8 vuotta sitten
vanhempi
commit
b8ae40de72
2 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 5 0
      platform/iphone/app_delegate.mm
  2. 5 0
      platform/iphone/audio_driver_iphone.cpp

+ 5 - 0
platform/iphone/app_delegate.mm

@@ -33,6 +33,7 @@
 #import "gl_view.h"
 #include "main/main.h"
 #include "os_iphone.h"
+#include "audio_driver_iphone.h"
 
 #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
 #include "modules/FacebookScorer_ios/FacebookScorer.h"
@@ -726,6 +727,10 @@ static int frame_count = 0;
 	if (OSIPhone::get_singleton()->native_video_is_playing()) {
 		OSIPhone::get_singleton()->native_video_unpause();
 	};
+
+	// Fixed audio can not resume if it is interrupted cause by an incoming phone call
+	if(AudioDriverIphone::get_singleton() != NULL)
+		AudioDriverIphone::get_singleton()->start();
 }
 
 - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

+ 5 - 0
platform/iphone/audio_driver_iphone.cpp

@@ -148,6 +148,11 @@ OSStatus AudioDriverIphone::output_callback(void *inRefCon,
 
 void AudioDriverIphone::start() {
 	active = true;
+	// Resume audio
+	//	iOS audio-thread stoped if it is interrupted cause by an incoming phone call
+	//	Use AudioOutputUnitStart to re-create audio-thread
+	OSStatus result = AudioOutputUnitStart(audio_unit);
+	ERR_FAIL_COND(result != noErr);
 };
 
 int AudioDriverIphone::get_mix_rate() const {