OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 if (self.mode != configuration.mode) { | 43 if (self.mode != configuration.mode) { |
44 NSError *modeError = nil; | 44 NSError *modeError = nil; |
45 if (![self setMode:configuration.mode error:&modeError]) { | 45 if (![self setMode:configuration.mode error:&modeError]) { |
46 RTCLogError(@"Failed to set mode: %@", | 46 RTCLogError(@"Failed to set mode: %@", |
47 modeError.localizedDescription); | 47 modeError.localizedDescription); |
48 error = modeError; | 48 error = modeError; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 if (self.sampleRate != configuration.sampleRate) { | 52 // self.sampleRate is accurate only if the audio session is active. |
| 53 if (!self.isActive || self.sampleRate != configuration.sampleRate) { |
53 NSError *sampleRateError = nil; | 54 NSError *sampleRateError = nil; |
54 if (![self setPreferredSampleRate:configuration.sampleRate | 55 if (![self setPreferredSampleRate:configuration.sampleRate |
55 error:&sampleRateError]) { | 56 error:&sampleRateError]) { |
56 RTCLogError(@"Failed to set preferred sample rate: %@", | 57 RTCLogError(@"Failed to set preferred sample rate: %@", |
57 sampleRateError.localizedDescription); | 58 sampleRateError.localizedDescription); |
58 error = sampleRateError; | 59 error = sampleRateError; |
59 } | 60 } |
60 } | 61 } |
61 | 62 |
62 if (self.IOBufferDuration != configuration.ioBufferDuration) { | 63 // self.IOBufferDuration is accurate only if the audio session is active. |
| 64 if (!self.isActive || |
| 65 self.IOBufferDuration != configuration.ioBufferDuration) { |
63 NSError *bufferDurationError = nil; | 66 NSError *bufferDurationError = nil; |
64 if (![self setPreferredIOBufferDuration:configuration.ioBufferDuration | 67 if (![self setPreferredIOBufferDuration:configuration.ioBufferDuration |
65 error:&bufferDurationError]) { | 68 error:&bufferDurationError]) { |
66 RTCLogError(@"Failed to set preferred IO buffer duration: %@", | 69 RTCLogError(@"Failed to set preferred IO buffer duration: %@", |
67 bufferDurationError.localizedDescription); | 70 bufferDurationError.localizedDescription); |
68 error = bufferDurationError; | 71 error = bufferDurationError; |
69 } | 72 } |
70 } | 73 } |
71 | 74 |
72 NSError *activeError = nil; | 75 NSError *activeError = nil; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 RTCLog(@"Current mode %@ does not match %@", | 179 RTCLog(@"Current mode %@ does not match %@", |
177 currentConfig.mode, | 180 currentConfig.mode, |
178 webRTCConfig.mode); | 181 webRTCConfig.mode); |
179 return NO; | 182 return NO; |
180 } | 183 } |
181 | 184 |
182 return YES; | 185 return YES; |
183 } | 186 } |
184 | 187 |
185 @end | 188 @end |
OLD | NEW |