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:
@ -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];
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user