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/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
26 #include "webrtc/voice_engine/channel_proxy.h" | 26 #include "webrtc/voice_engine/channel_proxy.h" |
27 #include "webrtc/voice_engine/include/voe_base.h" | 27 #include "webrtc/voice_engine/include/voe_base.h" |
28 #include "webrtc/voice_engine/include/voe_codec.h" | |
29 #include "webrtc/voice_engine/include/voe_neteq_stats.h" | |
30 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h" | |
31 #include "webrtc/voice_engine/include/voe_video_sync.h" | |
32 #include "webrtc/voice_engine/include/voe_volume_control.h" | |
33 #include "webrtc/voice_engine/voice_engine_impl.h" | 28 #include "webrtc/voice_engine/voice_engine_impl.h" |
34 | 29 |
35 namespace webrtc { | 30 namespace webrtc { |
36 | 31 |
37 std::string AudioReceiveStream::Config::Rtp::ToString() const { | 32 std::string AudioReceiveStream::Config::Rtp::ToString() const { |
38 std::stringstream ss; | 33 std::stringstream ss; |
39 ss << "{remote_ssrc: " << remote_ssrc; | 34 ss << "{remote_ssrc: " << remote_ssrc; |
40 ss << ", local_ssrc: " << local_ssrc; | 35 ss << ", local_ssrc: " << local_ssrc; |
41 ss << ", transport_cc: " << (transport_cc ? "on" : "off"); | 36 ss << ", transport_cc: " << (transport_cc ? "on" : "off"); |
42 ss << ", nack: " << nack.ToString(); | 37 ss << ", nack: " << nack.ToString(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 playing_ = false; | 165 playing_ = false; |
171 | 166 |
172 audio_state()->mixer()->RemoveSource(this); | 167 audio_state()->mixer()->RemoveSource(this); |
173 SetVoiceEnginePlayout(false); | 168 SetVoiceEnginePlayout(false); |
174 } | 169 } |
175 | 170 |
176 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { | 171 webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const { |
177 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 172 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
178 webrtc::AudioReceiveStream::Stats stats; | 173 webrtc::AudioReceiveStream::Stats stats; |
179 stats.remote_ssrc = config_.rtp.remote_ssrc; | 174 stats.remote_ssrc = config_.rtp.remote_ssrc; |
180 ScopedVoEInterface<VoECodec> codec(voice_engine()); | |
181 | 175 |
182 webrtc::CallStatistics call_stats = channel_proxy_->GetRTCPStatistics(); | 176 webrtc::CallStatistics call_stats = channel_proxy_->GetRTCPStatistics(); |
| 177 // TODO(solenberg): Don't return here if we can't get the codec - return the |
| 178 // stats we *can* get. |
183 webrtc::CodecInst codec_inst = {0}; | 179 webrtc::CodecInst codec_inst = {0}; |
184 if (codec->GetRecCodec(config_.voe_channel_id, codec_inst) == -1) { | 180 if (!channel_proxy_->GetRecCodec(&codec_inst)) { |
185 return stats; | 181 return stats; |
186 } | 182 } |
187 | 183 |
188 stats.bytes_rcvd = call_stats.bytesReceived; | 184 stats.bytes_rcvd = call_stats.bytesReceived; |
189 stats.packets_rcvd = call_stats.packetsReceived; | 185 stats.packets_rcvd = call_stats.packetsReceived; |
190 stats.packets_lost = call_stats.cumulativeLost; | 186 stats.packets_lost = call_stats.cumulativeLost; |
191 stats.fraction_lost = Q8ToFloat(call_stats.fractionLost); | 187 stats.fraction_lost = Q8ToFloat(call_stats.fractionLost); |
192 stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_; | 188 stats.capture_start_ntp_time_ms = call_stats.capture_start_ntp_time_ms_; |
193 if (codec_inst.pltype != -1) { | 189 if (codec_inst.pltype != -1) { |
194 stats.codec_name = codec_inst.plname; | 190 stats.codec_name = codec_inst.plname; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 362 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
367 ScopedVoEInterface<VoEBase> base(voice_engine()); | 363 ScopedVoEInterface<VoEBase> base(voice_engine()); |
368 if (playout) { | 364 if (playout) { |
369 return base->StartPlayout(config_.voe_channel_id); | 365 return base->StartPlayout(config_.voe_channel_id); |
370 } else { | 366 } else { |
371 return base->StopPlayout(config_.voe_channel_id); | 367 return base->StopPlayout(config_.voe_channel_id); |
372 } | 368 } |
373 } | 369 } |
374 } // namespace internal | 370 } // namespace internal |
375 } // namespace webrtc | 371 } // namespace webrtc |
OLD | NEW |