| OLD | NEW |
| 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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 | 1254 |
| 1255 bool WebRtcSession::SetAudioRtpParameters(uint32_t ssrc, | 1255 bool WebRtcSession::SetAudioRtpParameters(uint32_t ssrc, |
| 1256 const RtpParameters& parameters) { | 1256 const RtpParameters& parameters) { |
| 1257 ASSERT(signaling_thread()->IsCurrent()); | 1257 ASSERT(signaling_thread()->IsCurrent()); |
| 1258 if (!voice_channel_) { | 1258 if (!voice_channel_) { |
| 1259 return false; | 1259 return false; |
| 1260 } | 1260 } |
| 1261 return voice_channel_->SetRtpParameters(ssrc, parameters); | 1261 return voice_channel_->SetRtpParameters(ssrc, parameters); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 bool WebRtcSession::SetCaptureDevice(uint32_t ssrc, | |
| 1265 cricket::VideoCapturer* camera) { | |
| 1266 ASSERT(signaling_thread()->IsCurrent()); | |
| 1267 | |
| 1268 if (!video_channel_) { | |
| 1269 // |video_channel_| doesnt't exist. Probably because the remote end doesnt't | |
| 1270 // support video. | |
| 1271 LOG(LS_WARNING) << "Video not used in this call."; | |
| 1272 return false; | |
| 1273 } | |
| 1274 if (!video_channel_->SetCapturer(ssrc, camera)) { | |
| 1275 // Allow that SetCapturer fail if |camera| is NULL but assert otherwise. | |
| 1276 // This in the normal case when the underlying media channel has already | |
| 1277 // been deleted. | |
| 1278 ASSERT(camera == NULL); | |
| 1279 return false; | |
| 1280 } | |
| 1281 return true; | |
| 1282 } | |
| 1283 | |
| 1284 void WebRtcSession::SetVideoPlayout( | 1264 void WebRtcSession::SetVideoPlayout( |
| 1285 uint32_t ssrc, | 1265 uint32_t ssrc, |
| 1286 bool enable, | 1266 bool enable, |
| 1287 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | 1267 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { |
| 1288 ASSERT(signaling_thread()->IsCurrent()); | 1268 ASSERT(signaling_thread()->IsCurrent()); |
| 1289 if (!video_channel_) { | 1269 if (!video_channel_) { |
| 1290 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists."; | 1270 LOG(LS_WARNING) << "SetVideoPlayout: No video channel exists."; |
| 1291 return; | 1271 return; |
| 1292 } | 1272 } |
| 1293 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) { | 1273 if (!video_channel_->SetSink(ssrc, enable ? sink : NULL)) { |
| 1294 // Allow that SetSink fail if |sink| is NULL but assert otherwise. | 1274 // Allow that SetSink fail if |sink| is NULL but assert otherwise. |
| 1295 // This in the normal case when the underlying media channel has already | 1275 // This in the normal case when the underlying media channel has already |
| 1296 // been deleted. | 1276 // been deleted. |
| 1297 ASSERT(sink == NULL); | 1277 ASSERT(sink == NULL); |
| 1298 } | 1278 } |
| 1299 } | 1279 } |
| 1300 | 1280 |
| 1301 void WebRtcSession::SetVideoSend(uint32_t ssrc, | 1281 void WebRtcSession::SetVideoSend(uint32_t ssrc, |
| 1302 bool enable, | 1282 bool enable, |
| 1303 const cricket::VideoOptions* options) { | 1283 const cricket::VideoOptions* options, |
| 1284 cricket::VideoCapturer* camera) { |
| 1304 ASSERT(signaling_thread()->IsCurrent()); | 1285 ASSERT(signaling_thread()->IsCurrent()); |
| 1305 if (!video_channel_) { | 1286 if (!video_channel_) { |
| 1306 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; | 1287 LOG(LS_WARNING) << "SetVideoSend: No video channel exists."; |
| 1307 return; | 1288 return; |
| 1308 } | 1289 } |
| 1309 if (!video_channel_->SetVideoSend(ssrc, enable, options)) { | 1290 if (!video_channel_->SetVideoSend(ssrc, enable, options, camera)) { |
| 1310 // Allow that MuteStream fail if |enable| is false but assert otherwise. | 1291 // Allow that MuteStream fail if |enable| is false and |camera| is NULL but |
| 1311 // This in the normal case when the underlying media channel has already | 1292 // assert otherwise. This in the normal case when the underlying media |
| 1312 // been deleted. | 1293 // channel has already been deleted. |
| 1313 ASSERT(enable == false); | 1294 ASSERT(enable == false && camera == nullptr); |
| 1314 } | 1295 } |
| 1315 } | 1296 } |
| 1316 | 1297 |
| 1317 RtpParameters WebRtcSession::GetVideoRtpParameters(uint32_t ssrc) const { | 1298 RtpParameters WebRtcSession::GetVideoRtpParameters(uint32_t ssrc) const { |
| 1318 ASSERT(signaling_thread()->IsCurrent()); | 1299 ASSERT(signaling_thread()->IsCurrent()); |
| 1319 if (video_channel_) { | 1300 if (video_channel_) { |
| 1320 return video_channel_->GetRtpParameters(ssrc); | 1301 return video_channel_->GetRtpParameters(ssrc); |
| 1321 } | 1302 } |
| 1322 return RtpParameters(); | 1303 return RtpParameters(); |
| 1323 } | 1304 } |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 } | 2141 } |
| 2161 } | 2142 } |
| 2162 | 2143 |
| 2163 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, | 2144 void WebRtcSession::OnSentPacket_w(cricket::TransportChannel* channel, |
| 2164 const rtc::SentPacket& sent_packet) { | 2145 const rtc::SentPacket& sent_packet) { |
| 2165 RTC_DCHECK(worker_thread()->IsCurrent()); | 2146 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 2166 media_controller_->call_w()->OnSentPacket(sent_packet); | 2147 media_controller_->call_w()->OnSentPacket(sent_packet); |
| 2167 } | 2148 } |
| 2168 | 2149 |
| 2169 } // namespace webrtc | 2150 } // namespace webrtc |
| OLD | NEW |