Chromium Code Reviews| Index: webrtc/api/video/video_timing.cc |
| diff --git a/webrtc/api/video/video_timing.cc b/webrtc/api/video/video_timing.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..de8143f9d11c5f82755067dbd55ebc7992e1e0df |
| --- /dev/null |
| +++ b/webrtc/api/video/video_timing.cc |
| @@ -0,0 +1,58 @@ |
| +/* |
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_API_VIDEO_VIDEO_TIMING_CC_ |
| +#define WEBRTC_API_VIDEO_VIDEO_TIMING_CC_ |
|
hbos
2017/06/27 14:08:30
No need for #ifndef in a .cc file.
ilnik
2017/06/27 15:23:56
Ooops. Copy-paste failed me.
|
| + |
| +#include "webrtc/api/video/video_timing.h" |
| + |
| +#include <sstream> |
| + |
| +namespace webrtc { |
| + |
| +TimingFrameInfo::TimingFrameInfo() |
| + : rtp_timestamp(0), |
| + capture_time_ms(-1), |
| + encode_start_ms(-1), |
| + encode_finish_ms(-1), |
| + packetization_finish_ms(-1), |
| + pacer_exit_ms(-1), |
| + network_timestamp_ms(-1), |
| + network2_timestamp_ms(-1), |
| + receive_start_ms(-1), |
| + receive_finish_ms(-1), |
| + decode_start_ms(-1), |
| + decode_finish_ms(-1), |
| + render_time_ms(-1) {} |
|
hbos
2017/06/27 14:08:30
If a value is optional please prefer rtc::Optional
ilnik
2017/06/27 15:23:56
Done.
|
| + |
| +int64_t TimingFrameInfo::EndToEndDelay() const { |
| + return capture_time_ms >= 0 ? decode_finish_ms - capture_time_ms : -1; |
| +} |
| + |
| +bool TimingFrameInfo::IsLongerThan(const TimingFrameInfo& other) const { |
| + int64_t other_delay = other.EndToEndDelay(); |
| + return other_delay == -1 || EndToEndDelay() > other_delay; |
| +} |
| + |
| +std::string TimingFrameInfo::ToString() const { |
| + std::stringstream out; |
| + out << rtp_timestamp << ',' << capture_time_ms << ',' << encode_start_ms |
| + << ',' << encode_finish_ms << ',' << packetization_finish_ms << ',' |
| + << pacer_exit_ms << ',' << network_timestamp_ms << ',' |
| + << network2_timestamp_ms << ',' << receive_start_ms << ',' |
| + << receive_finish_ms << ',' << decode_start_ms << ',' |
| + << decode_finish_ms << ',' << render_time_ms; |
| + return out.str(); |
|
hbos
2017/06/27 14:08:30
Not sure if to DCHECK that all values are set or u
ilnik
2017/06/27 15:23:56
Now, as TimingFrameInfo is wrapped in rtc::Optiona
|
| +} |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_API_VIDEO_VIDEO_TIMING_CC_ |
| + |