Copy video frames metadata between encoded and plain frames in one place
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. Bug: webrtc:10460 Change-Id: Ia49072c3041e75433f125a61050d2982b2bec1da Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133346 Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Johannes Kron <kron@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27719}
This commit is contained in:
committed by
Commit Bot
parent
59b64d32fc
commit
00d0a0a1a9
@ -77,6 +77,12 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
frameInfo = _timestampMap.Pop(decodedImage.timestamp());
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (frameInfo == NULL) {
|
||||
RTC_LOG(LS_WARNING) << "Too many frames backed up in the decoder, dropping "
|
||||
"this one.";
|
||||
@ -143,7 +149,6 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
|
||||
decodedImage.set_timestamp_us(frameInfo->renderTimeMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
decodedImage.set_rotation(frameInfo->rotation);
|
||||
_receiveCallback->FrameToRender(decodedImage, qp, frameInfo->content_type);
|
||||
}
|
||||
|
||||
@ -212,6 +217,9 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) {
|
||||
_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.
|
||||
|
||||
Reference in New Issue
Block a user