Set processing time according to the decode time if provided by the decoder.
Followup to https://webrtc-review.googlesource.com/c/src/+/183880 Bug: webrtc:9106 Change-Id: Ic79e0be359ced00ffe0c52acc3c5aaceafc793de Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186300 Commit-Queue: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Johannes Kron <kron@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32293}
This commit is contained in:
@ -31,7 +31,6 @@ class VideoStreamDecoderInterface {
|
||||
virtual ~Callbacks() = default;
|
||||
|
||||
struct FrameInfo {
|
||||
absl::optional<int> decode_time_ms;
|
||||
absl::optional<int> qp;
|
||||
VideoContentType content_type;
|
||||
};
|
||||
|
@ -101,13 +101,14 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
decodedImage.set_packet_infos(frameInfo->packet_infos);
|
||||
decodedImage.set_rotation(frameInfo->rotation);
|
||||
|
||||
const Timestamp now = _clock->CurrentTime();
|
||||
RTC_DCHECK(frameInfo->decodeStart);
|
||||
if (!decode_time_ms) {
|
||||
decode_time_ms = (now - *frameInfo->decodeStart).ms();
|
||||
}
|
||||
_timing->StopDecodeTimer(*decode_time_ms, now.ms());
|
||||
decodedImage.set_processing_time({*frameInfo->decodeStart, now});
|
||||
const Timestamp now = _clock->CurrentTime();
|
||||
const TimeDelta decode_time = decode_time_ms
|
||||
? TimeDelta::Millis(*decode_time_ms)
|
||||
: now - *frameInfo->decodeStart;
|
||||
_timing->StopDecodeTimer(decode_time.ms(), now.ms());
|
||||
decodedImage.set_processing_time(
|
||||
{*frameInfo->decodeStart, *frameInfo->decodeStart + decode_time});
|
||||
|
||||
// Report timing information.
|
||||
TimingFrameInfo timing_frame_info;
|
||||
@ -161,7 +162,7 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
|
||||
decodedImage.set_timestamp_us(frameInfo->renderTimeMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
_receiveCallback->FrameToRender(decodedImage, qp, *decode_time_ms,
|
||||
_receiveCallback->FrameToRender(decodedImage, qp, decode_time.ms(),
|
||||
frameInfo->content_type);
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ void VideoStreamDecoderImpl::OnDecodedFrameCallback(
|
||||
int64_t decode_stop_time_ms = rtc::TimeMillis();
|
||||
|
||||
bookkeeping_queue_.PostTask([this, decode_stop_time_ms, decoded_image,
|
||||
decode_time_ms, qp]() {
|
||||
decode_time_ms, qp]() mutable {
|
||||
RTC_DCHECK_RUN_ON(&bookkeeping_queue_);
|
||||
|
||||
FrameInfo* frame_info = GetFrameInfo(decoded_image.timestamp());
|
||||
@ -264,14 +264,17 @@ void VideoStreamDecoderImpl::OnDecodedFrameCallback(
|
||||
if (qp)
|
||||
callback_info.qp.emplace(*qp);
|
||||
|
||||
callback_info.decode_time_ms = decode_time_ms.value_or(
|
||||
decode_stop_time_ms - frame_info->decode_start_time_ms);
|
||||
if (!decode_time_ms) {
|
||||
decode_time_ms = decode_stop_time_ms - frame_info->decode_start_time_ms;
|
||||
}
|
||||
decoded_image.set_processing_time(
|
||||
{Timestamp::Millis(frame_info->decode_start_time_ms),
|
||||
Timestamp::Millis(frame_info->decode_start_time_ms +
|
||||
*decode_time_ms)});
|
||||
decoded_image.set_timestamp_us(frame_info->render_time_us);
|
||||
timing_.StopDecodeTimer(*decode_time_ms, decode_stop_time_ms);
|
||||
|
||||
timing_.StopDecodeTimer(*callback_info.decode_time_ms, decode_stop_time_ms);
|
||||
|
||||
VideoFrame copy = decoded_image;
|
||||
copy.set_timestamp_us(frame_info->render_time_us);
|
||||
callbacks_->OnDecodedFrame(copy, callback_info);
|
||||
callbacks_->OnDecodedFrame(decoded_image, callback_info);
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user