Enhance RTCUIApplicationStatusObserver thread safety.

Add locking around waiting for initialization to finish, since calling
dispatch_block_wait from multiple threads leads to undefined behavior.

Initialize RTCUIApplicationStatusObserver earlier to give the
initialization block more time to run on the main thread before
starting to query the application state.

http://www.dailymotion.com/video/x2mckmh

BUG=b/65558688

Review-Url: https://codereview.webrtc.org/3009383002
Cr-Commit-Position: refs/heads/master@{#19822}
This commit is contained in:
andersc
2017-09-13 07:31:46 -07:00
committed by Commit Bot
parent f54573bd3b
commit 9a85f0782e
4 changed files with 35 additions and 3 deletions

View File

@ -67,6 +67,16 @@ void decompressionOutputCallback(void *decoder,
RTCVideoDecoderCallback _callback;
}
- (instancetype)init {
if (self = [super init]) {
#if defined(WEBRTC_IOS)
[RTCUIApplicationStatusObserver prepareForUse];
#endif
}
return self;
}
- (void)dealloc {
[self destroyDecompressionSession];
[self setVideoFormat:nullptr];

View File

@ -301,6 +301,10 @@ CFStringRef ExtractProfile(const cricket::VideoCodec &codec) {
_profile = ExtractProfile([codecInfo nativeVideoCodec]);
LOG(LS_INFO) << "Using profile " << CFStringToString(_profile);
RTC_CHECK([codecInfo.name isEqualToString:@"H264"]);
#if defined(WEBRTC_IOS)
[RTCUIApplicationStatusObserver prepareForUse];
#endif
}
return self;
}