summaryrefslogtreecommitdiffstats
path: root/media/cast/video_sender
diff options
context:
space:
mode:
authormikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-08 01:39:45 +0000
committermikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-08 01:39:45 +0000
commitc9b3db8789609588c56d5a159b4c97c88d2c1cb1 (patch)
tree3be83c09a7c8dff68257ea48c09529d9cfcaf3b1 /media/cast/video_sender
parent4f9be5bad7f305d7ccea70d3bbea4e6f9079a769 (diff)
downloadchromium_src-c9b3db8789609588c56d5a159b4c97c88d2c1cb1.zip
chromium_src-c9b3db8789609588c56d5a159b4c97c88d2c1cb1.tar.gz
chromium_src-c9b3db8789609588c56d5a159b4c97c88d2c1cb1.tar.bz2
Cast: Add rtp_timestamp to EncodedVideoFrame and update logging
Review URL: https://codereview.chromium.org/141443010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249885 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/cast/video_sender')
-rw-r--r--media/cast/video_sender/external_video_encoder.cc17
-rw-r--r--media/cast/video_sender/video_encoder_impl.cc17
-rw-r--r--media/cast/video_sender/video_sender.cc6
3 files changed, 15 insertions, 25 deletions
diff --git a/media/cast/video_sender/external_video_encoder.cc b/media/cast/video_sender/external_video_encoder.cc
index f810e63..6ec8d3d 100644
--- a/media/cast/video_sender/external_video_encoder.cc
+++ b/media/cast/video_sender/external_video_encoder.cc
@@ -21,11 +21,10 @@ namespace {
static const int kInputBufferExtraCount = 1;
static const int kOutputBufferCount = 3;
-void LogFrameEncodedEvent(const base::TimeTicks& now,
- media::cast::CastEnvironment* const cast_environment,
+void LogFrameEncodedEvent(media::cast::CastEnvironment* const cast_environment,
const base::TimeTicks& capture_time) {
cast_environment->Logging()->InsertFrameEvent(
- now,
+ cast_environment->Clock()->NowTicks(),
media::cast::kVideoFrameEncoded,
media::cast::GetVideoRtpTimestamp(capture_time),
media::cast::kFrameIdUnknown);
@@ -274,6 +273,8 @@ class LocalVideoEncodeAcceleratorClient
encoded_frame->last_referenced_frame_id = last_encoded_frame_id_;
last_encoded_frame_id_++;
encoded_frame->frame_id = last_encoded_frame_id_;
+ encoded_frame->rtp_timestamp =
+ GetVideoRtpTimestamp(encoded_frame_data_storage_.front().capture_time);
if (key_frame) {
// Self referenced.
encoded_frame->last_referenced_frame_id = encoded_frame->frame_id;
@@ -285,17 +286,15 @@ class LocalVideoEncodeAcceleratorClient
cast_environment_->PostTask(
CastEnvironment::MAIN,
FROM_HERE,
- base::Bind(encoded_frame_data_storage_.front().frame_encoded_callback,
- base::Passed(&encoded_frame),
+ base::Bind(LogFrameEncodedEvent,
+ cast_environment_,
encoded_frame_data_storage_.front().capture_time));
- base::TimeTicks now = cast_environment_->Clock()->NowTicks();
cast_environment_->PostTask(
CastEnvironment::MAIN,
FROM_HERE,
- base::Bind(LogFrameEncodedEvent,
- now,
- cast_environment_,
+ base::Bind(encoded_frame_data_storage_.front().frame_encoded_callback,
+ base::Passed(&encoded_frame),
encoded_frame_data_storage_.front().capture_time));
encoded_frame_data_storage_.pop_front();
diff --git a/media/cast/video_sender/video_encoder_impl.cc b/media/cast/video_sender/video_encoder_impl.cc
index 94b9840..e4e5e54 100644
--- a/media/cast/video_sender/video_encoder_impl.cc
+++ b/media/cast/video_sender/video_encoder_impl.cc
@@ -20,17 +20,6 @@ namespace {
typedef base::Callback<void(Vp8Encoder*)> PassEncoderCallback;
-void LogFrameEncodedEvent(const base::TimeTicks& now,
- scoped_refptr<CastEnvironment> cast_environment,
- const base::TimeTicks& capture_time) {
- DCHECK(cast_environment->CurrentlyOn(CastEnvironment::MAIN));
- cast_environment->Logging()->InsertFrameEvent(
- now,
- kVideoFrameEncoded,
- GetVideoRtpTimestamp(capture_time),
- kFrameIdUnknown);
-}
-
void InitializeVp8EncoderOnEncoderThread(
const scoped_refptr<CastEnvironment>& environment,
Vp8Encoder* vp8_encoder) {
@@ -57,11 +46,7 @@ void EncodeVideoFrameOnEncoderThread(
new transport::EncodedVideoFrame());
bool retval = vp8_encoder->Encode(video_frame, encoded_frame.get());
- base::TimeTicks now = environment->Clock()->NowTicks();
- environment->PostTask(
- CastEnvironment::MAIN,
- FROM_HERE,
- base::Bind(LogFrameEncodedEvent, now, environment, capture_time));
+ encoded_frame->rtp_timestamp = transport::GetVideoRtpTimestamp(capture_time);
if (!retval) {
VLOG(1) << "Encoding failed";
diff --git a/media/cast/video_sender/video_sender.cc b/media/cast/video_sender/video_sender.cc
index eeb2930..a390a44 100644
--- a/media/cast/video_sender/video_sender.cc
+++ b/media/cast/video_sender/video_sender.cc
@@ -181,6 +181,12 @@ void VideoSender::SendEncodedVideoFrameMainThread(
<< static_cast<int>(encoded_frame->frame_id);
}
+ cast_environment_->Logging()->InsertFrameEvent(
+ last_send_time_,
+ kVideoFrameEncoded,
+ encoded_frame->rtp_timestamp,
+ encoded_frame->frame_id);
+
last_sent_frame_id_ = static_cast<int>(encoded_frame->frame_id);
cast_environment_->PostTask(
CastEnvironment::TRANSPORT,