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

Side by Side Diff: webrtc/modules/video_coding/video_sender.cc

Issue 2253563002: Add codec name to CodecSpecificInfo and get the codec name stats from there instead. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix fake_encoder.cc Created 4 years, 4 months 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
« no previous file with comments | « webrtc/modules/video_coding/video_coding_impl.h ('k') | webrtc/test/fake_encoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 VideoSender::~VideoSender() {} 49 VideoSender::~VideoSender() {}
50 50
51 void VideoSender::Process() { 51 void VideoSender::Process() {
52 if (_sendStatsTimer.TimeUntilProcess() == 0) { 52 if (_sendStatsTimer.TimeUntilProcess() == 0) {
53 // |_sendStatsTimer.Processed()| must be called. Otherwise 53 // |_sendStatsTimer.Processed()| must be called. Otherwise
54 // VideoSender::Process() will be called in an infinite loop. 54 // VideoSender::Process() will be called in an infinite loop.
55 _sendStatsTimer.Processed(); 55 _sendStatsTimer.Processed();
56 if (send_stats_callback_) { 56 if (send_stats_callback_) {
57 uint32_t bitRate = _mediaOpt.SentBitRate(); 57 uint32_t bitRate = _mediaOpt.SentBitRate();
58 uint32_t frameRate = _mediaOpt.SentFrameRate(); 58 uint32_t frameRate = _mediaOpt.SentFrameRate();
59 std::string encoder_name; 59 send_stats_callback_->SendStatistics(bitRate, frameRate);
60 {
61 rtc::CritScope cs(&params_crit_);
62 // Copy the string here so that we don't hold |params_crit_| in the CB.
63 encoder_name = encoder_name_;
64 }
65 send_stats_callback_->SendStatistics(bitRate, frameRate, encoder_name);
66 } 60 }
67 } 61 }
68 62
69 { 63 {
70 rtc::CritScope cs(&params_crit_); 64 rtc::CritScope cs(&params_crit_);
71 // Force an encoder parameters update, so that incoming frame rate is 65 // Force an encoder parameters update, so that incoming frame rate is
72 // updated even if bandwidth hasn't changed. 66 // updated even if bandwidth hasn't changed.
73 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); 67 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate();
74 } 68 }
75 } 69 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 301 }
308 int32_t ret = 302 int32_t ret =
309 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); 303 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types);
310 if (ret < 0) { 304 if (ret < 0) {
311 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; 305 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret;
312 return ret; 306 return ret;
313 } 307 }
314 308
315 { 309 {
316 rtc::CritScope lock(&params_crit_); 310 rtc::CritScope lock(&params_crit_);
317 encoder_name_ = _encoder->ImplementationName();
318
319 // Change all keyframe requests to encode delta frames the next time. 311 // Change all keyframe requests to encode delta frames the next time.
320 for (size_t i = 0; i < next_frame_types_.size(); ++i) { 312 for (size_t i = 0; i < next_frame_types_.size(); ++i) {
321 // Check for equality (same requested as before encoding) to not 313 // Check for equality (same requested as before encoding) to not
322 // accidentally drop a keyframe request while encoding. 314 // accidentally drop a keyframe request while encoding.
323 if (next_frame_types[i] == next_frame_types_[i]) 315 if (next_frame_types[i] == next_frame_types_[i])
324 next_frame_types_[i] = kVideoFrameDelta; 316 next_frame_types_[i] = kVideoFrameDelta;
325 } 317 }
326 } 318 }
327 return VCM_OK; 319 return VCM_OK;
328 } 320 }
(...skipping 29 matching lines...) Expand all
358 } 350 }
359 351
360 int32_t VideoSender::EnableFrameDropper(bool enable) { 352 int32_t VideoSender::EnableFrameDropper(bool enable) {
361 rtc::CritScope lock(&encoder_crit_); 353 rtc::CritScope lock(&encoder_crit_);
362 frame_dropper_enabled_ = enable; 354 frame_dropper_enabled_ = enable;
363 _mediaOpt.EnableFrameDropper(enable); 355 _mediaOpt.EnableFrameDropper(enable);
364 return VCM_OK; 356 return VCM_OK;
365 } 357 }
366 } // namespace vcm 358 } // namespace vcm
367 } // namespace webrtc 359 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_coding_impl.h ('k') | webrtc/test/fake_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698