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