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

Side by Side Diff: sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm

Issue 3016703002: Fix occassional hang in iOS 11 when calling VTDecompressionSessionInvalidate.
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/external/webrtc into hang Created 3 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 */
11 11
12 #import "WebRTC/RTCVideoCodecH264.h" 12 #import "WebRTC/RTCVideoCodecH264.h"
13 13
14 #import <VideoToolbox/VideoToolbox.h> 14 #import <VideoToolbox/VideoToolbox.h>
15 15
16 #include "modules/video_coding/include/video_error_codes.h" 16 #include "modules/video_coding/include/video_error_codes.h"
17 #include "rtc_base/checks.h" 17 #include "rtc_base/checks.h"
18 #include "rtc_base/logging.h" 18 #include "rtc_base/logging.h"
19 #include "rtc_base/timeutils.h" 19 #include "rtc_base/timeutils.h"
20 #include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h" 20 #include "sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h"
21 21
22 #import "WebRTC/RTCVideoFrame.h" 22 #import "WebRTC/RTCVideoFrame.h"
23 #import "WebRTC/RTCVideoFrameBuffer.h" 23 #import "WebRTC/RTCVideoFrameBuffer.h"
24 #import "helpers.h" 24 #import "helpers.h"
25 25
26 #if defined(WEBRTC_IOS) 26 #if defined(WEBRTC_IOS)
27 #import "Common/RTCUIApplicationStatusObserver.h" 27 #import "Common/RTCUIApplicationStatusObserver.h"
28 #import "WebRTC/UIDevice+RTCDevice.h"
28 #endif 29 #endif
29 30
30 // Struct that we pass to the decoder per frame to decode. We receive it again 31 // Struct that we pass to the decoder per frame to decode. We receive it again
31 // in the decoder callback. 32 // in the decoder callback.
32 struct RTCFrameDecodeParams { 33 struct RTCFrameDecodeParams {
33 RTCFrameDecodeParams(RTCVideoDecoderCallback cb, int64_t ts) : callback(cb), t imestamp(ts) {} 34 RTCFrameDecodeParams(RTCVideoDecoderCallback cb, int64_t ts) : callback(cb), t imestamp(ts) {}
34 RTCVideoDecoderCallback callback; 35 RTCVideoDecoderCallback callback;
35 int64_t timestamp; 36 int64_t timestamp;
36 }; 37 };
37 38
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 230
230 - (void)configureDecompressionSession { 231 - (void)configureDecompressionSession {
231 RTC_DCHECK(_decompressionSession); 232 RTC_DCHECK(_decompressionSession);
232 #if defined(WEBRTC_IOS) 233 #if defined(WEBRTC_IOS)
233 VTSessionSetProperty(_decompressionSession, kVTDecompressionPropertyKey_RealTi me, kCFBooleanTrue); 234 VTSessionSetProperty(_decompressionSession, kVTDecompressionPropertyKey_RealTi me, kCFBooleanTrue);
234 #endif 235 #endif
235 } 236 }
236 237
237 - (void)destroyDecompressionSession { 238 - (void)destroyDecompressionSession {
238 if (_decompressionSession) { 239 if (_decompressionSession) {
239 VTDecompressionSessionInvalidate(_decompressionSession); 240 #if defined(WEBRTC_IOS)
241 if ([UIDevice isIOS11OrLater]) {
242 VTDecompressionSessionWaitForAsynchronousFrames(_decompressionSession);
243 } else {
244 #endif
245 VTDecompressionSessionInvalidate(_decompressionSession);
246 #if defined(WEBRTC_IOS)
247 }
248 #endif
240 CFRelease(_decompressionSession); 249 CFRelease(_decompressionSession);
241 _decompressionSession = nullptr; 250 _decompressionSession = nullptr;
242 } 251 }
243 } 252 }
244 253
245 - (void)setVideoFormat:(CMVideoFormatDescriptionRef)videoFormat { 254 - (void)setVideoFormat:(CMVideoFormatDescriptionRef)videoFormat {
246 if (_videoFormat == videoFormat) { 255 if (_videoFormat == videoFormat) {
247 return; 256 return;
248 } 257 }
249 if (_videoFormat) { 258 if (_videoFormat) {
250 CFRelease(_videoFormat); 259 CFRelease(_videoFormat);
251 } 260 }
252 _videoFormat = videoFormat; 261 _videoFormat = videoFormat;
253 if (_videoFormat) { 262 if (_videoFormat) {
254 CFRetain(_videoFormat); 263 CFRetain(_videoFormat);
255 } 264 }
256 } 265 }
257 266
258 - (NSString *)implementationName { 267 - (NSString *)implementationName {
259 return @"VideoToolbox"; 268 return @"VideoToolbox";
260 } 269 }
261 270
262 @end 271 @end
OLDNEW
« no previous file with comments | « sdk/objc/Framework/Classes/Common/UIDevice+RTCDevice.mm ('k') | sdk/objc/Framework/Headers/WebRTC/UIDevice+RTCDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698