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

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

Issue 1325263002: Make LoadObserver settable per video send stream. Gives client flexibility and makes the implementa… (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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 ss << ", render_delay_ms: " << render_delay_ms; 94 ss << ", render_delay_ms: " << render_delay_ms;
95 ss << ", target_delay_ms: " << target_delay_ms; 95 ss << ", target_delay_ms: " << target_delay_ms;
96 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on" 96 ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on"
97 : "off"); 97 : "off");
98 ss << '}'; 98 ss << '}';
99 return ss.str(); 99 return ss.str();
100 } 100 }
101 101
102 namespace internal { 102 namespace internal {
103 VideoSendStream::VideoSendStream( 103 VideoSendStream::VideoSendStream(
104 CpuOveruseObserver* overuse_observer,
105 int num_cpu_cores, 104 int num_cpu_cores,
106 ProcessThread* module_process_thread, 105 ProcessThread* module_process_thread,
107 ChannelGroup* channel_group, 106 ChannelGroup* channel_group,
108 int channel_id, 107 int channel_id,
109 const VideoSendStream::Config& config, 108 const VideoSendStream::Config& config,
110 const VideoEncoderConfig& encoder_config, 109 const VideoEncoderConfig& encoder_config,
111 const std::map<uint32_t, RtpState>& suspended_ssrcs) 110 const std::map<uint32_t, RtpState>& suspended_ssrcs)
112 : transport_adapter_(config.send_transport), 111 : transport_adapter_(config.send_transport),
113 encoded_frame_proxy_(config.post_encode_callback), 112 encoded_frame_proxy_(config.post_encode_callback),
114 config_(config), 113 config_(config),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 config_.rtp.fec.ulpfec_payload_type); 154 config_.rtp.fec.ulpfec_payload_type);
156 vie_encoder_->UpdateProtectionMethod(enable_protection_nack, 155 vie_encoder_->UpdateProtectionMethod(enable_protection_nack,
157 enable_protection_fec); 156 enable_protection_fec);
158 157
159 ConfigureSsrcs(); 158 ConfigureSsrcs();
160 159
161 vie_channel_->SetRTCPCName(config_.rtp.c_name.c_str()); 160 vie_channel_->SetRTCPCName(config_.rtp.c_name.c_str());
162 161
163 input_.reset(new internal::VideoCaptureInput( 162 input_.reset(new internal::VideoCaptureInput(
164 module_process_thread_, vie_encoder_, config_.local_renderer, 163 module_process_thread_, vie_encoder_, config_.local_renderer,
165 &stats_proxy_, overuse_observer)); 164 &stats_proxy_, this));
166 165
167 // 28 to match packet overhead in ModuleRtpRtcpImpl. 166 // 28 to match packet overhead in ModuleRtpRtcpImpl.
168 DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28)); 167 DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28));
169 vie_channel_->SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28)); 168 vie_channel_->SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28));
170 169
171 DCHECK(config.encoder_settings.encoder != nullptr); 170 DCHECK(config.encoder_settings.encoder != nullptr);
172 DCHECK_GE(config.encoder_settings.payload_type, 0); 171 DCHECK_GE(config.encoder_settings.payload_type, 0);
173 DCHECK_LE(config.encoder_settings.payload_type, 127); 172 DCHECK_LE(config.encoder_settings.payload_type, 127);
174 // TODO(pbos): Wire up codec internal-source setting or remove setting. 173 // TODO(pbos): Wire up codec internal-source setting or remove setting.
175 CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder( 174 CHECK_EQ(0, vie_encoder_->RegisterExternalEncoder(
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 382 }
384 383
385 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { 384 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
386 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0; 385 return vie_channel_->ReceivedRTCPPacket(packet, length) == 0;
387 } 386 }
388 387
389 VideoSendStream::Stats VideoSendStream::GetStats() { 388 VideoSendStream::Stats VideoSendStream::GetStats() {
390 return stats_proxy_.GetStats(); 389 return stats_proxy_.GetStats();
391 } 390 }
392 391
392 void VideoSendStream::OveruseDetected() {
393 if (config_.overuse_callback) {
pbos-webrtc 2015/09/03 20:44:55 Remove {}s for consistency outside of talk/.
the sun 2015/09/03 20:54:55 lol
pthatcher1 2015/09/04 04:56:03 Please keep {}s to be consistent with code inside
394 config_.overuse_callback->OnLoadUpdate(LoadObserver::kOveruse);
395 }
396 }
397
398 void VideoSendStream::NormalUsage() {
399 if (config_.overuse_callback) {
pbos-webrtc 2015/09/03 20:44:55 Remove {}s for consistency outside of talk/.
the sun 2015/09/03 20:54:55 lol
pthatcher1 2015/09/04 04:56:03 Please keep {}s to be consistent with code inside
400 config_.overuse_callback->OnLoadUpdate(LoadObserver::kUnderuse);
401 }
402 }
403
393 void VideoSendStream::ConfigureSsrcs() { 404 void VideoSendStream::ConfigureSsrcs() {
394 vie_channel_->SetSSRC(config_.rtp.ssrcs.front(), kViEStreamTypeNormal, 0); 405 vie_channel_->SetSSRC(config_.rtp.ssrcs.front(), kViEStreamTypeNormal, 0);
395 for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) { 406 for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) {
396 uint32_t ssrc = config_.rtp.ssrcs[i]; 407 uint32_t ssrc = config_.rtp.ssrcs[i];
397 vie_channel_->SetSSRC(ssrc, kViEStreamTypeNormal, 408 vie_channel_->SetSSRC(ssrc, kViEStreamTypeNormal,
398 static_cast<unsigned char>(i)); 409 static_cast<unsigned char>(i));
399 RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc); 410 RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc);
400 if (it != suspended_ssrcs_.end()) 411 if (it != suspended_ssrcs_.end())
401 vie_channel_->SetRtpStateForSsrc(ssrc, it->second); 412 vie_channel_->SetRtpStateForSsrc(ssrc, it->second);
402 } 413 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 vie_channel_->IsSendingFecEnabled()); 512 vie_channel_->IsSendingFecEnabled());
502 513
503 // Restart the media flow 514 // Restart the media flow
504 vie_encoder_->Restart(); 515 vie_encoder_->Restart();
505 516
506 return true; 517 return true;
507 } 518 }
508 519
509 } // namespace internal 520 } // namespace internal
510 } // namespace webrtc 521 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698