| 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 22 matching lines...) Expand all Loading... |
| 33 #include "webrtc/base/bind.h" | 33 #include "webrtc/base/bind.h" |
| 34 #include "webrtc/base/buffer.h" | 34 #include "webrtc/base/buffer.h" |
| 35 #include "webrtc/base/byteorder.h" | 35 #include "webrtc/base/byteorder.h" |
| 36 #include "webrtc/base/common.h" | 36 #include "webrtc/base/common.h" |
| 37 #include "webrtc/base/dscp.h" | 37 #include "webrtc/base/dscp.h" |
| 38 #include "webrtc/base/logging.h" | 38 #include "webrtc/base/logging.h" |
| 39 #include "webrtc/base/trace_event.h" | 39 #include "webrtc/base/trace_event.h" |
| 40 #include "webrtc/p2p/base/transportchannel.h" | 40 #include "webrtc/p2p/base/transportchannel.h" |
| 41 | 41 |
| 42 namespace cricket { | 42 namespace cricket { |
| 43 using rtc::Bind; |
| 43 | 44 |
| 44 using rtc::Bind; | 45 namespace { |
| 46 // See comment below for why we need to use a pointer to a scoped_ptr. |
| 47 bool SetRawAudioSink_w(VoiceMediaChannel* channel, |
| 48 uint32_t ssrc, |
| 49 rtc::scoped_ptr<webrtc::AudioSinkInterface>* sink) { |
| 50 channel->SetRawAudioSink(ssrc, std::move(*sink)); |
| 51 return true; |
| 52 } |
| 53 } // namespace |
| 45 | 54 |
| 46 enum { | 55 enum { |
| 47 MSG_EARLYMEDIATIMEOUT = 1, | 56 MSG_EARLYMEDIATIMEOUT = 1, |
| 48 MSG_SCREENCASTWINDOWEVENT, | 57 MSG_SCREENCASTWINDOWEVENT, |
| 49 MSG_RTPPACKET, | 58 MSG_RTPPACKET, |
| 50 MSG_RTCPPACKET, | 59 MSG_RTCPPACKET, |
| 51 MSG_CHANNEL_ERROR, | 60 MSG_CHANNEL_ERROR, |
| 52 MSG_READYTOSENDDATA, | 61 MSG_READYTOSENDDATA, |
| 53 MSG_DATARECEIVED, | 62 MSG_DATARECEIVED, |
| 54 MSG_FIRSTPACKETRECEIVED, | 63 MSG_FIRSTPACKETRECEIVED, |
| (...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 int duration) { | 1378 int duration) { |
| 1370 return InvokeOnWorker(Bind(&VoiceChannel::InsertDtmf_w, this, | 1379 return InvokeOnWorker(Bind(&VoiceChannel::InsertDtmf_w, this, |
| 1371 ssrc, event_code, duration)); | 1380 ssrc, event_code, duration)); |
| 1372 } | 1381 } |
| 1373 | 1382 |
| 1374 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 1383 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
| 1375 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, | 1384 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, |
| 1376 media_channel(), ssrc, volume)); | 1385 media_channel(), ssrc, volume)); |
| 1377 } | 1386 } |
| 1378 | 1387 |
| 1388 void VoiceChannel::SetRawAudioSink( |
| 1389 uint32_t ssrc, |
| 1390 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { |
| 1391 // We need to work around Bind's lack of support for scoped_ptr and ownership |
| 1392 // passing. So we invoke to our own little routine that gets a pointer to |
| 1393 // our local variable. This is OK since we're synchronously invoking. |
| 1394 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
| 1395 } |
| 1396 |
| 1379 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1397 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
| 1380 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, | 1398 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, |
| 1381 media_channel(), stats)); | 1399 media_channel(), stats)); |
| 1382 } | 1400 } |
| 1383 | 1401 |
| 1384 void VoiceChannel::StartMediaMonitor(int cms) { | 1402 void VoiceChannel::StartMediaMonitor(int cms) { |
| 1385 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1403 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
| 1386 rtc::Thread::Current())); | 1404 rtc::Thread::Current())); |
| 1387 media_monitor_->SignalUpdate.connect( | 1405 media_monitor_->SignalUpdate.connect( |
| 1388 this, &VoiceChannel::OnMediaMonitorUpdate); | 1406 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(); | 2332 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
| 2315 } | 2333 } |
| 2316 | 2334 |
| 2317 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2335 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
| 2318 rtc::TypedMessageData<uint32_t>* message = | 2336 rtc::TypedMessageData<uint32_t>* message = |
| 2319 new rtc::TypedMessageData<uint32_t>(sid); | 2337 new rtc::TypedMessageData<uint32_t>(sid); |
| 2320 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2338 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
| 2321 } | 2339 } |
| 2322 | 2340 |
| 2323 } // namespace cricket | 2341 } // namespace cricket |
| OLD | NEW |