Index: webrtc/modules/video_coding/generic_decoder.cc |
diff --git a/webrtc/modules/video_coding/generic_decoder.cc b/webrtc/modules/video_coding/generic_decoder.cc |
index 2121ab63067acdafe71e7f1cb7ceaf90c3b1196d..f6bcf545f9a4e1bf7472ec9fd54c9eeb79307393 100644 |
--- a/webrtc/modules/video_coding/generic_decoder.cc |
+++ b/webrtc/modules/video_coding/generic_decoder.cc |
@@ -87,6 +87,7 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, |
decodedImage.set_timestamp_us( |
frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec); |
decodedImage.set_rotation(frameInfo->rotation); |
+ decodedImage.set_content_type(frameInfo->content_type); |
_receiveCallback->FrameToRender(decodedImage, qp); |
} |
@@ -131,7 +132,8 @@ VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal) |
_decoder(decoder), |
_codecType(kVideoCodecUnknown), |
_isExternal(isExternal), |
- _keyFrameDecoded(false) {} |
+ _keyFrameDecoded(false), |
+ _last_keyframe_content_type(VideoContentType::kDefault) {} |
VCMGenericDecoder::~VCMGenericDecoder() {} |
@@ -149,6 +151,15 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) { |
_frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs; |
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs(); |
_frameInfos[_nextFrameInfoIdx].rotation = frame.rotation(); |
+ // Set correctly only for key frames. Thus, use latest key frame |
+ // content type. If the corresponding key frame was lost, decode will fail |
+ // and content type will be ignored. |
+ if (frame.FrameType() == kVideoFrameKey) { |
+ _frameInfos[_nextFrameInfoIdx].content_type = frame.contentType(); |
+ _last_keyframe_content_type = frame.contentType(); |
+ } else { |
+ _frameInfos[_nextFrameInfoIdx].content_type = _last_keyframe_content_type; |
+ } |
_callback->Map(frame.TimeStamp(), &_frameInfos[_nextFrameInfoIdx]); |
_nextFrameInfoIdx = (_nextFrameInfoIdx + 1) % kDecoderFrameMemoryLength; |