2015-09-23 15:53:52 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-12-01 11:26:34 +01:00
|
|
|
#include <string>
|
2016-01-21 06:32:43 -08:00
|
|
|
#include <vector>
|
2015-12-01 11:26:34 +01:00
|
|
|
|
2015-09-23 15:53:52 +02:00
|
|
|
#include "testing/gtest/include/gtest/gtest.h"
|
|
|
|
|
|
2015-09-25 13:58:30 +02:00
|
|
|
#include "webrtc/audio/audio_receive_stream.h"
|
2015-10-22 10:49:27 +02:00
|
|
|
#include "webrtc/audio/conversion.h"
|
2016-06-13 07:34:51 -07:00
|
|
|
#include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h"
|
2016-01-12 13:55:00 +01:00
|
|
|
#include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller.h"
|
2016-02-23 13:30:42 +01:00
|
|
|
#include "webrtc/modules/congestion_controller/include/mock/mock_congestion_controller.h"
|
2016-01-12 13:55:00 +01:00
|
|
|
#include "webrtc/modules/pacing/packet_router.h"
|
2015-09-23 15:53:52 +02:00
|
|
|
#include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitrate_estimator.h"
|
|
|
|
|
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
2016-01-12 13:55:00 +01:00
|
|
|
#include "webrtc/system_wrappers/include/clock.h"
|
2015-11-25 08:16:52 -08:00
|
|
|
#include "webrtc/test/mock_voe_channel_proxy.h"
|
2015-11-03 10:15:49 +01:00
|
|
|
#include "webrtc/test/mock_voice_engine.h"
|
2015-09-23 15:53:52 +02:00
|
|
|
|
2015-11-03 10:15:49 +01:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
2015-10-22 10:49:27 +02:00
|
|
|
namespace {
|
|
|
|
|
|
2015-11-16 07:34:50 -08:00
|
|
|
using testing::_;
|
2016-06-17 08:30:54 -07:00
|
|
|
using testing::FloatEq;
|
2015-11-16 07:34:50 -08:00
|
|
|
using testing::Return;
|
2016-06-13 07:34:51 -07:00
|
|
|
using testing::ReturnRef;
|
2015-11-16 07:34:50 -08:00
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
AudioDecodingCallStats MakeAudioDecodeStatsForTest() {
|
|
|
|
|
AudioDecodingCallStats audio_decode_stats;
|
|
|
|
|
audio_decode_stats.calls_to_silence_generator = 234;
|
|
|
|
|
audio_decode_stats.calls_to_neteq = 567;
|
|
|
|
|
audio_decode_stats.decoded_normal = 890;
|
|
|
|
|
audio_decode_stats.decoded_plc = 123;
|
|
|
|
|
audio_decode_stats.decoded_cng = 456;
|
|
|
|
|
audio_decode_stats.decoded_plc_cng = 789;
|
|
|
|
|
return audio_decode_stats;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-03 10:15:49 +01:00
|
|
|
const int kChannelId = 2;
|
|
|
|
|
const uint32_t kRemoteSsrc = 1234;
|
|
|
|
|
const uint32_t kLocalSsrc = 5678;
|
2016-01-12 13:55:00 +01:00
|
|
|
const size_t kOneByteExtensionHeaderLength = 4;
|
|
|
|
|
const size_t kOneByteExtensionLength = 4;
|
2015-11-20 09:59:34 -08:00
|
|
|
const int kAbsSendTimeId = 2;
|
|
|
|
|
const int kAudioLevelId = 3;
|
2016-01-12 13:55:00 +01:00
|
|
|
const int kTransportSequenceNumberId = 4;
|
2015-11-06 15:34:49 -08:00
|
|
|
const int kJitterBufferDelay = -7;
|
|
|
|
|
const int kPlayoutBufferDelay = 302;
|
|
|
|
|
const unsigned int kSpeechOutputLevel = 99;
|
|
|
|
|
const CallStatistics kCallStats = {
|
|
|
|
|
345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123};
|
|
|
|
|
const CodecInst kCodecInst = {
|
Misc. small cleanups.
* Better param names
* Avoid using negative values for (bogus) placeholder channel counts (mostly in tests). Since channels will be changing to size_t, negative values will be illegal; it's sufficient to use 0 in these cases.
* Use arraysize()
* Use size_t for counting frames, samples, blocks, buffers, and bytes -- most of these are already size_t in most places, this just fixes some stragglers
* reinterpret_cast<int64_t>(void*) is not necessarily safe; use uintptr_t instead
* Remove unnecessary code, e.g. dead code, needlessly long/repetitive code, or function overrides that exactly match the base definition
* Fix indenting
* Use uint32_t for timestamps (matching how it's already a uint32_t in most places)
* Spelling
* RTC_CHECK_EQ(expected, actual)
* Rewrap
* Use .empty()
* Be more pedantic about matching int/int32_t/
* Remove pointless consts on input parameters to functions
* Add missing sanity checks
All this was found in the course of constructing https://codereview.webrtc.org/1316523002/ , and is being landed separately first.
BUG=none
TEST=none
Review URL: https://codereview.webrtc.org/1534193008
Cr-Commit-Position: refs/heads/master@{#11191}
2016-01-08 13:50:27 -08:00
|
|
|
123, "codec_name_recv", 96000, -187, 0, -103};
|
2015-11-06 15:34:49 -08:00
|
|
|
const NetworkStatistics kNetworkStats = {
|
|
|
|
|
123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0};
|
|
|
|
|
const AudioDecodingCallStats kAudioDecodeStats = MakeAudioDecodeStatsForTest();
|
|
|
|
|
|
|
|
|
|
struct ConfigHelper {
|
2016-01-12 13:55:00 +01:00
|
|
|
ConfigHelper()
|
|
|
|
|
: simulated_clock_(123456),
|
2016-06-13 07:34:51 -07:00
|
|
|
decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>),
|
2016-02-08 14:31:30 +01:00
|
|
|
congestion_controller_(&simulated_clock_,
|
|
|
|
|
&bitrate_observer_,
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
&remote_bitrate_observer_) {
|
2015-11-25 08:16:52 -08:00
|
|
|
using testing::Invoke;
|
|
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_CALL(voice_engine_,
|
2015-11-16 07:34:50 -08:00
|
|
|
RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_CALL(voice_engine_,
|
2015-11-16 07:34:50 -08:00
|
|
|
DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
|
2015-11-06 15:34:49 -08:00
|
|
|
AudioState::Config config;
|
|
|
|
|
config.voice_engine = &voice_engine_;
|
|
|
|
|
audio_state_ = AudioState::Create(config);
|
2015-11-20 09:59:34 -08:00
|
|
|
|
2015-11-25 08:16:52 -08:00
|
|
|
EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
|
|
|
|
|
.WillOnce(Invoke([this](int channel_id) {
|
|
|
|
|
EXPECT_FALSE(channel_proxy_);
|
|
|
|
|
channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1);
|
2016-06-14 12:13:00 -07:00
|
|
|
EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1);
|
2015-11-27 10:46:42 -08:00
|
|
|
EXPECT_CALL(*channel_proxy_,
|
|
|
|
|
SetReceiveAbsoluteSenderTimeStatus(true, kAbsSendTimeId))
|
|
|
|
|
.Times(1);
|
|
|
|
|
EXPECT_CALL(*channel_proxy_,
|
|
|
|
|
SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId))
|
|
|
|
|
.Times(1);
|
2016-02-01 04:39:55 -08:00
|
|
|
EXPECT_CALL(*channel_proxy_,
|
2016-06-17 08:30:54 -07:00
|
|
|
EnableReceiveTransportSequenceNumber(kTransportSequenceNumberId))
|
|
|
|
|
.Times(1);
|
|
|
|
|
EXPECT_CALL(*channel_proxy_,
|
|
|
|
|
RegisterReceiverCongestionControlObjects(&packet_router_))
|
|
|
|
|
.Times(1);
|
2016-01-12 13:55:00 +01:00
|
|
|
EXPECT_CALL(congestion_controller_, packet_router())
|
|
|
|
|
.WillOnce(Return(&packet_router_));
|
2016-02-01 04:39:55 -08:00
|
|
|
EXPECT_CALL(*channel_proxy_, ResetCongestionControlObjects())
|
2016-01-12 13:55:00 +01:00
|
|
|
.Times(1);
|
2016-04-29 00:57:13 -07:00
|
|
|
EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr))
|
|
|
|
|
.Times(1);
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport())
|
|
|
|
|
.Times(1);
|
2016-06-13 07:34:51 -07:00
|
|
|
EXPECT_CALL(*channel_proxy_, GetAudioDecoderFactory())
|
|
|
|
|
.WillOnce(ReturnRef(decoder_factory_));
|
2015-11-25 08:16:52 -08:00
|
|
|
return channel_proxy_;
|
|
|
|
|
}));
|
2015-11-06 15:34:49 -08:00
|
|
|
stream_config_.voe_channel_id = kChannelId;
|
|
|
|
|
stream_config_.rtp.local_ssrc = kLocalSsrc;
|
|
|
|
|
stream_config_.rtp.remote_ssrc = kRemoteSsrc;
|
2016-06-14 12:13:00 -07:00
|
|
|
stream_config_.rtp.nack.rtp_history_ms = 300;
|
2015-11-20 09:59:34 -08:00
|
|
|
stream_config_.rtp.extensions.push_back(
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId));
|
2015-11-20 09:59:34 -08:00
|
|
|
stream_config_.rtp.extensions.push_back(
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId));
|
2016-01-21 06:32:43 -08:00
|
|
|
stream_config_.rtp.extensions.push_back(RtpExtension(
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId));
|
2016-06-13 07:34:51 -07:00
|
|
|
stream_config_.decoder_factory = decoder_factory_;
|
2015-11-25 08:16:52 -08:00
|
|
|
}
|
2015-11-06 15:34:49 -08:00
|
|
|
|
2016-01-12 13:55:00 +01:00
|
|
|
MockCongestionController* congestion_controller() {
|
|
|
|
|
return &congestion_controller_;
|
|
|
|
|
}
|
2015-11-06 15:34:49 -08:00
|
|
|
MockRemoteBitrateEstimator* remote_bitrate_estimator() {
|
|
|
|
|
return &remote_bitrate_estimator_;
|
|
|
|
|
}
|
|
|
|
|
AudioReceiveStream::Config& config() { return stream_config_; }
|
|
|
|
|
rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; }
|
|
|
|
|
MockVoiceEngine& voice_engine() { return voice_engine_; }
|
2016-04-29 00:57:13 -07:00
|
|
|
MockVoEChannelProxy* channel_proxy() { return channel_proxy_; }
|
2015-11-06 15:34:49 -08:00
|
|
|
|
2016-01-12 13:55:00 +01:00
|
|
|
void SetupMockForBweFeedback(bool send_side_bwe) {
|
|
|
|
|
EXPECT_CALL(congestion_controller_,
|
|
|
|
|
GetRemoteBitrateEstimator(send_side_bwe))
|
|
|
|
|
.WillOnce(Return(&remote_bitrate_estimator_));
|
|
|
|
|
EXPECT_CALL(remote_bitrate_estimator_,
|
|
|
|
|
RemoveStream(stream_config_.rtp.remote_ssrc));
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
void SetupMockForGetStats() {
|
|
|
|
|
using testing::DoAll;
|
|
|
|
|
using testing::SetArgReferee;
|
2015-11-25 08:16:52 -08:00
|
|
|
|
2016-01-12 13:55:00 +01:00
|
|
|
ASSERT_TRUE(channel_proxy_);
|
2015-11-27 10:46:42 -08:00
|
|
|
EXPECT_CALL(*channel_proxy_, GetRTCPStatistics())
|
|
|
|
|
.WillOnce(Return(kCallStats));
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, GetDelayEstimate())
|
|
|
|
|
.WillOnce(Return(kJitterBufferDelay + kPlayoutBufferDelay));
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, GetSpeechOutputLevelFullRange())
|
|
|
|
|
.WillOnce(Return(kSpeechOutputLevel));
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, GetNetworkStatistics())
|
|
|
|
|
.WillOnce(Return(kNetworkStats));
|
|
|
|
|
EXPECT_CALL(*channel_proxy_, GetDecodingCallStatistics())
|
|
|
|
|
.WillOnce(Return(kAudioDecodeStats));
|
|
|
|
|
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_CALL(voice_engine_, GetRecCodec(kChannelId, _))
|
|
|
|
|
.WillOnce(DoAll(SetArgReferee<1>(kCodecInst), Return(0)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2016-01-12 13:55:00 +01:00
|
|
|
SimulatedClock simulated_clock_;
|
|
|
|
|
PacketRouter packet_router_;
|
2016-05-11 06:01:13 -07:00
|
|
|
testing::NiceMock<MockCongestionObserver> bitrate_observer_;
|
2016-02-08 14:31:30 +01:00
|
|
|
testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
|
2016-06-13 07:34:51 -07:00
|
|
|
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
|
2016-01-12 13:55:00 +01:00
|
|
|
MockCongestionController congestion_controller_;
|
2015-11-06 15:34:49 -08:00
|
|
|
MockRemoteBitrateEstimator remote_bitrate_estimator_;
|
2015-11-16 07:34:50 -08:00
|
|
|
testing::StrictMock<MockVoiceEngine> voice_engine_;
|
2015-11-06 15:34:49 -08:00
|
|
|
rtc::scoped_refptr<AudioState> audio_state_;
|
|
|
|
|
AudioReceiveStream::Config stream_config_;
|
2015-11-25 08:16:52 -08:00
|
|
|
testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
|
2015-11-06 15:34:49 -08:00
|
|
|
};
|
2015-09-23 15:53:52 +02:00
|
|
|
|
2016-01-12 13:55:00 +01:00
|
|
|
void BuildOneByteExtension(std::vector<uint8_t>::iterator it,
|
|
|
|
|
int id,
|
|
|
|
|
uint32_t extension_value,
|
|
|
|
|
size_t value_length) {
|
2015-09-23 15:53:52 +02:00
|
|
|
const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE;
|
2016-01-12 13:55:00 +01:00
|
|
|
ByteWriter<uint16_t>::WriteBigEndian(&(*it), kRtpOneByteHeaderExtensionId);
|
|
|
|
|
it += 2;
|
2015-09-23 15:53:52 +02:00
|
|
|
|
2016-01-12 13:55:00 +01:00
|
|
|
ByteWriter<uint16_t>::WriteBigEndian(&(*it), kOneByteExtensionLength / 4);
|
|
|
|
|
it += 2;
|
|
|
|
|
const size_t kExtensionDataLength = kOneByteExtensionLength - 1;
|
|
|
|
|
uint32_t shifted_value = extension_value
|
|
|
|
|
<< (8 * (kExtensionDataLength - value_length));
|
2016-06-14 12:52:54 +02:00
|
|
|
*it = (id << 4) + (static_cast<uint8_t>(value_length) - 1);
|
2016-01-12 13:55:00 +01:00
|
|
|
++it;
|
|
|
|
|
ByteWriter<uint32_t, kExtensionDataLength>::WriteBigEndian(&(*it),
|
|
|
|
|
shifted_value);
|
2015-09-23 15:53:52 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-29 00:57:13 -07:00
|
|
|
const std::vector<uint8_t> CreateRtpHeaderWithOneByteExtension(
|
2016-01-12 13:55:00 +01:00
|
|
|
int extension_id,
|
|
|
|
|
uint32_t extension_value,
|
|
|
|
|
size_t value_length) {
|
|
|
|
|
std::vector<uint8_t> header;
|
|
|
|
|
header.resize(webrtc::kRtpHeaderSize + kOneByteExtensionHeaderLength +
|
|
|
|
|
kOneByteExtensionLength);
|
2015-09-23 15:53:52 +02:00
|
|
|
header[0] = 0x80; // Version 2.
|
|
|
|
|
header[0] |= 0x10; // Set extension bit.
|
|
|
|
|
header[1] = 100; // Payload type.
|
|
|
|
|
header[1] |= 0x80; // Marker bit is set.
|
2016-01-12 13:55:00 +01:00
|
|
|
ByteWriter<uint16_t>::WriteBigEndian(&header[2], 0x1234); // Sequence number.
|
|
|
|
|
ByteWriter<uint32_t>::WriteBigEndian(&header[4], 0x5678); // Timestamp.
|
|
|
|
|
ByteWriter<uint32_t>::WriteBigEndian(&header[8], 0x4321); // SSRC.
|
|
|
|
|
|
|
|
|
|
BuildOneByteExtension(header.begin() + webrtc::kRtpHeaderSize, extension_id,
|
|
|
|
|
extension_value, value_length);
|
|
|
|
|
return header;
|
2015-09-23 15:53:52 +02:00
|
|
|
}
|
2016-04-29 00:57:13 -07:00
|
|
|
|
|
|
|
|
const std::vector<uint8_t> CreateRtcpSenderReport() {
|
|
|
|
|
std::vector<uint8_t> packet;
|
|
|
|
|
const size_t kRtcpSrLength = 28; // In bytes.
|
|
|
|
|
packet.resize(kRtcpSrLength);
|
|
|
|
|
packet[0] = 0x80; // Version 2.
|
|
|
|
|
packet[1] = 0xc8; // PT = 200, SR.
|
|
|
|
|
// Length in number of 32-bit words - 1.
|
|
|
|
|
ByteWriter<uint16_t>::WriteBigEndian(&packet[2], 6);
|
|
|
|
|
ByteWriter<uint32_t>::WriteBigEndian(&packet[4], kLocalSsrc);
|
|
|
|
|
return packet;
|
|
|
|
|
}
|
2015-10-22 10:49:27 +02:00
|
|
|
} // namespace
|
|
|
|
|
|
2015-10-27 03:35:21 -07:00
|
|
|
TEST(AudioReceiveStreamTest, ConfigToString) {
|
|
|
|
|
AudioReceiveStream::Config config;
|
2015-11-03 10:15:49 +01:00
|
|
|
config.rtp.remote_ssrc = kRemoteSsrc;
|
|
|
|
|
config.rtp.local_ssrc = kLocalSsrc;
|
2015-10-27 03:35:21 -07:00
|
|
|
config.rtp.extensions.push_back(
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId));
|
2015-11-03 10:15:49 +01:00
|
|
|
config.voe_channel_id = kChannelId;
|
|
|
|
|
EXPECT_EQ(
|
2016-06-14 12:13:00 -07:00
|
|
|
"{rtp: {remote_ssrc: 1234, local_ssrc: 5678, transport_cc: off, "
|
|
|
|
|
"nack: {rtp_history_ms: 0}, extensions: [{uri: "
|
|
|
|
|
"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time, id: 2}]}, "
|
2016-04-29 00:57:13 -07:00
|
|
|
"rtcp_send_transport: nullptr, "
|
2016-02-04 04:12:24 -08:00
|
|
|
"voe_channel_id: 2}",
|
2015-11-03 10:15:49 +01:00
|
|
|
config.ToString());
|
2015-10-27 03:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(AudioReceiveStreamTest, ConstructDestruct) {
|
2015-11-06 15:34:49 -08:00
|
|
|
ConfigHelper helper;
|
|
|
|
|
internal::AudioReceiveStream recv_stream(
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
helper.congestion_controller(), helper.config(), helper.audio_state());
|
2016-01-12 13:55:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MATCHER_P(VerifyHeaderExtension, expected_extension, "") {
|
|
|
|
|
return arg.extension.hasAbsoluteSendTime ==
|
|
|
|
|
expected_extension.hasAbsoluteSendTime &&
|
|
|
|
|
arg.extension.absoluteSendTime ==
|
|
|
|
|
expected_extension.absoluteSendTime &&
|
|
|
|
|
arg.extension.hasTransportSequenceNumber ==
|
|
|
|
|
expected_extension.hasTransportSequenceNumber &&
|
|
|
|
|
arg.extension.transportSequenceNumber ==
|
|
|
|
|
expected_extension.transportSequenceNumber;
|
2015-10-27 03:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
2016-04-29 00:57:13 -07:00
|
|
|
TEST(AudioReceiveStreamTest, ReceiveRtpPacket) {
|
2016-01-12 13:55:00 +01:00
|
|
|
ConfigHelper helper;
|
|
|
|
|
helper.config().rtp.transport_cc = true;
|
|
|
|
|
helper.SetupMockForBweFeedback(true);
|
|
|
|
|
internal::AudioReceiveStream recv_stream(
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
helper.congestion_controller(), helper.config(), helper.audio_state());
|
2016-01-12 13:55:00 +01:00
|
|
|
const int kTransportSequenceNumberValue = 1234;
|
|
|
|
|
std::vector<uint8_t> rtp_packet = CreateRtpHeaderWithOneByteExtension(
|
|
|
|
|
kTransportSequenceNumberId, kTransportSequenceNumberValue, 2);
|
2015-09-23 15:53:52 +02:00
|
|
|
PacketTime packet_time(5678000, 0);
|
|
|
|
|
const size_t kExpectedHeaderLength = 20;
|
2016-01-12 13:55:00 +01:00
|
|
|
RTPHeaderExtension expected_extension;
|
|
|
|
|
expected_extension.hasTransportSequenceNumber = true;
|
|
|
|
|
expected_extension.transportSequenceNumber = kTransportSequenceNumberValue;
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_CALL(*helper.remote_bitrate_estimator(),
|
2015-11-03 10:15:49 +01:00
|
|
|
IncomingPacket(packet_time.timestamp / 1000,
|
2016-01-12 13:55:00 +01:00
|
|
|
rtp_packet.size() - kExpectedHeaderLength,
|
2016-06-20 11:53:02 -07:00
|
|
|
VerifyHeaderExtension(expected_extension)))
|
2015-09-23 15:53:52 +02:00
|
|
|
.Times(1);
|
2016-04-29 00:57:13 -07:00
|
|
|
EXPECT_CALL(*helper.channel_proxy(),
|
|
|
|
|
ReceivedRTPPacket(&rtp_packet[0],
|
|
|
|
|
rtp_packet.size(),
|
|
|
|
|
_))
|
|
|
|
|
.WillOnce(Return(true));
|
2015-09-23 15:53:52 +02:00
|
|
|
EXPECT_TRUE(
|
2016-01-12 13:55:00 +01:00
|
|
|
recv_stream.DeliverRtp(&rtp_packet[0], rtp_packet.size(), packet_time));
|
2015-09-23 15:53:52 +02:00
|
|
|
}
|
2015-10-22 10:49:27 +02:00
|
|
|
|
2016-04-29 00:57:13 -07:00
|
|
|
TEST(AudioReceiveStreamTest, ReceiveRtcpPacket) {
|
|
|
|
|
ConfigHelper helper;
|
|
|
|
|
helper.config().rtp.transport_cc = true;
|
|
|
|
|
helper.SetupMockForBweFeedback(true);
|
|
|
|
|
internal::AudioReceiveStream recv_stream(
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
helper.congestion_controller(), helper.config(), helper.audio_state());
|
2016-04-29 00:57:13 -07:00
|
|
|
|
|
|
|
|
std::vector<uint8_t> rtcp_packet = CreateRtcpSenderReport();
|
|
|
|
|
EXPECT_CALL(*helper.channel_proxy(),
|
|
|
|
|
ReceivedRTCPPacket(&rtcp_packet[0], rtcp_packet.size()))
|
|
|
|
|
.WillOnce(Return(true));
|
|
|
|
|
EXPECT_TRUE(recv_stream.DeliverRtcp(&rtcp_packet[0], rtcp_packet.size()));
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-22 10:49:27 +02:00
|
|
|
TEST(AudioReceiveStreamTest, GetStats) {
|
2015-11-06 15:34:49 -08:00
|
|
|
ConfigHelper helper;
|
|
|
|
|
internal::AudioReceiveStream recv_stream(
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
helper.congestion_controller(), helper.config(), helper.audio_state());
|
2015-11-06 15:34:49 -08:00
|
|
|
helper.SetupMockForGetStats();
|
2015-10-22 10:49:27 +02:00
|
|
|
AudioReceiveStream::Stats stats = recv_stream.GetStats();
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(kRemoteSsrc, stats.remote_ssrc);
|
|
|
|
|
EXPECT_EQ(static_cast<int64_t>(kCallStats.bytesReceived), stats.bytes_rcvd);
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(kCallStats.packetsReceived),
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.packets_rcvd);
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(kCallStats.cumulativeLost, stats.packets_lost);
|
|
|
|
|
EXPECT_EQ(Q8ToFloat(kCallStats.fractionLost), stats.fraction_lost);
|
|
|
|
|
EXPECT_EQ(std::string(kCodecInst.plname), stats.codec_name);
|
|
|
|
|
EXPECT_EQ(kCallStats.extendedMax, stats.ext_seqnum);
|
|
|
|
|
EXPECT_EQ(kCallStats.jitterSamples / (kCodecInst.plfreq / 1000),
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.jitter_ms);
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(kNetworkStats.currentBufferSize, stats.jitter_buffer_ms);
|
|
|
|
|
EXPECT_EQ(kNetworkStats.preferredBufferSize,
|
|
|
|
|
stats.jitter_buffer_preferred_ms);
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(kJitterBufferDelay + kPlayoutBufferDelay),
|
|
|
|
|
stats.delay_estimate_ms);
|
|
|
|
|
EXPECT_EQ(static_cast<int32_t>(kSpeechOutputLevel), stats.audio_level);
|
|
|
|
|
EXPECT_EQ(Q14ToFloat(kNetworkStats.currentExpandRate), stats.expand_rate);
|
|
|
|
|
EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSpeechExpandRate),
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.speech_expand_rate);
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(Q14ToFloat(kNetworkStats.currentSecondaryDecodedRate),
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.secondary_decoded_rate);
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(Q14ToFloat(kNetworkStats.currentAccelerateRate),
|
|
|
|
|
stats.accelerate_rate);
|
|
|
|
|
EXPECT_EQ(Q14ToFloat(kNetworkStats.currentPreemptiveRate),
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.preemptive_expand_rate);
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_EQ(kAudioDecodeStats.calls_to_silence_generator,
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.decoding_calls_to_silence_generator);
|
2015-11-06 15:34:49 -08:00
|
|
|
EXPECT_EQ(kAudioDecodeStats.calls_to_neteq, stats.decoding_calls_to_neteq);
|
|
|
|
|
EXPECT_EQ(kAudioDecodeStats.decoded_normal, stats.decoding_normal);
|
|
|
|
|
EXPECT_EQ(kAudioDecodeStats.decoded_plc, stats.decoding_plc);
|
|
|
|
|
EXPECT_EQ(kAudioDecodeStats.decoded_cng, stats.decoding_cng);
|
|
|
|
|
EXPECT_EQ(kAudioDecodeStats.decoded_plc_cng, stats.decoding_plc_cng);
|
2015-11-03 10:15:49 +01:00
|
|
|
EXPECT_EQ(kCallStats.capture_start_ntp_time_ms_,
|
2015-10-22 10:49:27 +02:00
|
|
|
stats.capture_start_ntp_time_ms);
|
|
|
|
|
}
|
2016-06-17 08:30:54 -07:00
|
|
|
|
|
|
|
|
TEST(AudioReceiveStreamTest, SetGain) {
|
|
|
|
|
ConfigHelper helper;
|
|
|
|
|
internal::AudioReceiveStream recv_stream(
|
Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.
Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}
TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749
Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 00:59:43 -07:00
|
|
|
helper.congestion_controller(), helper.config(), helper.audio_state());
|
2016-06-17 08:30:54 -07:00
|
|
|
EXPECT_CALL(*helper.channel_proxy(),
|
|
|
|
|
SetChannelOutputVolumeScaling(FloatEq(0.765f)));
|
|
|
|
|
recv_stream.SetGain(0.765f);
|
|
|
|
|
}
|
2015-10-22 10:49:27 +02:00
|
|
|
} // namespace test
|
2015-09-23 15:53:52 +02:00
|
|
|
} // namespace webrtc
|