Preserve legacy behavior for old OveruseFrameDetector

A recent refactoring introduced a subtle difference in how encoded
frame timing is measured. See
https://webrtc-review.googlesource.com/c/src/+/124122/14/video/video_stream_encoder.cc#b1278

After that change, the encode was considered done after encoding was
done. The old behavior included the time needed to call stats and
the video sink, which might include video quality tests related tasks
and RTP packetization.

In order to preserve the old behavior I'm moving timestamping to after
packetization again.
Note that the timing frame info still has a separate timestamp that
does explicitly measure encode time. This is used by the experimental
new overuse detector, so the effect of this change will be transient
anyhow.

Bug: chromium:941457, webrtc:10164
Change-Id: Ia990a1ceaeaf2c45d5df2a32d4f017cdb08e3c55
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127569
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27108}
This commit is contained in:
Erik Språng
2019-03-13 16:33:02 +01:00
committed by Commit Bot
parent 5ce38fff17
commit 982dc791db

View File

@ -1331,15 +1331,14 @@ EncodedImageCallback::Result VideoStreamEncoder::OnEncodedImage(
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) {
const int64_t time_sent_us = rtc::TimeMicros();
TRACE_EVENT_INSTANT1("webrtc", "VCMEncodedFrameCallback::Encoded",
"timestamp", encoded_image.Timestamp());
const size_t spatial_idx = encoded_image.SpatialIndex().value_or(0);
EncodedImage image_copy(encoded_image);
frame_encoder_timer_.FillTimingInfo(
spatial_idx, &image_copy, time_sent_us / rtc::kNumMicrosecsPerMillisec);
spatial_idx, &image_copy,
rtc::TimeMicros() / rtc::kNumMicrosecsPerMillisec);
// Piggyback ALR experiment group id and simulcast id into the content type.
const uint8_t experiment_id =
@ -1382,7 +1381,7 @@ EncodedImageCallback::Result VideoStreamEncoder::OnEncodedImage(
temporal_index = 0;
}
RunPostEncode(image_copy, time_sent_us, temporal_index);
RunPostEncode(image_copy, rtc::TimeMicros(), temporal_index);
if (result.error == Result::OK) {
// In case of an internal encoder running on a separate thread, the