Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 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 12 matching lines...) Expand all Loading... | |
| 23 #include "webrtc/base/trace_event.h" | 23 #include "webrtc/base/trace_event.h" |
| 24 #include "webrtc/media/base/mediaconstants.h" | 24 #include "webrtc/media/base/mediaconstants.h" |
| 25 #include "webrtc/media/base/rtputils.h" | 25 #include "webrtc/media/base/rtputils.h" |
| 26 #include "webrtc/media/engine/webrtcvoiceengine.h" | 26 #include "webrtc/media/engine/webrtcvoiceengine.h" |
| 27 #include "webrtc/p2p/base/packettransportinternal.h" | 27 #include "webrtc/p2p/base/packettransportinternal.h" |
| 28 #include "webrtc/pc/channelmanager.h" | 28 #include "webrtc/pc/channelmanager.h" |
| 29 | 29 |
| 30 namespace cricket { | 30 namespace cricket { |
| 31 using rtc::Bind; | 31 using rtc::Bind; |
| 32 | 32 |
| 33 std::vector<webrtc::RtpSource> GetSourcesImpl( | |
| 34 WebRtcVoiceMediaChannel* media_channel, | |
| 35 uint32_t ssrc); | |
| 36 | |
| 33 namespace { | 37 namespace { |
| 34 // See comment below for why we need to use a pointer to a unique_ptr. | 38 // See comment below for why we need to use a pointer to a unique_ptr. |
| 35 bool SetRawAudioSink_w(VoiceMediaChannel* channel, | 39 bool SetRawAudioSink_w(VoiceMediaChannel* channel, |
| 36 uint32_t ssrc, | 40 uint32_t ssrc, |
| 37 std::unique_ptr<webrtc::AudioSinkInterface>* sink) { | 41 std::unique_ptr<webrtc::AudioSinkInterface>* sink) { |
| 38 channel->SetRawAudioSink(ssrc, std::move(*sink)); | 42 channel->SetRawAudioSink(ssrc, std::move(*sink)); |
| 39 return true; | 43 return true; |
| 40 } | 44 } |
| 41 | 45 |
| 42 struct SendPacketMessageData : public rtc::MessageData { | 46 struct SendPacketMessageData : public rtc::MessageData { |
| (...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1601 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); | 1605 return media_channel()->SetRtpReceiveParameters(ssrc, parameters); |
| 1602 } | 1606 } |
| 1603 | 1607 |
| 1604 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { | 1608 bool VoiceChannel::GetStats(VoiceMediaInfo* stats) { |
| 1605 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, | 1609 return InvokeOnWorker(RTC_FROM_HERE, Bind(&VoiceMediaChannel::GetStats, |
| 1606 media_channel(), stats)); | 1610 media_channel(), stats)); |
| 1607 } | 1611 } |
| 1608 | 1612 |
| 1609 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { | 1613 std::vector<webrtc::RtpSource> VoiceChannel::GetSources(uint32_t ssrc) const { |
| 1610 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( | 1614 return worker_thread()->Invoke<std::vector<webrtc::RtpSource>>( |
| 1611 RTC_FROM_HERE, | 1615 RTC_FROM_HERE, Bind(&VoiceChannel::GetSources_w, this, ssrc)); |
| 1612 Bind(&WebRtcVoiceMediaChannel::GetSources, | 1616 } |
| 1613 static_cast<WebRtcVoiceMediaChannel*>(media_channel()), ssrc)); | 1617 |
| 1618 std::vector<webrtc::RtpSource> VoiceChannel::GetSources_w(uint32_t ssrc) const { | |
| 1619 RTC_DCHECK(worker_thread()->IsCurrent()); | |
| 1620 return GetSourcesImpl(static_cast<WebRtcVoiceMediaChannel*>(media_channel()), | |
|
Taylor Brandstetter
2017/05/18 17:57:05
This wouldn't be necessary if GetSources was pure
Zhi Huang
2017/05/23 03:40:35
Yes. Once the circular dependency problem is solve
| |
| 1621 ssrc); | |
| 1614 } | 1622 } |
| 1615 | 1623 |
| 1616 void VoiceChannel::StartMediaMonitor(int cms) { | 1624 void VoiceChannel::StartMediaMonitor(int cms) { |
| 1617 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), | 1625 media_monitor_.reset(new VoiceMediaMonitor(media_channel(), worker_thread(), |
| 1618 rtc::Thread::Current())); | 1626 rtc::Thread::Current())); |
| 1619 media_monitor_->SignalUpdate.connect( | 1627 media_monitor_->SignalUpdate.connect( |
| 1620 this, &VoiceChannel::OnMediaMonitorUpdate); | 1628 this, &VoiceChannel::OnMediaMonitorUpdate); |
| 1621 media_monitor_->Start(cms); | 1629 media_monitor_->Start(cms); |
| 1622 } | 1630 } |
| 1623 | 1631 |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2400 | 2408 |
| 2401 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { | 2409 void RtpDataChannel::OnDataChannelReadyToSend(bool writable) { |
| 2402 // This is usded for congestion control to indicate that the stream is ready | 2410 // This is usded for congestion control to indicate that the stream is ready |
| 2403 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates | 2411 // to send by the MediaChannel, as opposed to OnReadyToSend, which indicates |
| 2404 // that the transport channel is ready. | 2412 // that the transport channel is ready. |
| 2405 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2413 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
| 2406 new DataChannelReadyToSendMessageData(writable)); | 2414 new DataChannelReadyToSendMessageData(writable)); |
| 2407 } | 2415 } |
| 2408 | 2416 |
| 2409 } // namespace cricket | 2417 } // namespace cricket |
| OLD | NEW |