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

Unified Diff: media/cast/sender/video_sender.cc

Issue 1515433002: Replace uses of raw uint32's with a type-checked RtpTimeTicks data type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: media/cast/sender/video_sender.cc
diff --git a/media/cast/sender/video_sender.cc b/media/cast/sender/video_sender.cc
index ff65423d49ad6ba5523e0fbe792ce636f40cdfb8..20cfa82ade257b3a8dd5cf67033604f249f3fadd 100644
--- a/media/cast/sender/video_sender.cc
+++ b/media/cast/sender/video_sender.cc
@@ -43,7 +43,7 @@ const int kTargetUtilizationPercentage = 75;
// it.
void LogVideoCaptureTimestamps(CastEnvironment* cast_environment,
const media::VideoFrame& video_frame,
- RtpTimestamp rtp_timestamp) {
+ RtpTimeTicks rtp_timestamp) {
scoped_ptr<FrameEvent> capture_begin_event(new FrameEvent());
capture_begin_event->type = FRAME_CAPTURE_BEGIN;
capture_begin_event->media_type = VIDEO_EVENT;
@@ -149,8 +149,8 @@ void VideoSender::InsertRawVideoFrame(
return;
}
- const RtpTimestamp rtp_timestamp =
- TimeDeltaToRtpDelta(video_frame->timestamp(), kVideoFrequency);
+ const RtpTimeTicks rtp_timestamp =
+ RtpTimeTicks::FromTimeDelta(video_frame->timestamp(), kVideoFrequency);
LogVideoCaptureTimestamps(cast_environment_.get(), *video_frame,
rtp_timestamp);
@@ -159,7 +159,7 @@ void VideoSender::InsertRawVideoFrame(
"cast_perf_test", "InsertRawVideoFrame",
TRACE_EVENT_SCOPE_THREAD,
"timestamp", reference_time.ToInternalValue(),
- "rtp_timestamp", rtp_timestamp);
+ "rtp_timestamp", rtp_timestamp.lower_32_bits());
// Drop the frame if either its RTP or reference timestamp is not an increase
// over the last frame's. This protects: 1) the duration calculations that
@@ -167,14 +167,13 @@ void VideoSender::InsertRawVideoFrame(
// deeper in the implementation where each frame's RTP timestamp needs to be
// unique.
if (!last_enqueued_frame_reference_time_.is_null() &&
- (!IsNewerRtpTimestamp(rtp_timestamp,
- last_enqueued_frame_rtp_timestamp_) ||
+ (rtp_timestamp <= 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,
- "rtp_timestamp", rtp_timestamp,
- "reason", "time did not increase");
+ TRACE_EVENT_SCOPE_THREAD,
+ "rtp_timestamp", rtp_timestamp.lower_32_bits(),
+ "reason", "time did not increase");
return;
}
@@ -205,9 +204,9 @@ void VideoSender::InsertRawVideoFrame(
video_encoder_->EmitFrames();
TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop",
- TRACE_EVENT_SCOPE_THREAD,
- "rtp_timestamp", rtp_timestamp,
- "reason", "too much in flight");
+ TRACE_EVENT_SCOPE_THREAD,
+ "rtp_timestamp", rtp_timestamp.lower_32_bits(),
+ "reason", "too much in flight");
return;
}
@@ -240,7 +239,7 @@ void VideoSender::InsertRawVideoFrame(
video_frame,
bitrate))) {
TRACE_EVENT_ASYNC_BEGIN1("cast.stream", "Video Encode", video_frame.get(),
- "rtp_timestamp", rtp_timestamp);
+ "rtp_timestamp", rtp_timestamp.lower_32_bits());
frames_in_encoder_++;
duration_in_encoder_ += duration_added_by_next_frame;
last_enqueued_frame_rtp_timestamp_ = rtp_timestamp;
@@ -248,8 +247,8 @@ void VideoSender::InsertRawVideoFrame(
} else {
VLOG(1) << "Encoder rejected a frame. Skipping...";
TRACE_EVENT_INSTANT1("cast.stream", "Video Encode Reject",
- TRACE_EVENT_SCOPE_THREAD,
- "rtp_timestamp", rtp_timestamp);
+ TRACE_EVENT_SCOPE_THREAD,
+ "rtp_timestamp", rtp_timestamp.lower_32_bits());
}
}

Powered by Google App Engine
This is Rietveld 408576698