Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm

Issue 2886183002: Updated comments for unit tests to validate iOS audio session isInterrupted flag does not get reset… (Closed)
Patch Set: Updated comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm
diff --git a/webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm b/webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm
index 82f4426482ad3f93ecdafe3600d1f3335a043d80..6ae8d2c704ca2d4a790829f25511d0cbf6a1d071 100644
--- a/webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm
+++ b/webrtc/modules/audio_device/ios/audio_device_unittest_ios.mm
@@ -825,6 +825,24 @@ TEST_F(AudioDeviceTest, DISABLED_MeasureLoopbackLatency) {
latency_audio_stream->PrintResults();
}
+// Verifies that the AudioDeviceIOS is_interrupted_ flag is reset correctly
+// after an iOS AVAudioSessionInterruptionTypeEnded notification event.
+// AudioDeviceIOS listens to RTCAudioSession interrupted notifications by:
+// - In AudioDeviceIOS.InitPlayOrRecord registers its audio_session_observer_
+// callback with RTCAudioSession's delegate list.
+// - When RTCAudioSession receives an iOS audio interrupted notification, it
+// passes the notifcation to callbacks in its delegate list which sets
tkchin_webrtc 2017/05/17 18:44:39 nit: typo
+// AudioDeviceIOS's is_interrupted_ flag to true.
+// - When AudioDeviceIOS.ShutdownPlayOrRecord is called, its
+// audio_session_observer_ callback is removed from RTCAudioSessions's
+// delegate list.
+// So if RTCAudioSession receives an iOS end audio interruption notification,
+// AudioDeviceIOS is not notified as it's callback is not in RTCAudioSession's
tkchin_webrtc 2017/05/17 18:44:39 nit: its
+// delegate list. This causes AudioDeviceIOS's is_interrupted_ flag to be in
+// the wrong (true) state and the audio session will ignore audio changes.
+// As RTCAudioSession keeps its own interrupted state, the fix is to initialize
+// AudioDeviceIOS's is_interrupted_ flag to RTCAudioSession's isInterrupted
+// flag in AudioDeviceIOS.InitPlayOrRecord.
TEST_F(AudioDeviceTest, testInterruptedAudioSession) {
RTCAudioSession *session = [RTCAudioSession sharedInstance];
std::unique_ptr<webrtc::AudioDeviceIOS> audio_device;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698