OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 |
11 #include "webrtc/audio/audio_receive_stream.h" | 11 #include "webrtc/audio/audio_receive_stream.h" |
12 | 12 |
13 #include <string> | 13 #include <string> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/api/call/audio_sink.h" | 16 #include "webrtc/api/call/audio_sink.h" |
17 #include "webrtc/audio/audio_send_stream.h" | 17 #include "webrtc/audio/audio_send_stream.h" |
18 #include "webrtc/audio/audio_state.h" | 18 #include "webrtc/audio/audio_state.h" |
19 #include "webrtc/audio/conversion.h" | 19 #include "webrtc/audio/conversion.h" |
20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
21 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
22 #include "webrtc/base/timeutils.h" | 22 #include "webrtc/base/timeutils.h" |
| 23 #include "webrtc/call/rtp_stream_receiver_controller_interface.h" |
23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
26 #include "webrtc/voice_engine/channel_proxy.h" | 27 #include "webrtc/voice_engine/channel_proxy.h" |
27 #include "webrtc/voice_engine/include/voe_base.h" | 28 #include "webrtc/voice_engine/include/voe_base.h" |
28 #include "webrtc/voice_engine/voice_engine_impl.h" | 29 #include "webrtc/voice_engine/voice_engine_impl.h" |
29 | 30 |
30 namespace webrtc { | 31 namespace webrtc { |
31 | 32 |
32 std::string AudioReceiveStream::Config::Rtp::ToString() const { | 33 std::string AudioReceiveStream::Config::Rtp::ToString() const { |
(...skipping 22 matching lines...) Expand all Loading... |
55 ss << ", voe_channel_id: " << voe_channel_id; | 56 ss << ", voe_channel_id: " << voe_channel_id; |
56 if (!sync_group.empty()) { | 57 if (!sync_group.empty()) { |
57 ss << ", sync_group: " << sync_group; | 58 ss << ", sync_group: " << sync_group; |
58 } | 59 } |
59 ss << '}'; | 60 ss << '}'; |
60 return ss.str(); | 61 return ss.str(); |
61 } | 62 } |
62 | 63 |
63 namespace internal { | 64 namespace internal { |
64 AudioReceiveStream::AudioReceiveStream( | 65 AudioReceiveStream::AudioReceiveStream( |
| 66 RtpStreamReceiverControllerInterface* receiver_controller, |
65 PacketRouter* packet_router, | 67 PacketRouter* packet_router, |
66 const webrtc::AudioReceiveStream::Config& config, | 68 const webrtc::AudioReceiveStream::Config& config, |
67 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 69 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
68 webrtc::RtcEventLog* event_log) | 70 webrtc::RtcEventLog* event_log) |
69 : config_(config), | 71 : config_(config), audio_state_(audio_state) { |
70 audio_state_(audio_state) { | |
71 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); | 72 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); |
72 RTC_DCHECK_NE(config_.voe_channel_id, -1); | 73 RTC_DCHECK_NE(config_.voe_channel_id, -1); |
73 RTC_DCHECK(audio_state_.get()); | 74 RTC_DCHECK(audio_state_.get()); |
74 RTC_DCHECK(packet_router); | 75 RTC_DCHECK(packet_router); |
75 | 76 |
76 module_process_thread_checker_.DetachFromThread(); | 77 module_process_thread_checker_.DetachFromThread(); |
77 | 78 |
78 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); | 79 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
79 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); | 80 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); |
80 channel_proxy_->SetRtcEventLog(event_log); | 81 channel_proxy_->SetRtcEventLog(event_log); |
(...skipping 19 matching lines...) Expand all Loading... |
100 if (extension.uri == RtpExtension::kAudioLevelUri) { | 101 if (extension.uri == RtpExtension::kAudioLevelUri) { |
101 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); | 102 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); |
102 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { | 103 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { |
103 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); | 104 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); |
104 } else { | 105 } else { |
105 RTC_NOTREACHED() << "Unsupported RTP extension."; | 106 RTC_NOTREACHED() << "Unsupported RTP extension."; |
106 } | 107 } |
107 } | 108 } |
108 // Configure bandwidth estimation. | 109 // Configure bandwidth estimation. |
109 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); | 110 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); |
| 111 |
| 112 // Register with transport. |
| 113 rtp_stream_receiver_ = |
| 114 receiver_controller->CreateReceiver(config_.rtp.remote_ssrc, |
| 115 channel_proxy_.get()); |
110 } | 116 } |
111 | 117 |
112 AudioReceiveStream::~AudioReceiveStream() { | 118 AudioReceiveStream::~AudioReceiveStream() { |
113 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 119 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
114 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); | 120 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); |
115 if (playing_) { | 121 if (playing_) { |
116 Stop(); | 122 Stop(); |
117 } | 123 } |
118 channel_proxy_->DisassociateSendChannel(); | 124 channel_proxy_->DisassociateSendChannel(); |
119 channel_proxy_->DeRegisterExternalTransport(); | 125 channel_proxy_->DeRegisterExternalTransport(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 339 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
334 ScopedVoEInterface<VoEBase> base(voice_engine()); | 340 ScopedVoEInterface<VoEBase> base(voice_engine()); |
335 if (playout) { | 341 if (playout) { |
336 return base->StartPlayout(config_.voe_channel_id); | 342 return base->StartPlayout(config_.voe_channel_id); |
337 } else { | 343 } else { |
338 return base->StopPlayout(config_.voe_channel_id); | 344 return base->StopPlayout(config_.voe_channel_id); |
339 } | 345 } |
340 } | 346 } |
341 } // namespace internal | 347 } // namespace internal |
342 } // namespace webrtc | 348 } // namespace webrtc |
OLD | NEW |