| 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 <string> | 11 #include <string> |
| 12 #include <vector> |
| 12 | 13 |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 #include "webrtc/audio/audio_receive_stream.h" | 16 #include "webrtc/audio/audio_receive_stream.h" |
| 16 #include "webrtc/audio/conversion.h" | 17 #include "webrtc/audio/conversion.h" |
| 17 #include "webrtc/call/mock/mock_congestion_controller.h" | 18 #include "webrtc/call/mock/mock_congestion_controller.h" |
| 18 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller
.h" | 19 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller
.h" |
| 19 #include "webrtc/modules/pacing/packet_router.h" | 20 #include "webrtc/modules/pacing/packet_router.h" |
| 20 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_estimator.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 .WillOnce(Invoke([this](int channel_id) { | 84 .WillOnce(Invoke([this](int channel_id) { |
| 84 EXPECT_FALSE(channel_proxy_); | 85 EXPECT_FALSE(channel_proxy_); |
| 85 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | 86 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); |
| 86 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); | 87 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); |
| 87 EXPECT_CALL(*channel_proxy_, | 88 EXPECT_CALL(*channel_proxy_, |
| 88 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) | 89 SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId)) |
| 89 .Times(1); | 90 .Times(1); |
| 90 EXPECT_CALL(*channel_proxy_, | 91 EXPECT_CALL(*channel_proxy_, |
| 91 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) | 92 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) |
| 92 .Times(1); | 93 .Times(1); |
| 94 EXPECT_CALL(*channel_proxy_, EnableReceiveTransportSequenceNumber( |
| 95 kTransportSequenceNumberId)) |
| 96 .Times(1); |
| 93 EXPECT_CALL(*channel_proxy_, SetCongestionControlObjects( | 97 EXPECT_CALL(*channel_proxy_, SetCongestionControlObjects( |
| 94 nullptr, nullptr, &packet_router_)) | 98 nullptr, nullptr, &packet_router_)) |
| 95 .Times(1); | 99 .Times(1); |
| 96 EXPECT_CALL(congestion_controller_, packet_router()) | 100 EXPECT_CALL(congestion_controller_, packet_router()) |
| 97 .WillOnce(Return(&packet_router_)); | 101 .WillOnce(Return(&packet_router_)); |
| 98 EXPECT_CALL(*channel_proxy_, | 102 EXPECT_CALL(*channel_proxy_, |
| 99 SetCongestionControlObjects(nullptr, nullptr, nullptr)) | 103 SetCongestionControlObjects(nullptr, nullptr, nullptr)) |
| 100 .Times(1); | 104 .Times(1); |
| 101 return channel_proxy_; | 105 return channel_proxy_; |
| 102 })); | 106 })); |
| 103 stream_config_.voe_channel_id = kChannelId; | 107 stream_config_.voe_channel_id = kChannelId; |
| 104 stream_config_.rtp.local_ssrc = kLocalSsrc; | 108 stream_config_.rtp.local_ssrc = kLocalSsrc; |
| 105 stream_config_.rtp.remote_ssrc = kRemoteSsrc; | 109 stream_config_.rtp.remote_ssrc = kRemoteSsrc; |
| 106 stream_config_.rtp.extensions.push_back( | 110 stream_config_.rtp.extensions.push_back( |
| 107 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); | 111 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); |
| 108 stream_config_.rtp.extensions.push_back( | 112 stream_config_.rtp.extensions.push_back( |
| 109 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); | 113 RtpExtension(RtpExtension::kAudioLevel, kAudioLevelId)); |
| 114 stream_config_.rtp.extensions.push_back(RtpExtension( |
| 115 RtpExtension::kTransportSequenceNumber, kTransportSequenceNumberId)); |
| 110 } | 116 } |
| 111 | 117 |
| 112 MockCongestionController* congestion_controller() { | 118 MockCongestionController* congestion_controller() { |
| 113 return &congestion_controller_; | 119 return &congestion_controller_; |
| 114 } | 120 } |
| 115 MockRemoteBitrateEstimator* remote_bitrate_estimator() { | 121 MockRemoteBitrateEstimator* remote_bitrate_estimator() { |
| 116 return &remote_bitrate_estimator_; | 122 return &remote_bitrate_estimator_; |
| 117 } | 123 } |
| 118 AudioReceiveStream::Config& config() { return stream_config_; } | 124 AudioReceiveStream::Config& config() { return stream_config_; } |
| 119 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } | 125 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 VerifyHeaderExtension(expected_extension), false)) | 260 VerifyHeaderExtension(expected_extension), false)) |
| 255 .Times(1); | 261 .Times(1); |
| 256 EXPECT_TRUE( | 262 EXPECT_TRUE( |
| 257 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time)); | 263 recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time)); |
| 258 } | 264 } |
| 259 | 265 |
| 260 TEST(AudioReceiveStreamTest, AudioPacketUpdatesBweFeedback) { | 266 TEST(AudioReceiveStreamTest, AudioPacketUpdatesBweFeedback) { |
| 261 ConfigHelper helper; | 267 ConfigHelper helper; |
| 262 helper.config().combined_audio_video_bwe = true; | 268 helper.config().combined_audio_video_bwe = true; |
| 263 helper.config().rtp.transport_cc = true; | 269 helper.config().rtp.transport_cc = true; |
| 264 helper.config().rtp.extensions.push_back(RtpExtension( | |
| 265 RtpExtension::kTransportSequenceNumber, kTransportSequenceNumberId)); | |
| 266 helper.SetupMockForBweFeedback(true); | 270 helper.SetupMockForBweFeedback(true); |
| 267 internal::AudioReceiveStream recv_stream( | 271 internal::AudioReceiveStream recv_stream( |
| 268 helper.congestion_controller(), helper.config(), helper.audio_state()); | 272 helper.congestion_controller(), helper.config(), helper.audio_state()); |
| 269 const int kTransportSequenceNumberValue = 1234; | 273 const int kTransportSequenceNumberValue = 1234; |
| 270 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension( | 274 std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension( |
| 271 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2); | 275 kTransportSequenceNumberId, kTransportSequenceNumberValue, 2); |
| 272 PacketTime packet_time(5678000, 0); | 276 PacketTime packet_time(5678000, 0); |
| 273 const size_t kExpectedHeaderLength = 20; | 277 const size_t kExpectedHeaderLength = 20; |
| 274 RTPHeaderExtension expected_extension; | 278 RTPHeaderExtension expected_extension; |
| 275 expected_extension.hasTransportSequenceNumber = true; | 279 expected_extension.hasTransportSequenceNumber = true; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); | 323 EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq); |
| 320 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); | 324 EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal); |
| 321 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); | 325 EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc); |
| 322 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); | 326 EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng); |
| 323 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); | 327 EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng); |
| 324 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, | 328 EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_, |
| 325 stats.capture_start_ntp_time_ms); | 329 stats.capture_start_ntp_time_ms); |
| 326 } | 330 } |
| 327 } // namespace test | 331 } // namespace test |
| 328 } // namespace webrtc | 332 } // namespace webrtc |
| OLD | NEW |