Surface audio unit errors.
With this change, we catch audio unit start errors and pipe them to the audio session. The audio session notifies its delegate, which can then take appropriate action based on the error code. The signal follows the same path as the playout glitch detection. Bug: webrtc:13119 Change-Id: I8c9f9d2a1e3457447d0ce61ad197f7e1c6392837 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230240 Commit-Queue: Peter Hanspers <peterhanspers@webrtc.org> Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Reviewed-by: Xavier Lepaul <xalep@webrtc.org> Cr-Commit-Position: refs/heads/main@{#34862}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
fb0dca6c05
commit
e5b4e941a0
@ -73,6 +73,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/** Returns a configuration error with the given description. */
|
||||
- (NSError *)configurationErrorWithDescription:(NSString *)description;
|
||||
|
||||
/** Notifies the reciever that a playout glitch was detected. */
|
||||
- (void)notifyDidDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches;
|
||||
|
||||
/** Notifies the reciever that there was an error when starting an audio unit. */
|
||||
- (void)notifyAudioUnitStartFailedWithError:(OSStatus)error;
|
||||
|
||||
// Properties and methods for tests.
|
||||
- (void)notifyDidBeginInterruption;
|
||||
- (void)notifyDidEndInterruptionWithShouldResumeSession:(BOOL)shouldResumeSession;
|
||||
@ -83,7 +89,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)notifyDidChangeCanPlayOrRecord:(BOOL)canPlayOrRecord;
|
||||
- (void)notifyDidStartPlayOrRecord;
|
||||
- (void)notifyDidStopPlayOrRecord;
|
||||
- (void)notifyDidDetectPlayoutGlitch:(int64_t)totalNumberOfGlitches;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -99,6 +99,9 @@ RTC_OBJC_EXPORT
|
||||
failedToSetActive:(BOOL)active
|
||||
error:(NSError *)error;
|
||||
|
||||
- (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession
|
||||
audioUnitStartFailedWithError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
/** This is a protocol used to inform RTCAudioSession when the audio session
|
||||
|
||||
@ -794,6 +794,18 @@ NSString * const kRTCAudioSessionOutputVolumeSelector = @"outputVolume";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyAudioUnitStartFailedWithError:(OSStatus)error {
|
||||
for (auto delegate : self.delegates) {
|
||||
SEL sel = @selector(audioSession:audioUnitStartFailedWithError:);
|
||||
if ([delegate respondsToSelector:sel]) {
|
||||
[delegate audioSession:self
|
||||
audioUnitStartFailedWithError:[NSError errorWithDomain:kRTCAudioSessionErrorDomain
|
||||
code:error
|
||||
userInfo:nil]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyDidBeginInterruption {
|
||||
for (auto delegate : self.delegates) {
|
||||
SEL sel = @selector(audioSessionDidBeginInterruption:);
|
||||
|
||||
Reference in New Issue
Block a user