Index: sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm |
diff --git a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm b/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm |
index 6e000ab747eb3777dc866bbeeee4edbab9902a92..6b608ced8cc4f72d64f0eda9950138daba0f2447 100644 |
--- a/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm |
+++ b/sdk/objc/Framework/Classes/VideoToolbox/RTCVideoDecoderH264.mm |
@@ -25,6 +25,7 @@ |
#if defined(WEBRTC_IOS) |
#import "Common/RTCUIApplicationStatusObserver.h" |
+#import "WebRTC/UIDevice+RTCDevice.h" |
#endif |
// Struct that we pass to the decoder per frame to decode. We receive it again |
@@ -236,7 +237,15 @@ void decompressionOutputCallback(void *decoder, |
- (void)destroyDecompressionSession { |
if (_decompressionSession) { |
- VTDecompressionSessionInvalidate(_decompressionSession); |
+#if defined(WEBRTC_IOS) |
+ if ([UIDevice isIOS11OrLater]) { |
+ VTDecompressionSessionWaitForAsynchronousFrames(_decompressionSession); |
+ } else { |
+#endif |
+ VTDecompressionSessionInvalidate(_decompressionSession); |
+#if defined(WEBRTC_IOS) |
+ } |
+#endif |
CFRelease(_decompressionSession); |
_decompressionSession = nullptr; |
} |