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

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 1354143004: Remove callback_cs_ in ViEEncoder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 : transport_adapter_(config.send_transport), 111 : transport_adapter_(config.send_transport),
112 encoded_frame_proxy_(config.post_encode_callback), 112 encoded_frame_proxy_(config.post_encode_callback),
113 config_(config), 113 config_(config),
114 suspended_ssrcs_(suspended_ssrcs), 114 suspended_ssrcs_(suspended_ssrcs),
115 module_process_thread_(module_process_thread), 115 module_process_thread_(module_process_thread),
116 channel_group_(channel_group), 116 channel_group_(channel_group),
117 channel_id_(channel_id), 117 channel_id_(channel_id),
118 use_config_bitrate_(true), 118 use_config_bitrate_(true),
119 stats_proxy_(Clock::GetRealTimeClock(), config) { 119 stats_proxy_(Clock::GetRealTimeClock(), config) {
120 RTC_DCHECK(!config_.rtp.ssrcs.empty()); 120 RTC_DCHECK(!config_.rtp.ssrcs.empty());
121 RTC_CHECK(channel_group->CreateSendChannel(channel_id_, &transport_adapter_, 121 RTC_CHECK(channel_group->CreateSendChannel(
122 num_cpu_cores, config_.rtp.ssrcs)); 122 channel_id_, &transport_adapter_, &stats_proxy_,
123 config.pre_encode_callback, num_cpu_cores, config_.rtp.ssrcs));
123 vie_channel_ = channel_group_->GetChannel(channel_id_); 124 vie_channel_ = channel_group_->GetChannel(channel_id_);
124 vie_encoder_ = channel_group_->GetEncoder(channel_id_); 125 vie_encoder_ = channel_group_->GetEncoder(channel_id_);
125 126
126 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { 127 for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) {
127 const std::string& extension = config_.rtp.extensions[i].name; 128 const std::string& extension = config_.rtp.extensions[i].name;
128 int id = config_.rtp.extensions[i].id; 129 int id = config_.rtp.extensions[i].id;
129 // One-byte-extension local identifiers are in the range 1-14 inclusive. 130 // One-byte-extension local identifiers are in the range 1-14 inclusive.
130 RTC_DCHECK_GE(id, 1); 131 RTC_DCHECK_GE(id, 1);
131 RTC_DCHECK_LE(id, 14); 132 RTC_DCHECK_LE(id, 14);
132 if (extension == RtpExtension::kTOffset) { 133 if (extension == RtpExtension::kTOffset) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 RTC_DCHECK_GE(config.encoder_settings.payload_type, 0); 172 RTC_DCHECK_GE(config.encoder_settings.payload_type, 0);
172 RTC_DCHECK_LE(config.encoder_settings.payload_type, 127); 173 RTC_DCHECK_LE(config.encoder_settings.payload_type, 127);
173 RTC_CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder( 174 RTC_CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder(
174 config.encoder_settings.encoder, 175 config.encoder_settings.encoder,
175 config.encoder_settings.payload_type, 176 config.encoder_settings.payload_type,
176 config.encoder_settings.internal_source)); 177 config.encoder_settings.internal_source));
177 178
178 RTC_CHECK(ReconfigureVideoEncoder(encoder_config)); 179 RTC_CHECK(ReconfigureVideoEncoder(encoder_config));
179 180
180 vie_channel_->RegisterSendSideDelayObserver(&stats_proxy_); 181 vie_channel_->RegisterSendSideDelayObserver(&stats_proxy_);
181 vie_encoder_->RegisterSendStatisticsProxy(&stats_proxy_);
182 182
183 vie_encoder_->RegisterPreEncodeCallback(config_.pre_encode_callback);
184 if (config_.post_encode_callback) 183 if (config_.post_encode_callback)
185 vie_encoder_->RegisterPostEncodeImageCallback(&encoded_frame_proxy_); 184 vie_encoder_->RegisterPostEncodeImageCallback(&encoded_frame_proxy_);
186 185
187 if (config_.suspend_below_min_bitrate) { 186 if (config_.suspend_below_min_bitrate) {
188 vie_encoder_->SuspendBelowMinBitrate(); 187 vie_encoder_->SuspendBelowMinBitrate();
189 // Must enable pacing when enabling SuspendBelowMinBitrate. Otherwise, no 188 // Must enable pacing when enabling SuspendBelowMinBitrate. Otherwise, no
190 // padding will be sent when the video is suspended so the video will be 189 // padding will be sent when the video is suspended so the video will be
191 // unable to recover. 190 // unable to recover.
192 // TODO(pbos): Pacing should probably be enabled outside of VideoSendStream. 191 // TODO(pbos): Pacing should probably be enabled outside of VideoSendStream.
193 vie_channel_->SetTransmissionSmoothingStatus(true); 192 vie_channel_->SetTransmissionSmoothingStatus(true);
194 } 193 }
195 194
196 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_); 195 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_);
197 vie_channel_->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_); 196 vie_channel_->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_);
198 vie_channel_->RegisterRtcpPacketTypeCounterObserver(&stats_proxy_); 197 vie_channel_->RegisterRtcpPacketTypeCounterObserver(&stats_proxy_);
199 vie_channel_->RegisterSendBitrateObserver(&stats_proxy_); 198 vie_channel_->RegisterSendBitrateObserver(&stats_proxy_);
200 vie_channel_->RegisterSendFrameCountObserver(&stats_proxy_); 199 vie_channel_->RegisterSendFrameCountObserver(&stats_proxy_);
201
202 vie_encoder_->RegisterCodecObserver(&stats_proxy_);
203 } 200 }
204 201
205 VideoSendStream::~VideoSendStream() { 202 VideoSendStream::~VideoSendStream() {
206 vie_encoder_->RegisterCodecObserver(nullptr);
207
208 vie_channel_->RegisterSendFrameCountObserver(nullptr); 203 vie_channel_->RegisterSendFrameCountObserver(nullptr);
209 vie_channel_->RegisterSendBitrateObserver(nullptr); 204 vie_channel_->RegisterSendBitrateObserver(nullptr);
210 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr); 205 vie_channel_->RegisterRtcpPacketTypeCounterObserver(nullptr);
211 vie_channel_->RegisterSendChannelRtpStatisticsCallback(nullptr); 206 vie_channel_->RegisterSendChannelRtpStatisticsCallback(nullptr);
212 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(nullptr); 207 vie_channel_->RegisterSendChannelRtcpStatisticsCallback(nullptr);
213 208
214 vie_encoder_->RegisterPreEncodeCallback(nullptr);
215 vie_encoder_->RegisterPostEncodeImageCallback(nullptr);
216
217 // Remove capture input (thread) so that it's not running after the current 209 // Remove capture input (thread) so that it's not running after the current
218 // channel is deleted. 210 // channel is deleted.
219 input_.reset(); 211 input_.reset();
220 212
221 vie_encoder_->DeRegisterExternalEncoder( 213 vie_encoder_->DeRegisterExternalEncoder(
222 config_.encoder_settings.payload_type); 214 config_.encoder_settings.payload_type);
223 215
224 channel_group_->DeleteChannel(channel_id_); 216 channel_group_->DeleteChannel(channel_id_);
225 } 217 }
226 218
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 vie_channel_->IsSendingFecEnabled()); 502 vie_channel_->IsSendingFecEnabled());
511 503
512 // Restart the media flow 504 // Restart the media flow
513 vie_encoder_->Restart(); 505 vie_encoder_->Restart();
514 506
515 return true; 507 return true;
516 } 508 }
517 509
518 } // namespace internal 510 } // namespace internal
519 } // namespace webrtc 511 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy_unittest.cc ('k') | webrtc/video_engine/encoder_state_feedback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698