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

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

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Fix uninitialized variables memcheck errors Created 3 years, 7 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 5969f2369684030cd30c1f8a281860dc1e4ce805..e24d19dcf7879eb89257053575c63279808b7101 100644
--- a/webrtc/modules/video_coding/generic_decoder.cc
+++ b/webrtc/modules/video_coding/generic_decoder.cc
@@ -85,6 +85,30 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
_timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms,
frameInfo->renderTimeMs);
+ // Report timing information.
+ if (frameInfo->timing.is_timing_frame) {
+ int64_t ntp_offset =
+ _clock->CurrentNtpInMilliseconds() - _clock->TimeInMilliseconds();
sprang_webrtc 2017/05/31 11:12:55 This will be racy, in the sense that the offset ma
ilnik 2017/05/31 15:17:45 I think nothing can be done here, as we are using
sprang_webrtc 2017/06/05 14:39:20 Some imprecision is unavoidable, agreed, but we ca
ilnik 2017/06/07 14:25:03 Oh, I've got that you mean. I didn't find any cach
+ // Convert remote timestamps to local time from ntp timestamps.
+ frameInfo->timing.encode_start_ms -= ntp_offset;
+ frameInfo->timing.encode_finish_ms -= ntp_offset;
+ frameInfo->timing.packetization_finish_ms -= ntp_offset;
+ frameInfo->timing.pacer_exit_ms -= ntp_offset;
+ frameInfo->timing.network_timestamp_ms -= ntp_offset;
+ // TODO(ilnik): Report timing information here.
+ // Capture time: decodedImage.ntp_time_ms() - ntp_offset
+ // Encode start: frameInfo->timing.encode_start_ms
+ // Encode finish: frameInfo->timing.encode_finish_ms
+ // Packetization done: frameInfo->timing.packetization_finish_ms
+ // Pacer exit: frameInfo->timing.pacer_exit_ms
+ // Network timestamp: frameInfo->timing.network_timestamp_ms
+ // Receive start: frameInfo->timing.receive_start_ms
+ // Receive finish: frameInfo->timing.receive_finish_ms
+ // Decode start: frameInfo->decodeStartTimeMs
+ // Decode finish: now_ms
+ // Render time: frameInfo->renderTimeMs
+ }
+
decodedImage.set_timestamp_us(
frameInfo->renderTimeMs * rtc::kNumMicrosecsPerMillisec);
decodedImage.set_rotation(frameInfo->rotation);
@@ -151,6 +175,7 @@ int32_t VCMGenericDecoder::Decode(const VCMEncodedFrame& frame, int64_t nowMs) {
_frameInfos[_nextFrameInfoIdx].decodeStartTimeMs = nowMs;
_frameInfos[_nextFrameInfoIdx].renderTimeMs = frame.RenderTimeMs();
_frameInfos[_nextFrameInfoIdx].rotation = frame.rotation();
+ _frameInfos[_nextFrameInfoIdx].timing = frame.video_timing();
// 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.

Powered by Google App Engine
This is Rietveld 408576698