Index: media/cast/sender/video_sender.cc |
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc |
index ebdde8e8ea66872b1236c7d7999fb4ec78fca72d..bb3832b67f5463b20a7f6bf5331fb3c98bdae944 100644 |
--- a/media/cast/sender/video_sender.cc |
+++ b/media/cast/sender/video_sender.cc |
@@ -160,6 +160,10 @@ void VideoSender::InsertRawVideoFrame( |
last_enqueued_frame_rtp_timestamp_) || |
reference_time <= last_enqueued_frame_reference_time_)) { |
VLOG(1) << "Dropping video frame: RTP or reference time did not increase."; |
+ TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop", |
+ TRACE_EVENT_SCOPE_THREAD, |
+ "timestamp", reference_time.ToInternalValue(), |
+ "rtp_timestamp", rtp_timestamp); |
return; |
} |
@@ -189,11 +193,18 @@ void VideoSender::InsertRawVideoFrame( |
// drop every subsequent frame for the rest of the session. |
video_encoder_->EmitFrames(); |
+ TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop", |
+ TRACE_EVENT_SCOPE_THREAD, |
+ "timestamp", reference_time.ToInternalValue(), |
+ "rtp_timestamp", rtp_timestamp); |
return; |
} |
uint32 bitrate = congestion_control_->GetBitrate( |
reference_time + target_playout_delay_, target_playout_delay_); |
+ |
+ TRACE_COUNTER_ID1("cast.stream", "Video Target Bitrate", this, bitrate); |
+ |
if (bitrate != last_bitrate_) { |
video_encoder_->SetBitRate(bitrate); |
last_bitrate_ = bitrate; |
@@ -210,6 +221,9 @@ void VideoSender::InsertRawVideoFrame( |
last_reported_lossy_utilization_, |
video_frame.get()); |
+ TRACE_EVENT_ASYNC_BEGIN2("cast.stream", "Video Encode", video_frame.get(), |
+ "timestamp", reference_time.ToInternalValue(), |
+ "rtp_timestamp", rtp_timestamp); |
if (video_encoder_->EncodeVideoFrame( |
video_frame, |
reference_time, |
@@ -223,6 +237,10 @@ void VideoSender::InsertRawVideoFrame( |
last_enqueued_frame_reference_time_ = reference_time; |
} else { |
VLOG(1) << "Encoder rejected a frame. Skipping..."; |
+ TRACE_EVENT_INSTANT2("cast.stream", "Video Encode Reject", |
+ TRACE_EVENT_SCOPE_THREAD, |
+ "timestamp", reference_time.ToInternalValue(), |
+ "rtp_timestamp", rtp_timestamp); |
} |
} |
@@ -263,6 +281,11 @@ void VideoSender::OnEncodedVideoFrame( |
last_reported_deadline_utilization_ = encoded_frame->deadline_utilization; |
last_reported_lossy_utilization_ = encoded_frame->lossy_utilization; |
+ TRACE_EVENT_ASYNC_END2("cast.stream", "Video Encode", video_frame.get(), |
+ "duration", duration_in_encoder_.ToInternalValue(), |
+ "deadline_utilization", |
+ last_reported_lossy_utilization_); |
+ |
// Report the resource utilization for processing this frame. Take the |
// greater of the two utilization values and attenuate them such that the |
// target utilization is reported as the maximum sustainable amount. |