Reland "Copy video frames metadata between encoded and plain frames in one place"
Reland with fixes.
Currently some video frames metadata like rotation or ntp timestamps are
copied in every encoder and decoder separately. This CL makes copying to
happen at a single place for send or receive side. This will make it
easier to add new metadata in the future.
Also, added some missing tests.
Original Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133346
Bug: webrtc:10460
Change-Id: Ia71198685de7fbd990704b575231cdce94dc0645
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134961
Reviewed-by: Johannes Kron <kron@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27828}
diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc
index cf986d6..e126054 100644
--- a/modules/video_coding/generic_decoder.cc
+++ b/modules/video_coding/generic_decoder.cc
@@ -80,6 +80,12 @@
return;
}
+ decodedImage.set_ntp_time_ms(frameInfo->ntp_time_ms);
+ if (frameInfo->color_space) {
+ decodedImage.set_color_space(*frameInfo->color_space);
+ }
+ decodedImage.set_rotation(frameInfo->rotation);
+
const int64_t now_ms = _clock->TimeInMilliseconds();
if (!decode_time_ms) {
decode_time_ms = now_ms - frameInfo->decodeStartTimeMs;
@@ -140,7 +146,6 @@
decodedImage.set_timestamp_us(frameInfo->renderTimeMs *
rtc::kNumMicrosecsPerMillisec);
- decodedImage.set_rotation(frameInfo->rotation);
_receiveCallback->FrameToRender(decodedImage, qp, frameInfo->content_type);
}
@@ -199,6 +204,9 @@
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
_frameInfos[_nextFrameInfoIdx].rotation = frame.rotation();
_frameInfos[_nextFrameInfoIdx].timing = frame.video_timing();
+ _frameInfos[_nextFrameInfoIdx].ntp_time_ms =
+ frame.EncodedImage().ntp_time_ms_;
+ _frameInfos[_nextFrameInfoIdx].color_space = frame.ColorSpace();
// 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.