Chromium Code Reviews| Index: webrtc/api/video/video_timing.h |
| diff --git a/webrtc/api/video/video_timing.h b/webrtc/api/video/video_timing.h |
| index 44991dfbeb13ab9b9a4b05a85fc4be2a6c79c166..9341fc5dce0eea0216ce505526ce917daf5dcf5e 100644 |
| --- a/webrtc/api/video/video_timing.h |
| +++ b/webrtc/api/video/video_timing.h |
| @@ -13,6 +13,7 @@ |
| #include <stdint.h> |
| +#include <limits> |
| #include <string> |
| #include "webrtc/rtc_base/checks.h" |
| @@ -20,21 +21,33 @@ |
| namespace webrtc { |
| +enum TimingFrameFlags : uint8_t { |
| + kDefault = 0, // No flags set (used by old protocol) |
| + kTriggeredByTimer = 1 << 0, // Frame marked for tracing by periodic timer. |
| + kTriggeredBySize = 1 << 1, // Frame marked for tracing due to size. |
| + kInvalid = std::numeric_limits<uint8_t>::max() // Invalid, ignore! |
| +}; |
| + |
| // Video timing timestamps in ms counted from capture_time_ms of a frame. |
| // This structure represents data sent in video-timing RTP header extension. |
| struct VideoSendTiming { |
| - static const uint8_t kEncodeStartDeltaIdx = 0; |
| - static const uint8_t kEncodeFinishDeltaIdx = 1; |
| - static const uint8_t kPacketizationFinishDeltaIdx = 2; |
| - static const uint8_t kPacerExitDeltaIdx = 3; |
| - static const uint8_t kNetworkTimestampDeltaIdx = 4; |
| - static const uint8_t kNetwork2TimestampDeltaIdx = 5; |
| + // Indices of the fields in the RTP header extension, counting from the first |
| + // byte after the one-byte header. |
| + static constexpr uint8_t kEncodeStartDeltaIdx = 0; |
|
danilchap
2017/08/11 12:22:35
may be rename them from Idx to Offset
sprang_webrtc
2017/08/11 13:19:05
Done.
|
| + static constexpr uint8_t kEncodeFinishDeltaIdx = 2; |
| + static constexpr uint8_t kPacketizationFinishDeltaIdx = 4; |
| + static constexpr uint8_t kPacerExitDeltaIdx = 6; |
| + static constexpr uint8_t kNetworkTimestampDeltaIdx = 8; |
| + static constexpr uint8_t kNetwork2TimestampDeltaIdx = 10; |
| + static constexpr uint8_t kFLagsIdx = 12; |
| // Returns |time_ms - base_ms| capped at max 16-bit value. |
| // Used to fill this data structure as per |
| // https://webrtc.org/experiments/rtp-hdrext/video-timing/ extension stores |
| // 16-bit deltas of timestamps from packet capture time. |
| static uint16_t GetDeltaCappedMs(int64_t base_ms, int64_t time_ms) { |
| + if (base_ms >= time_ms) |
| + printf("Wat\n"); |
|
danilchap
2017/08/11 12:22:35
may be add to next line:
RTC_DCHECK_GE(time_ms, ba
sprang_webrtc
2017/08/11 13:19:05
Oops, this was debug code I forgot to remove.
|
| RTC_DCHECK_GE(time_ms, base_ms); |
| return rtc::saturated_cast<uint16_t>(time_ms - base_ms); |
| } |
| @@ -45,7 +58,7 @@ struct VideoSendTiming { |
| uint16_t pacer_exit_delta_ms; |
| uint16_t network_timstamp_delta_ms; |
| uint16_t network2_timstamp_delta_ms; |
| - bool is_timing_frame; |
| + uint8_t flags; |
|
danilchap
2017/08/11 12:22:35
may be TimingFrameFlags instead of uint8_t
sprang_webrtc
2017/08/11 13:19:05
No, this is intended a bit-field. kTriggeredByTime
|
| }; |
| // Used to report precise timings of a 'timing frames'. Contains all important |
| @@ -64,6 +77,14 @@ struct TimingFrameInfo { |
| // preferred. |
| bool IsLongerThan(const TimingFrameInfo& other) const; |
| + // Returns true if flags are set to indicate this frame was marked for tracing |
| + // due to the size being outside some limit. |
| + bool IsOutlier() const; |
| + |
| + // Returns true if the timing data is marked as invalid, in which case it |
| + // should be ignored. |
| + bool IsInvalid() const; |
| + |
| std::string ToString() const; |
| uint32_t rtp_timestamp; // Identifier of a frame. |
| @@ -84,6 +105,8 @@ struct TimingFrameInfo { |
| int64_t decode_start_ms; // Decode start time. |
| int64_t decode_finish_ms; // Decode completion time. |
| int64_t render_time_ms; // Proposed render time to insure smooth playback. |
| + |
| + uint8_t flags; // Flags indicating validity and/or why tracing was triggered. |
|
danilchap
2017/08/11 12:22:35
ditto
sprang_webrtc
2017/08/11 13:19:05
ditto :)
|
| }; |
| } // namespace webrtc |