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

Side by Side Diff: webrtc/api/webrtcsession.cc

Issue 1838413002: Combining SetVideoSend and SetSource into one method. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding TODO. Created 4 years, 6 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/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 bool WebRtcSession::SetAudioRtpReceiveParameters( 1247 bool WebRtcSession::SetAudioRtpReceiveParameters(
1248 uint32_t ssrc, 1248 uint32_t ssrc,
1249 const RtpParameters& parameters) { 1249 const RtpParameters& parameters) {
1250 ASSERT(signaling_thread()->IsCurrent()); 1250 ASSERT(signaling_thread()->IsCurrent());
1251 if (!voice_channel_) { 1251 if (!voice_channel_) {
1252 return false; 1252 return false;
1253 } 1253 }
1254 return voice_channel_->SetRtpReceiveParameters(ssrc, parameters); 1254 return voice_channel_->SetRtpReceiveParameters(ssrc, parameters);
1255 } 1255 }
1256 1256
1257 bool WebRtcSession::SetSource(
1258 uint32_t ssrc,
1259 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1260 ASSERT(signaling_thread()->IsCurrent());
1261
1262 if (!video_channel_) {
1263 // |video_channel_| doesnt't exist. Probably because the remote end doesnt't
1264 // support video.
1265 LOG(LS_WARNING) << "Video not used in this call.";
1266 return false;
1267 }
1268 video_channel_->SetSource(ssrc, source);
1269 return true;
1270 }
1271
1272 void WebRtcSession::SetVideoPlayout( 1257 void WebRtcSession::SetVideoPlayout(
1273 uint32_t ssrc, 1258 uint32_t ssrc,
1274 bool enable, 1259 bool enable,
1275 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { 1260 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
1276 ASSERT(signaling_thread()->IsCurrent()); 1261 ASSERT(signaling_thread()->IsCurrent());
1277 if (!video_channel_) { 1262 if (!video_channel_) {
1278 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists."; 1263 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists.";
1279 return; 1264 return;
1280 } 1265 }
1281 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) { 1266 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) {
1282 // Allow that SetSink fail if |sink| is NULL but assert otherwise. 1267 // Allow that SetSink fail if |sink| is NULL but assert otherwise.
1283 // This in the normal case when the underlying media channel has already 1268 // This in the normal case when the underlying media channel has already
1284 // been deleted. 1269 // been deleted.
1285 ASSERT(sink == NULL); 1270 ASSERT(sink == NULL);
1286 } 1271 }
1287 } 1272 }
1288 1273
1289 void WebRtcSession::SetVideoSend(uint32_t ssrc, 1274 void WebRtcSession::SetVideoSend(
1290 bool enable, 1275 uint32_t ssrc,
1291 const cricket::VideoOptions* options) { 1276 bool enable,
1277 const cricket::VideoOptions* options,
1278 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1292 ASSERT(signaling_thread()->IsCurrent()); 1279 ASSERT(signaling_thread()->IsCurrent());
1293 if (!video_channel_) { 1280 if (!video_channel_) {
1294 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; 1281 LOG(LS_WARNING) << "SetVideoSend: No video channel exists.";
1295 return; 1282 return;
1296 } 1283 }
1297 if (!video_channel_->SetVideoSend(ssrc, enable, options)) { 1284 if (!video_channel_->SetVideoSend(ssrc, enable, options, source)) {
1298 // Allow that MuteStream fail if |enable| is false but assert otherwise. 1285 // Allow that MuteStream fail if |enable| is false and |source| is NULL but
1299 // This in the normal case when the underlying media channel has already 1286 // assert otherwise. This in the normal case when the underlying media
1300 // been deleted. 1287 // channel has already been deleted.
1301 ASSERT(enable == false); 1288 ASSERT(enable == false && source == nullptr);
1302 } 1289 }
1303 } 1290 }
1304 1291
1305 RtpParameters WebRtcSession::GetVideoRtpSendParameters(uint32_t ssrc) const { 1292 RtpParameters WebRtcSession::GetVideoRtpSendParameters(uint32_t ssrc) const {
1306 ASSERT(signaling_thread()->IsCurrent()); 1293 ASSERT(signaling_thread()->IsCurrent());
1307 if (video_channel_) { 1294 if (video_channel_) {
1308 return video_channel_->GetRtpSendParameters(ssrc); 1295 return video_channel_->GetRtpSendParameters(ssrc);
1309 } 1296 }
1310 return RtpParameters(); 1297 return RtpParameters();
1311 } 1298 }
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 ssl_cipher_suite); 2142 ssl_cipher_suite);
2156 } 2143 }
2157 } 2144 }
2158 2145
2159 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { 2146 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
2160 RTC_DCHECK(worker_thread()->IsCurrent()); 2147 RTC_DCHECK(worker_thread()->IsCurrent());
2161 media_controller_->call_w()->OnSentPacket(sent_packet); 2148 media_controller_->call_w()->OnSentPacket(sent_packet);
2162 } 2149 }
2163 2150
2164 } // namespace webrtc 2151 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/webrtcsession.h ('k') | webrtc/api/webrtcsession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698