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

Side by Side Diff: media/cast/video_sender/video_encoder.cc

Issue 69603002: Incorporating logging into Cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding scoped_ptr include Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/video_sender/video_encoder.h" 5 #include "media/cast/video_sender/video_encoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const CodecDynamicConfig& dynamic_config, 59 const CodecDynamicConfig& dynamic_config,
60 const FrameEncodedCallback& frame_encoded_callback, 60 const FrameEncodedCallback& frame_encoded_callback,
61 const base::Closure frame_release_callback) { 61 const base::Closure frame_release_callback) {
62 if (dynamic_config.key_frame_requested) { 62 if (dynamic_config.key_frame_requested) {
63 vp8_encoder_->GenerateKeyFrame(); 63 vp8_encoder_->GenerateKeyFrame();
64 } 64 }
65 vp8_encoder_->LatestFrameIdToReference( 65 vp8_encoder_->LatestFrameIdToReference(
66 dynamic_config.latest_frame_id_to_reference); 66 dynamic_config.latest_frame_id_to_reference);
67 vp8_encoder_->UpdateRates(dynamic_config.bit_rate); 67 vp8_encoder_->UpdateRates(dynamic_config.bit_rate);
68 68
69 uint32 rtp_timestamp = GetVideoRtpTimestamp(capture_time);
70 cast_environment_->Logging()->InsertFrameEvent(kVideoFrameSentToEncoder,
71 rtp_timestamp, kFrameIdUnknown);
69 scoped_ptr<EncodedVideoFrame> encoded_frame(new EncodedVideoFrame()); 72 scoped_ptr<EncodedVideoFrame> encoded_frame(new EncodedVideoFrame());
70 bool retval = vp8_encoder_->Encode(*video_frame, encoded_frame.get()); 73 bool retval = vp8_encoder_->Encode(*video_frame, encoded_frame.get());
71 74
72 // We are done with the video frame release it. 75 // We are done with the video frame release it.
73 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 76 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
74 frame_release_callback); 77 frame_release_callback);
75 78
76 if (!retval) { 79 if (!retval) {
77 VLOG(1) << "Encoding failed"; 80 VLOG(1) << "Encoding failed";
78 return; 81 return;
79 } 82 }
80 if (encoded_frame->data.size() <= 0) { 83 if (encoded_frame->data.size() <= 0) {
81 VLOG(1) << "Encoding resulted in an empty frame"; 84 VLOG(1) << "Encoding resulted in an empty frame";
82 return; 85 return;
83 } 86 }
87 cast_environment_->Logging()->InsertFrameEvent(kVideoFrameEncoded,
88 rtp_timestamp, kFrameIdUnknown);
84 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 89 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
85 base::Bind(frame_encoded_callback, 90 base::Bind(frame_encoded_callback,
86 base::Passed(&encoded_frame), capture_time)); 91 base::Passed(&encoded_frame), capture_time));
87 } 92 }
88 93
89 // Inform the encoder about the new target bit rate. 94 // Inform the encoder about the new target bit rate.
90 void VideoEncoder::SetBitRate(int new_bit_rate) { 95 void VideoEncoder::SetBitRate(int new_bit_rate) {
91 dynamic_config_.bit_rate = new_bit_rate; 96 dynamic_config_.bit_rate = new_bit_rate;
92 } 97 }
93 98
(...skipping 11 matching lines...) Expand all
105 void VideoEncoder::LatestFrameIdToReference(uint32 frame_id) { 110 void VideoEncoder::LatestFrameIdToReference(uint32 frame_id) {
106 dynamic_config_.latest_frame_id_to_reference = frame_id; 111 dynamic_config_.latest_frame_id_to_reference = frame_id;
107 } 112 }
108 113
109 int VideoEncoder::NumberOfSkippedFrames() const { 114 int VideoEncoder::NumberOfSkippedFrames() const {
110 return skip_count_; 115 return skip_count_;
111 } 116 }
112 117
113 } // namespace cast 118 } // namespace cast
114 } // namespace media 119 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_receiver/video_receiver_unittest.cc ('k') | media/cast/video_sender/video_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698