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

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: Fixing comments and other minor things Created 4 years, 7 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 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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 1229
1230 bool WebRtcSession::SetAudioRtpParameters(uint32_t ssrc, 1230 bool WebRtcSession::SetAudioRtpParameters(uint32_t ssrc,
1231 const RtpParameters& parameters) { 1231 const RtpParameters& parameters) {
1232 ASSERT(signaling_thread()->IsCurrent()); 1232 ASSERT(signaling_thread()->IsCurrent());
1233 if (!voice_channel_) { 1233 if (!voice_channel_) {
1234 return false; 1234 return false;
1235 } 1235 }
1236 return voice_channel_->SetRtpParameters(ssrc, parameters); 1236 return voice_channel_->SetRtpParameters(ssrc, parameters);
1237 } 1237 }
1238 1238
1239 bool WebRtcSession::SetSource(
1240 uint32_t ssrc,
1241 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1242 ASSERT(signaling_thread()->IsCurrent());
1243
1244 if (!video_channel_) {
1245 // |video_channel_| doesnt't exist. Probably because the remote end doesnt't
1246 // support video.
1247 LOG(LS_WARNING) << "Video not used in this call.";
1248 return false;
1249 }
1250 video_channel_->SetSource(ssrc, source);
1251 return true;
1252 }
1253
1254 void WebRtcSession::SetVideoPlayout( 1239 void WebRtcSession::SetVideoPlayout(
1255 uint32_t ssrc, 1240 uint32_t ssrc,
1256 bool enable, 1241 bool enable,
1257 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { 1242 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
1258 ASSERT(signaling_thread()->IsCurrent()); 1243 ASSERT(signaling_thread()->IsCurrent());
1259 if (!video_channel_) { 1244 if (!video_channel_) {
1260 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists."; 1245 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists.";
1261 return; 1246 return;
1262 } 1247 }
1263 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) { 1248 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) {
1264 // Allow that SetSink fail if |sink| is NULL but assert otherwise. 1249 // Allow that SetSink fail if |sink| is NULL but assert otherwise.
1265 // This in the normal case when the underlying media channel has already 1250 // This in the normal case when the underlying media channel has already
1266 // been deleted. 1251 // been deleted.
1267 ASSERT(sink == NULL); 1252 ASSERT(sink == NULL);
1268 } 1253 }
1269 } 1254 }
1270 1255
1271 void WebRtcSession::SetVideoSend(uint32_t ssrc, 1256 void WebRtcSession::SetVideoSend(
1272 bool enable, 1257 uint32_t ssrc,
1273 const cricket::VideoOptions* options) { 1258 bool enable,
1259 const cricket::VideoOptions* options,
1260 rtc::VideoSourceInterface<cricket::VideoFrame>* source) {
1274 ASSERT(signaling_thread()->IsCurrent()); 1261 ASSERT(signaling_thread()->IsCurrent());
1275 if (!video_channel_) { 1262 if (!video_channel_) {
1276 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; 1263 LOG(LS_WARNING) << "SetVideoSend: No video channel exists.";
1277 return; 1264 return;
1278 } 1265 }
1279 if (!video_channel_->SetVideoSend(ssrc, enable, options)) { 1266 if (!video_channel_->SetVideoSend(ssrc, enable, options, source)) {
1280 // Allow that MuteStream fail if |enable| is false but assert otherwise. 1267 // Allow that MuteStream fail if |enable| is false and |source| is NULL but
1281 // This in the normal case when the underlying media channel has already 1268 // assert otherwise. This in the normal case when the underlying media
1282 // been deleted. 1269 // channel has already been deleted.
1283 ASSERT(enable == false); 1270 ASSERT(enable == false && source == nullptr);
1284 } 1271 }
1285 } 1272 }
1286 1273
1287 RtpParameters WebRtcSession::GetVideoRtpParameters(uint32_t ssrc) const { 1274 RtpParameters WebRtcSession::GetVideoRtpParameters(uint32_t ssrc) const {
1288 ASSERT(signaling_thread()->IsCurrent()); 1275 ASSERT(signaling_thread()->IsCurrent());
1289 if (video_channel_) { 1276 if (video_channel_) {
1290 return video_channel_->GetRtpParameters(ssrc); 1277 return video_channel_->GetRtpParameters(ssrc);
1291 } 1278 }
1292 return RtpParameters(); 1279 return RtpParameters();
1293 } 1280 }
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 ssl_cipher_suite); 2115 ssl_cipher_suite);
2129 } 2116 }
2130 } 2117 }
2131 2118
2132 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) { 2119 void WebRtcSession::OnSentPacket_w(const rtc::SentPacket& sent_packet) {
2133 RTC_DCHECK(worker_thread()->IsCurrent()); 2120 RTC_DCHECK(worker_thread()->IsCurrent());
2134 media_controller_->call_w()->OnSentPacket(sent_packet); 2121 media_controller_->call_w()->OnSentPacket(sent_packet);
2135 } 2122 }
2136 2123
2137 } // namespace webrtc 2124 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698