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

Side by Side Diff: webrtc/modules/audio_device/ios/audio_device_ios.mm

Issue 2349263004: Ensures that ADM for Android and iOS uses identical states when stopping audio (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started"; 211 LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started";
212 } 212 }
213 rtc::AtomicOps::ReleaseStore(&playing_, 1); 213 rtc::AtomicOps::ReleaseStore(&playing_, 1);
214 return 0; 214 return 0;
215 } 215 }
216 216
217 int32_t AudioDeviceIOS::StopPlayout() { 217 int32_t AudioDeviceIOS::StopPlayout() {
218 LOGI() << "StopPlayout"; 218 LOGI() << "StopPlayout";
219 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 219 RTC_DCHECK(thread_checker_.CalledOnValidThread());
220 if (!play_is_initialized_) { 220 if (!play_is_initialized_ || !playing_) {
sophiechang-webrtc 2016/09/21 10:43:54 as mentioned offline, i think it would be good to
221 return 0;
222 }
223 if (!playing_) {
224 play_is_initialized_ = false;
225 return 0; 221 return 0;
226 } 222 }
227 if (!recording_) { 223 if (!recording_) {
228 ShutdownPlayOrRecord(); 224 ShutdownPlayOrRecord();
229 } 225 }
230 play_is_initialized_ = false; 226 play_is_initialized_ = false;
231 rtc::AtomicOps::ReleaseStore(&playing_, 0); 227 rtc::AtomicOps::ReleaseStore(&playing_, 0);
232 return 0; 228 return 0;
233 } 229 }
234 230
(...skipping 14 matching lines...) Expand all
249 } 245 }
250 LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started"; 246 LOG(LS_INFO) << "Voice-Processing I/O audio unit is now started";
251 } 247 }
252 rtc::AtomicOps::ReleaseStore(&recording_, 1); 248 rtc::AtomicOps::ReleaseStore(&recording_, 1);
253 return 0; 249 return 0;
254 } 250 }
255 251
256 int32_t AudioDeviceIOS::StopRecording() { 252 int32_t AudioDeviceIOS::StopRecording() {
257 LOGI() << "StopRecording"; 253 LOGI() << "StopRecording";
258 RTC_DCHECK(thread_checker_.CalledOnValidThread()); 254 RTC_DCHECK(thread_checker_.CalledOnValidThread());
259 if (!rec_is_initialized_) { 255 if (!rec_is_initialized_ || !recording_) {
260 return 0;
261 }
262 if (!recording_) {
263 rec_is_initialized_ = false;
264 return 0; 256 return 0;
265 } 257 }
266 if (!playing_) { 258 if (!playing_) {
267 ShutdownPlayOrRecord(); 259 ShutdownPlayOrRecord();
268 } 260 }
269 rec_is_initialized_ = false; 261 rec_is_initialized_ = false;
270 rtc::AtomicOps::ReleaseStore(&recording_, 0); 262 rtc::AtomicOps::ReleaseStore(&recording_, 0);
271 return 0; 263 return 0;
272 } 264 }
273 265
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 833
842 // All I/O should be stopped or paused prior to deactivating the audio 834 // All I/O should be stopped or paused prior to deactivating the audio
843 // session, hence we deactivate as last action. 835 // session, hence we deactivate as last action.
844 [session lockForConfiguration]; 836 [session lockForConfiguration];
845 UnconfigureAudioSession(); 837 UnconfigureAudioSession();
846 [session endWebRTCSession:nil]; 838 [session endWebRTCSession:nil];
847 [session unlockForConfiguration]; 839 [session unlockForConfiguration];
848 } 840 }
849 841
850 } // namespace webrtc 842 } // namespace webrtc
OLDNEW
« 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