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 27 matching lines...) Expand all Loading... |
38 #include "webrtc/base/byteorder.h" | 38 #include "webrtc/base/byteorder.h" |
39 #include "webrtc/base/common.h" | 39 #include "webrtc/base/common.h" |
40 #include "webrtc/base/dscp.h" | 40 #include "webrtc/base/dscp.h" |
41 #include "webrtc/base/logging.h" | 41 #include "webrtc/base/logging.h" |
42 #include "webrtc/base/trace_event.h" | 42 #include "webrtc/base/trace_event.h" |
43 #include "webrtc/p2p/base/transportchannel.h" | 43 #include "webrtc/p2p/base/transportchannel.h" |
44 | 44 |
45 namespace cricket { | 45 namespace cricket { |
46 using rtc::Bind; | 46 using rtc::Bind; |
47 | 47 |
| 48 namespace { |
| 49 // See comment below for why we need to use a pointer to a scoped_ptr. |
| 50 bool SetRawAudioSink_w(VoiceMediaChannel* channel, |
| 51 uint32_t ssrc, |
| 52 rtc::scoped_ptr<webrtc::AudioSinkInterface>* sink) { |
| 53 channel->SetRawAudioSink(ssrc, std::move(*sink)); |
| 54 return true; |
| 55 } |
| 56 } // namespace |
| 57 |
48 enum { | 58 enum { |
49 MSG_EARLYMEDIATIMEOUT = 1, | 59 MSG_EARLYMEDIATIMEOUT = 1, |
50 MSG_SCREENCASTWINDOWEVENT, | 60 MSG_SCREENCASTWINDOWEVENT, |
51 MSG_RTPPACKET, | 61 MSG_RTPPACKET, |
52 MSG_RTCPPACKET, | 62 MSG_RTCPPACKET, |
53 MSG_CHANNEL_ERROR, | 63 MSG_CHANNEL_ERROR, |
54 MSG_READYTOSENDDATA, | 64 MSG_READYTOSENDDATA, |
55 MSG_DATARECEIVED, | 65 MSG_DATARECEIVED, |
56 MSG_FIRSTPACKETRECEIVED, | 66 MSG_FIRSTPACKETRECEIVED, |
57 MSG_STREAMCLOSEDREMOTELY, | 67 MSG_STREAMCLOSEDREMOTELY, |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 ssrc, event_code, duration)); | 1392 ssrc, event_code, duration)); |
1383 } | 1393 } |
1384 | 1394 |
1385 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 1395 bool VoiceChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
1386 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, | 1396 return InvokeOnWorker(Bind(&VoiceMediaChannel::SetOutputVolume, |
1387 media_channel(), ssrc, volume)); | 1397 media_channel(), ssrc, volume)); |
1388 } | 1398 } |
1389 | 1399 |
1390 void VoiceChannel::SetRawAudioSink( | 1400 void VoiceChannel::SetRawAudioSink( |
1391 uint32_t ssrc, | 1401 uint32_t ssrc, |
1392 const rtc::scoped_refptr<webrtc::AudioSinkInterface>& sink) { | 1402 rtc::scoped_ptr<webrtc::AudioSinkInterface> sink) { |
1393 worker_thread()->Invoke<void>( | 1403 // We need to work around Bind's lack of support for scoped_ptr and ownership |
1394 Bind(&VoiceMediaChannel::SetRawAudioSink, media_channel(), ssrc, sink)); | 1404 // passing. So we invoke to our own little routine that gets a pointer to |
| 1405 // our local variable. This is OK since we're synchronously invoking. |
| 1406 InvokeOnWorker(Bind(&SetRawAudioSink_w, media_channel(), ssrc, &sink)); |
1395 } | 1407 } |
1396 | 1408 |
1397 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1409 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
1398 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, | 1410 return InvokeOnWorker(Bind(&VoiceMediaChannel::GetStats, |
1399 media_channel(), stats)); | 1411 media_channel(), stats)); |
1400 } | 1412 } |
1401 | 1413 |
1402 void VoiceChannel::StartMediaMonitor(int cms) { | 1414 void VoiceChannel::StartMediaMonitor(int cms) { |
1403 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1415 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
1404 rtc::Thread::Current())); | 1416 rtc::Thread::Current())); |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2306 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); | 2318 return (data_channel_type_ == DCT_RTP) && BaseChannel::ShouldSetupDtlsSrtp(); |
2307 } | 2319 } |
2308 | 2320 |
2309 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { | 2321 void DataChannel::OnStreamClosedRemotely(uint32_t sid) { |
2310 rtc::TypedMessageData<uint32_t>* message = | 2322 rtc::TypedMessageData<uint32_t>* message = |
2311 new rtc::TypedMessageData<uint32_t>(sid); | 2323 new rtc::TypedMessageData<uint32_t>(sid); |
2312 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); | 2324 signaling_thread()->Post(this, MSG_STREAMCLOSEDREMOTELY, message); |
2313 } | 2325 } |
2314 | 2326 |
2315 } // namespace cricket | 2327 } // namespace cricket |
OLD | NEW |