Add timing info to all encoded frames.
Even if we're not going to transmit any timing info over the wire. Bug: webrtc:8504 Change-Id: Id54192a10e6b2a6a2cb57a2ff6b28fc0d16e471d Reviewed-on: https://webrtc-review.googlesource.com/21160 Reviewed-by: Per Kjellander <perkj@webrtc.org> Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20628}
This commit is contained in:
@ -1 +1,3 @@
|
|||||||
magjed@webrtc.org
|
magjed@webrtc.org
|
||||||
|
|
||||||
|
per-file video_timing.h=ilnik@webrtc.org
|
||||||
|
@ -22,7 +22,11 @@
|
|||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
enum TimingFrameFlags : uint8_t {
|
enum TimingFrameFlags : uint8_t {
|
||||||
kDefault = 0, // No flags set (used by old protocol)
|
kNotTriggered = 0, // Timing info valid, but not to be transmitted.
|
||||||
|
// Used on send-side only.
|
||||||
|
// TODO(ilnik): Delete compatibility alias.
|
||||||
|
// Used to be sent over the wire, for the old protocol.
|
||||||
|
kDefault = 0, // Old name, for API compatibility.
|
||||||
kTriggeredByTimer = 1 << 0, // Frame marked for tracing by periodic timer.
|
kTriggeredByTimer = 1 << 0, // Frame marked for tracing by periodic timer.
|
||||||
kTriggeredBySize = 1 << 1, // Frame marked for tracing due to size.
|
kTriggeredBySize = 1 << 1, // Frame marked for tracing due to size.
|
||||||
kInvalid = std::numeric_limits<uint8_t>::max() // Invalid, ignore!
|
kInvalid = std::numeric_limits<uint8_t>::max() // Invalid, ignore!
|
||||||
|
@ -255,7 +255,7 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
|
|||||||
rtc::Optional<size_t> outlier_frame_size;
|
rtc::Optional<size_t> outlier_frame_size;
|
||||||
rtc::Optional<int64_t> encode_start_ms;
|
rtc::Optional<int64_t> encode_start_ms;
|
||||||
size_t num_simulcast_svc_streams = 1;
|
size_t num_simulcast_svc_streams = 1;
|
||||||
uint8_t timing_flags = TimingFrameFlags::kInvalid;
|
uint8_t timing_flags = TimingFrameFlags::kNotTriggered;
|
||||||
if (!internal_source_) {
|
if (!internal_source_) {
|
||||||
rtc::CritScope crit(&timing_params_lock_);
|
rtc::CritScope crit(&timing_params_lock_);
|
||||||
|
|
||||||
@ -308,8 +308,6 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
|
|||||||
// Outliers trigger timing frames, but do not affect scheduled timing
|
// Outliers trigger timing frames, but do not affect scheduled timing
|
||||||
// frames.
|
// frames.
|
||||||
if (outlier_frame_size && encoded_image._length >= *outlier_frame_size) {
|
if (outlier_frame_size && encoded_image._length >= *outlier_frame_size) {
|
||||||
if (timing_flags == TimingFrameFlags::kInvalid)
|
|
||||||
timing_flags = 0;
|
|
||||||
timing_flags |= TimingFrameFlags::kTriggeredBySize;
|
timing_flags |= TimingFrameFlags::kTriggeredBySize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -319,7 +317,7 @@ EncodedImageCallback::Result VCMEncodedFrameCallback::OnEncodedImage(
|
|||||||
// drift relative to rtc::TimeMillis(). We can't use it for Timing frames,
|
// drift relative to rtc::TimeMillis(). We can't use it for Timing frames,
|
||||||
// because to being sent in the network capture time required to be less than
|
// because to being sent in the network capture time required to be less than
|
||||||
// all the other timestamps.
|
// all the other timestamps.
|
||||||
if (timing_flags != TimingFrameFlags::kInvalid && encode_start_ms) {
|
if (encode_start_ms) {
|
||||||
encoded_image.SetEncodeTime(*encode_start_ms, rtc::TimeMillis());
|
encoded_image.SetEncodeTime(*encode_start_ms, rtc::TimeMillis());
|
||||||
encoded_image.timing_.flags = timing_flags;
|
encoded_image.timing_.flags = timing_flags;
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,7 +33,8 @@ class FakeEncodedImageCallback : public EncodedImageCallback {
|
|||||||
const CodecSpecificInfo* codec_specific_info,
|
const CodecSpecificInfo* codec_specific_info,
|
||||||
const RTPFragmentationHeader* fragmentation) override {
|
const RTPFragmentationHeader* fragmentation) override {
|
||||||
last_frame_was_timing_ =
|
last_frame_was_timing_ =
|
||||||
encoded_image.timing_.flags != TimingFrameFlags::kInvalid;
|
encoded_image.timing_.flags != TimingFrameFlags::kInvalid &&
|
||||||
|
encoded_image.timing_.flags != TimingFrameFlags::kNotTriggered;
|
||||||
return Result(Result::OK);
|
return Result(Result::OK);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -187,7 +187,8 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
|
|||||||
CopyCodecSpecific(codec_specific_info, &rtp_video_header);
|
CopyCodecSpecific(codec_specific_info, &rtp_video_header);
|
||||||
rtp_video_header.rotation = encoded_image.rotation_;
|
rtp_video_header.rotation = encoded_image.rotation_;
|
||||||
rtp_video_header.content_type = encoded_image.content_type_;
|
rtp_video_header.content_type = encoded_image.content_type_;
|
||||||
if (encoded_image.timing_.flags != TimingFrameFlags::kInvalid) {
|
if (encoded_image.timing_.flags != TimingFrameFlags::kInvalid &&
|
||||||
|
encoded_image.timing_.flags != TimingFrameFlags::kNotTriggered) {
|
||||||
rtp_video_header.video_timing.encode_start_delta_ms =
|
rtp_video_header.video_timing.encode_start_delta_ms =
|
||||||
VideoSendTiming::GetDeltaCappedMs(
|
VideoSendTiming::GetDeltaCappedMs(
|
||||||
encoded_image.capture_time_ms_,
|
encoded_image.capture_time_ms_,
|
||||||
@ -200,8 +201,10 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
|
|||||||
rtp_video_header.video_timing.pacer_exit_delta_ms = 0;
|
rtp_video_header.video_timing.pacer_exit_delta_ms = 0;
|
||||||
rtp_video_header.video_timing.network_timestamp_delta_ms = 0;
|
rtp_video_header.video_timing.network_timestamp_delta_ms = 0;
|
||||||
rtp_video_header.video_timing.network2_timestamp_delta_ms = 0;
|
rtp_video_header.video_timing.network2_timestamp_delta_ms = 0;
|
||||||
|
rtp_video_header.video_timing.flags = encoded_image.timing_.flags;
|
||||||
|
} else {
|
||||||
|
rtp_video_header.video_timing.flags = TimingFrameFlags::kInvalid;
|
||||||
}
|
}
|
||||||
rtp_video_header.video_timing.flags = encoded_image.timing_.flags;
|
|
||||||
rtp_video_header.playout_delay = encoded_image.playout_delay_;
|
rtp_video_header.playout_delay = encoded_image.playout_delay_;
|
||||||
|
|
||||||
int stream_index = rtp_video_header.simulcastIdx;
|
int stream_index = rtp_video_header.simulcastIdx;
|
||||||
|
Reference in New Issue
Block a user