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

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

Issue 1424843002: Make VCMEncodedFrameCallback const. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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
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 17 matching lines...) Expand all
28 EncodedImageCallback* post_encode_callback, 28 EncodedImageCallback* post_encode_callback,
29 VideoEncoderRateObserver* encoder_rate_observer, 29 VideoEncoderRateObserver* encoder_rate_observer,
30 VCMQMSettingsCallback* qm_settings_callback) 30 VCMQMSettingsCallback* qm_settings_callback)
31 : clock_(clock), 31 : clock_(clock),
32 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 32 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
33 _encoder(nullptr), 33 _encoder(nullptr),
34 _encodedFrameCallback(post_encode_callback), 34 _encodedFrameCallback(post_encode_callback),
35 _nextFrameTypes(1, kVideoFrameDelta), 35 _nextFrameTypes(1, kVideoFrameDelta),
36 _mediaOpt(clock_), 36 _mediaOpt(clock_),
37 _sendStatsCallback(nullptr), 37 _sendStatsCallback(nullptr),
38 _codecDataBase(encoder_rate_observer), 38 _codecDataBase(encoder_rate_observer, &_encodedFrameCallback),
39 frame_dropper_enabled_(true), 39 frame_dropper_enabled_(true),
40 _sendStatsTimer(1000, clock_), 40 _sendStatsTimer(1000, clock_),
41 current_codec_(), 41 current_codec_(),
42 qm_settings_callback_(qm_settings_callback), 42 qm_settings_callback_(qm_settings_callback),
43 protection_callback_(nullptr) { 43 protection_callback_(nullptr) {
44 encoder_params_ = {0, 0, 0, 0, false}; 44 encoder_params_ = {0, 0, 0, 0, false};
45 // Allow VideoSender to be created on one thread but used on another, post 45 // Allow VideoSender to be created on one thread but used on another, post
46 // construction. This is currently how this class is being used by at least 46 // construction. This is currently how this class is being used by at least
47 // one external project (diffractor). 47 // one external project (diffractor).
48 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr); 48 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Register the send codec to be used. 83 // Register the send codec to be used.
84 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec, 84 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec,
85 uint32_t numberOfCores, 85 uint32_t numberOfCores,
86 uint32_t maxPayloadSize) { 86 uint32_t maxPayloadSize) {
87 RTC_DCHECK(main_thread_.CalledOnValidThread()); 87 RTC_DCHECK(main_thread_.CalledOnValidThread());
88 rtc::CritScope lock(&send_crit_); 88 rtc::CritScope lock(&send_crit_);
89 if (sendCodec == nullptr) { 89 if (sendCodec == nullptr) {
90 return VCM_PARAMETER_ERROR; 90 return VCM_PARAMETER_ERROR;
91 } 91 }
92 92
93 bool ret = _codecDataBase.SetSendCodec( 93 bool ret =
94 sendCodec, numberOfCores, maxPayloadSize, &_encodedFrameCallback); 94 _codecDataBase.SetSendCodec(sendCodec, numberOfCores, maxPayloadSize);
95 95
96 // Update encoder regardless of result to make sure that we're not holding on 96 // Update encoder regardless of result to make sure that we're not holding on
97 // to a deleted instance. 97 // to a deleted instance.
98 _encoder = _codecDataBase.GetEncoder(); 98 _encoder = _codecDataBase.GetEncoder();
99 // Cache the current codec here so they can be fetched from this thread 99 // Cache the current codec here so they can be fetched from this thread
100 // without requiring the _sendCritSect lock. 100 // without requiring the _sendCritSect lock.
101 current_codec_ = *sendCodec; 101 current_codec_ = *sendCodec;
102 102
103 if (!ret) { 103 if (!ret) {
104 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '" 104 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 int window_bps = std::max(threshold_bps / 10, 10000); 387 int window_bps = std::max(threshold_bps / 10, 10000);
388 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); 388 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps);
389 } 389 }
390 390
391 bool VideoSender::VideoSuspended() const { 391 bool VideoSender::VideoSuspended() const {
392 rtc::CritScope lock(&send_crit_); 392 rtc::CritScope lock(&send_crit_);
393 return _mediaOpt.IsVideoSuspended(); 393 return _mediaOpt.IsVideoSuspended();
394 } 394 }
395 } // namespace vcm 395 } // namespace vcm
396 } // namespace webrtc 396 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698