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

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

Issue 2946413002: Report timing frames info in GetStats. (Closed)
Patch Set: rebase Created 3 years, 5 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 42ee8b600c7f2564d6368a2fd4c24f95d0fa210c..80b08b54784d256080672b620740c6e185b9fa56 100644
--- a/webrtc/modules/video_coding/generic_decoder.cc
+++ b/webrtc/modules/video_coding/generic_decoder.cc
@@ -10,6 +10,8 @@
#include "webrtc/modules/video_coding/generic_decoder.h"
+#include <algorithm>
+
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/timeutils.h"
@@ -91,6 +93,7 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
// Report timing information.
if (frameInfo->timing.is_timing_frame) {
+ int64_t capture_time_ms = decodedImage.ntp_time_ms() - ntp_offset_;
// Convert remote timestamps to local time from ntp timestamps.
frameInfo->timing.encode_start_ms -= ntp_offset_;
frameInfo->timing.encode_finish_ms -= ntp_offset_;
@@ -98,19 +101,44 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
frameInfo->timing.pacer_exit_ms -= ntp_offset_;
frameInfo->timing.network_timestamp_ms -= ntp_offset_;
frameInfo->timing.network2_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
- // Network2 timestamp: frameInfo->timing.network2_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
+
+ int64_t sender_delta_ms = 0;
+ if (decodedImage.ntp_time_ms() < 0) {
+ // Sender clock is not estimated yet. Make sure that sender times are all
+ // negative to indicate that. Yet they still should be relatively correct.
+ sender_delta_ms =
+ std::max({capture_time_ms, frameInfo->timing.encode_start_ms,
+ frameInfo->timing.encode_finish_ms,
+ frameInfo->timing.packetization_finish_ms,
+ frameInfo->timing.pacer_exit_ms,
+ frameInfo->timing.network_timestamp_ms,
+ frameInfo->timing.network2_timestamp_ms}) +
+ 1;
+ }
+
+ TimingFrameInfo timing_frame_info;
+
+ timing_frame_info.capture_time_ms = capture_time_ms - sender_delta_ms;
+ timing_frame_info.encode_start_ms =
+ frameInfo->timing.encode_start_ms - sender_delta_ms;
+ timing_frame_info.encode_finish_ms =
+ frameInfo->timing.encode_finish_ms - sender_delta_ms;
+ timing_frame_info.packetization_finish_ms =
+ frameInfo->timing.packetization_finish_ms - sender_delta_ms;
+ timing_frame_info.pacer_exit_ms =
+ frameInfo->timing.pacer_exit_ms - sender_delta_ms;
+ timing_frame_info.network_timestamp_ms =
+ frameInfo->timing.network_timestamp_ms - sender_delta_ms;
+ timing_frame_info.network2_timestamp_ms =
+ frameInfo->timing.network2_timestamp_ms - sender_delta_ms;
+ timing_frame_info.receive_start_ms = frameInfo->timing.receive_start_ms;
+ timing_frame_info.receive_finish_ms = frameInfo->timing.receive_finish_ms;
+ timing_frame_info.decode_start_ms = frameInfo->decodeStartTimeMs;
+ timing_frame_info.decode_finish_ms = now_ms;
+ timing_frame_info.render_time_ms = frameInfo->renderTimeMs;
+ timing_frame_info.rtp_timestamp = decodedImage.timestamp();
+
+ _timing->SetTimingFrameInfo(timing_frame_info);
}
decodedImage.set_timestamp_us(
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2_unittest.cc ('k') | webrtc/modules/video_coding/include/video_coding_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698