|
Lines 41-46
@interface RTCVideoDecoderH264 ()
a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm_sec1
|
| 41 |
- (void)setError:(OSStatus)error; |
41 |
- (void)setError:(OSStatus)error; |
| 42 |
@end |
42 |
@end |
| 43 |
|
43 |
|
|
|
44 |
static void overrideColorSpaceAttachmentsIfNeeded(CVImageBufferRef imageBuffer) { |
| 45 |
auto guess = CVBufferGetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", nullptr); |
| 46 |
if (!guess || !CFEqual(guess, (CFStringRef)@"VideoToolbox")) |
| 47 |
return; |
| 48 |
|
| 49 |
CVBufferRemoveAttachment(imageBuffer, kCVImageBufferCGColorSpaceKey); |
| 50 |
CVBufferSetAttachment(imageBuffer, kCVImageBufferColorPrimariesKey, kCVImageBufferColorPrimaries_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); |
| 51 |
CVBufferSetAttachment(imageBuffer, kCVImageBufferTransferFunctionKey, kCVImageBufferTransferFunction_sRGB, kCVAttachmentMode_ShouldPropagate); |
| 52 |
CVBufferSetAttachment(imageBuffer, kCVImageBufferYCbCrMatrixKey, kCVImageBufferYCbCrMatrix_ITU_R_709_2, kCVAttachmentMode_ShouldPropagate); |
| 53 |
CVBufferSetAttachment(imageBuffer, (CFStringRef)@"ColorInfoGuessedBy", (CFStringRef)@"RTCVideoDecoderH264", kCVAttachmentMode_ShouldPropagate); |
| 54 |
} |
| 55 |
|
| 44 |
// This is the callback function that VideoToolbox calls when decode is |
56 |
// This is the callback function that VideoToolbox calls when decode is |
| 45 |
// complete. |
57 |
// complete. |
| 46 |
void decompressionOutputCallback(void *decoderRef, |
58 |
void decompressionOutputCallback(void *decoderRef, |
|
Lines 57-62
void decompressionOutputCallback(void *decoderRef,
a/Source/ThirdParty/libwebrtc/Source/webrtc/sdk/objc/components/video_codec/RTCVideoDecoderH264.mm_sec2
|
| 57 |
return; |
69 |
return; |
| 58 |
} |
70 |
} |
| 59 |
|
71 |
|
|
|
72 |
overrideColorSpaceAttachmentsIfNeeded(imageBuffer); |
| 73 |
|
| 60 |
std::unique_ptr<RTCFrameDecodeParams> decodeParams(reinterpret_cast<RTCFrameDecodeParams *>(params)); |
74 |
std::unique_ptr<RTCFrameDecodeParams> decodeParams(reinterpret_cast<RTCFrameDecodeParams *>(params)); |
| 61 |
// TODO(tkchin): Handle CVO properly. |
75 |
// TODO(tkchin): Handle CVO properly. |
| 62 |
RTCCVPixelBuffer *frameBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:imageBuffer]; |
76 |
RTCCVPixelBuffer *frameBuffer = [[RTCCVPixelBuffer alloc] initWithPixelBuffer:imageBuffer]; |