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

Unified Diff: webrtc/modules/video_coding/generic_decoder.cc

Issue 2812913002: Reland of Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Fix indent Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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..f5d9cfe07396ab03d9767a6ec6ac0fa38ed6c1dc 100644
--- a/webrtc/modules/video_coding/generic_decoder.cc
+++ b/webrtc/modules/video_coding/generic_decoder.cc
@@ -87,7 +87,7 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
decodedImage.set_timestamp_us(
frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec);
decodedImage.set_rotation(frameInfo->rotation);
- _receiveCallback->FrameToRender(decodedImage, qp);
+ _receiveCallback->FrameToRender(decodedImage, qp, frameInfo->content_type);
}
int32_t VCMDecodedFrameCallback::ReceivedDecodedReferenceFrame(
@@ -131,7 +131,8 @@ VCMGenericDecoder::VCMGenericDecoder(VideoDecoder* decoder, bool isExternal)
_decoder(decoder),
_codecType(kVideoCodecUnknown),
_isExternal(isExternal),
- _keyFrameDecoded(false) {}
+ _keyFrameDecoded(false),
+ _last_keyframe_content_type(VideoContentType::UNSPECIFIED) {}
VCMGenericDecoder::~VCMGenericDecoder() {}
@@ -149,6 +150,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;
« no previous file with comments | « webrtc/modules/video_coding/generic_decoder.h ('k') | webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698