Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/session/media/channel.h" | 28 #include "talk/session/media/channel.h" |
| 29 | 29 |
| 30 #include "talk/media/base/constants.h" | 30 #include "talk/media/base/constants.h" |
| 31 #include "talk/media/base/rtputils.h" | 31 #include "talk/media/base/rtputils.h" |
| 32 #include "talk/session/media/channelmanager.h" | 32 #include "talk/session/media/channelmanager.h" |
| 33 #include "webrtc/audio/audio_sink.h" | |
| 33 #include "webrtc/base/bind.h" | 34 #include "webrtc/base/bind.h" |
| 34 #include "webrtc/base/buffer.h" | 35 #include "webrtc/base/buffer.h" |
| 35 #include "webrtc/base/byteorder.h" | 36 #include "webrtc/base/byteorder.h" |
| 36 #include "webrtc/base/common.h" | 37 #include "webrtc/base/common.h" |
| 37 #include "webrtc/base/dscp.h" | 38 #include "webrtc/base/dscp.h" |
| 38 #include "webrtc/base/logging.h" | 39 #include "webrtc/base/logging.h" |
| 39 #include "webrtc/base/trace_event.h" | 40 #include "webrtc/base/trace_event.h" |
| 40 #include "webrtc/p2p/base/transportchannel.h" | 41 #include "webrtc/p2p/base/transportchannel.h" |
| 41 | 42 |
| 42 namespace cricket { | 43 namespace cricket { |
| 44 using rtc::Bind; | |
| 43 | 45 |
| 44 using rtc::Bind; | 46 namespace { |
| 47 // See comment below for why we need to use a pointer to a scoped_ptr. | |
| 48 bool SetRawAudioSink_w(VoiceMediaChannel* channel, | |
|
perkj_webrtc
2015/12/13 19:26:48
nit: Since this file contain implementation for au
tommi
2015/12/13 19:46:34
As is it's not a member function, so I figured I w
| |
| 49 uint32_t ssrc, | |
| 50 rtc::scoped_ptr<webrtc::AudioSinkInterface>* sink) { | |
| 51 channel->SetRawAudioSink(ssrc, std::move(*sink)); | |
| 52 return true; | |
| 53 } | |
| 54 } // namespace | |
| 45 | 55 |
| 46 enum { | 56 enum { |
| 47 MSG_EARLYMEDIATIMEOUT = 1, | 57 MSG_EARLYMEDIATIMEOUT = 1, |
| 48 MSG_SCREENCASTWINDOWEVENT, | 58 MSG_SCREENCASTWINDOWEVENT, |
| 49 MSG_RTPPACKET, | 59 MSG_RTPPACKET, |
| 50 MSG_RTCPPACKET, | 60 MSG_RTCPPACKET, |
| 51 MSG_CHANNEL_ERROR, | 61 MSG_CHANNEL_ERROR, |
| 52 MSG_READYTOSENDDATA, | 62 MSG_READYTOSENDDATA, |
| 53 MSG_DATARECEIVED, | 63 MSG_DATARECEIVED, |
| 54 MSG_FIRSTPACKETRECEIVED, | 64 MSG_FIRSTPACKETRECEIVED, |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1369 int duration) { | 1379 int duration) { |
| 1370 return InvokeOnWorker(Bind(&VoiceChannel::InsertDtmf_w, this, | 1380 return InvokeOnWorker(Bind(&VoiceChannel::InsertDtmf_w, this, |
| 1371 ssrc, event_code, duration)); | 1381 ssrc, event_code, duration)); |
| 1372 } | 1382 } |
| 1373 | 1383 |
| 1374 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 1384 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
| 1375 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, | 1385 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, |
| 1376 media_channel(), ssrc, volume)); | 1386 media_channel(), ssrc, volume)); |
| 1377 } | 1387 } |
| 1378 | 1388 |
| 1389 void VoiceChannel::SetRawAudioSink( | |
| 1390 uint32_t ssrc, | |
| 1391 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { | |
| 1392 // We need to work around Bind's lack of support for scoped_ptr and ownership | |
| 1393 // passing. So we invoke to our own little routine that gets a pointer to | |
| 1394 // our local variable. This is OK since we're synchronously invoking. | |
| 1395 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); | |
| 1396 } | |
| 1397 | |
| 1379 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1398 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
| 1380 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, | 1399 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, |
| 1381 media_channel(), stats)); | 1400 media_channel(), stats)); |
| 1382 } | 1401 } |
| 1383 | 1402 |
| 1384 void VoiceChannel::StartMediaMonitor(int cms) { | 1403 void VoiceChannel::StartMediaMonitor(int cms) { |
| 1385 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1404 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
| 1386 rtc::Thread::Current())); | 1405 rtc::Thread::Current())); |
| 1387 media_monitor_->SignalUpdate.connect( | 1406 media_monitor_->SignalUpdate.connect( |
| 1388 this, &VoiceChannel::OnMediaMonitorUpdate); | 1407 this, &VoiceChannel::OnMediaMonitorUpdate); |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2314 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2333 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
| 2315 } | 2334 } |
| 2316 | 2335 |
| 2317 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2336 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
| 2318 rtc::TypedMessageData<uint32_t>* message = | 2337 rtc::TypedMessageData<uint32_t>* message = |
| 2319 new rtc::TypedMessageData<uint32_t>(sid); | 2338 new rtc::TypedMessageData<uint32_t>(sid); |
| 2320 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2339 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2321 } | 2340 } |
| 2322 | 2341 |
| 2323 } // namespace cricket | 2342 } // namespace cricket |
| OLD | NEW |