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

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: Fixing errors 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const CodecDynamicConfig& dynamic_config, 58 const CodecDynamicConfig& dynamic_config,
59 const FrameEncodedCallback& frame_encoded_callback, 59 const FrameEncodedCallback& frame_encoded_callback,
60 const base::Closure frame_release_callback) { 60 const base::Closure frame_release_callback) {
61 if (dynamic_config.key_frame_requested) { 61 if (dynamic_config.key_frame_requested) {
62 vp8_encoder_->GenerateKeyFrame(); 62 vp8_encoder_->GenerateKeyFrame();
63 } 63 }
64 vp8_encoder_->LatestFrameIdToReference( 64 vp8_encoder_->LatestFrameIdToReference(
65 dynamic_config.latest_frame_id_to_reference); 65 dynamic_config.latest_frame_id_to_reference);
66 vp8_encoder_->UpdateRates(dynamic_config.bit_rate); 66 vp8_encoder_->UpdateRates(dynamic_config.bit_rate);
67 67
68 uint32 rtp_timestamp = GetVideoRtpTimestamp(capture_time);
69 cast_environment_->Logging()->InsertFrameEvent(kVideoFrameSentToEncoder,
70 rtp_timestamp, kFrameIdUnknown);
68 scoped_ptr<EncodedVideoFrame> encoded_frame(new EncodedVideoFrame()); 71 scoped_ptr<EncodedVideoFrame> encoded_frame(new EncodedVideoFrame());
69 bool retval = vp8_encoder_->Encode(*video_frame, encoded_frame.get()); 72 bool retval = vp8_encoder_->Encode(*video_frame, encoded_frame.get());
70 73
71 // We are done with the video frame release it. 74 // We are done with the video frame release it.
72 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 75 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
73 frame_release_callback); 76 frame_release_callback);
74 77
75 if (!retval) { 78 if (!retval) {
76 VLOG(1) << "Encoding failed"; 79 VLOG(1) << "Encoding failed";
77 return; 80 return;
78 } 81 }
79 if (encoded_frame->data.size() <= 0) { 82 if (encoded_frame->data.size() <= 0) {
80 VLOG(1) << "Encoding resulted in an empty frame"; 83 VLOG(1) << "Encoding resulted in an empty frame";
81 return; 84 return;
82 } 85 }
86 cast_environment_->Logging()->InsertFrameEvent(kVideoFrameEncoded,
87 rtp_timestamp, kFrameIdUnknown);
83 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE, 88 cast_environment_->PostTask(CastEnvironment::MAIN, FROM_HERE,
84 base::Bind(frame_encoded_callback, 89 base::Bind(frame_encoded_callback,
85 base::Passed(&encoded_frame), capture_time)); 90 base::Passed(&encoded_frame), capture_time));
86 } 91 }
87 92
88 // Inform the encoder about the new target bit rate. 93 // Inform the encoder about the new target bit rate.
89 void VideoEncoder::SetBitRate(int new_bit_rate) { 94 void VideoEncoder::SetBitRate(int new_bit_rate) {
90 dynamic_config_.bit_rate = new_bit_rate; 95 dynamic_config_.bit_rate = new_bit_rate;
91 } 96 }
92 97
(...skipping 11 matching lines...) Expand all
104 void VideoEncoder::LatestFrameIdToReference(uint8 frame_id) { 109 void VideoEncoder::LatestFrameIdToReference(uint8 frame_id) {
105 dynamic_config_.latest_frame_id_to_reference = frame_id; 110 dynamic_config_.latest_frame_id_to_reference = frame_id;
106 } 111 }
107 112
108 int VideoEncoder::NumberOfSkippedFrames() const { 113 int VideoEncoder::NumberOfSkippedFrames() const {
109 return skip_count_; 114 return skip_count_;
110 } 115 }
111 116
112 } // namespace cast 117 } // namespace cast
113 } // namespace media 118 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698