2015-10-16 14:35:07 -07: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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <list>
|
2017-03-27 07:15:49 -07:00
|
|
|
#include <map>
|
2016-03-12 06:10:44 -08:00
|
|
|
#include <memory>
|
2017-05-08 11:52:38 -07:00
|
|
|
#include <utility>
|
2015-10-16 14:35:07 -07:00
|
|
|
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
#include "absl/memory/memory.h"
|
2017-11-02 13:04:41 +01:00
|
|
|
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
2018-11-15 08:26:19 -08:00
|
|
|
#include "api/test/fake_media_transport.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/test/mock_audio_mixer.h"
|
2018-01-11 13:52:30 +01:00
|
|
|
#include "audio/audio_receive_stream.h"
|
|
|
|
|
#include "audio/audio_send_stream.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "call/audio_state.h"
|
|
|
|
|
#include "call/call.h"
|
|
|
|
|
#include "logging/rtc_event_log/rtc_event_log.h"
|
|
|
|
|
#include "modules/audio_device/include/mock_audio_device.h"
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
#include "modules/audio_processing/include/mock_audio_processing.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/pacing/mock/mock_paced_sender.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
|
|
|
|
|
#include "test/fake_encoder.h"
|
|
|
|
|
#include "test/gtest.h"
|
|
|
|
|
#include "test/mock_audio_decoder_factory.h"
|
|
|
|
|
#include "test/mock_transport.h"
|
2015-10-16 14:35:07 -07:00
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
struct CallHelper {
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper() {
|
2015-11-06 15:34:49 -08:00
|
|
|
webrtc::AudioState::Config audio_state_config;
|
Remove voe::TransmitMixer
TransmitMixer's functionality is moved into the AudioTransportProxy
owned by AudioState. This removes the need for an AudioTransport
implementation in VoEBaseImpl, which means that the proxy is no longer
a proxy, hence AudioTransportProxy is renamed to AudioTransportImpl.
In the short term, AudioState needs to know which AudioDeviceModule is
used, so it is added in AudioState::Config. AudioTransportImpl needs
to know which AudioSendStream:s are currently enabled to send, so
AudioState maintains a map of them, which is reduced into a simple
vector for AudioTransportImpl.
To encode and transmit audio,
AudioSendStream::OnAudioData(std::unique_ptr<AudioFrame> audio_frame)
is introduced, which is used in both the Chromium and standalone use
cases. This removes the need for two different instances of
voe::Channel::ProcessAndEncodeAudio(), so there is now only one,
taking an AudioFrame as argument. Callers need to allocate their own
AudioFrame:s, which is wasteful but not a regression since this was
already happening in the voe::Channel functions.
Most of the logic changed resides in
AudioTransportImpl::RecordedDataIsAvailable(), where two strange
things were found:
1. The clock drift parameter was ineffective since
apm->echo_cancellation()->enable_drift_compensation(false) is
called during initialization.
2. The output parameter 'new_mic_volume' was never set - instead it
was returned as a result, causing the ADM to never update the
analog mic gain
(https://cs.chromium.org/chromium/src/third_party/webrtc/voice_engine/voe_base_impl.cc?q=voe_base_impl.cc&dr&l=100).
Besides this, tests are updated, and some dead code is removed which
was found in the process.
Bug: webrtc:4690, webrtc:8591
Change-Id: I789d5296bf5efb7299a5ee05a4f3ce6abf9124b2
Reviewed-on: https://webrtc-review.googlesource.com/26681
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21301}
2017-12-15 16:42:15 +01:00
|
|
|
audio_state_config.audio_mixer =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::test::MockAudioMixer>();
|
|
|
|
|
audio_state_config.audio_processing =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::test::MockAudioProcessing>();
|
|
|
|
|
audio_state_config.audio_device_module =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::test::MockAudioDeviceModule>();
|
2016-10-07 11:53:05 -07:00
|
|
|
webrtc::Call::Config config(&event_log_);
|
2015-11-06 15:34:49 -08:00
|
|
|
config.audio_state = webrtc::AudioState::Create(audio_state_config);
|
2015-10-16 14:35:07 -07:00
|
|
|
call_.reset(webrtc::Call::Create(config));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webrtc::Call* operator->() { return call_.get(); }
|
|
|
|
|
|
|
|
|
|
private:
|
2016-10-07 11:53:05 -07:00
|
|
|
webrtc::RtcEventLogNullImpl event_log_;
|
2016-03-12 06:10:44 -08:00
|
|
|
std::unique_ptr<webrtc::Call> call_;
|
2015-10-16 14:35:07 -07:00
|
|
|
};
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, ConstructDestruct) {
|
|
|
|
|
CallHelper call;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_AudioSendStream) {
|
|
|
|
|
CallHelper call;
|
2018-10-26 12:57:07 +02:00
|
|
|
AudioSendStream::Config config(/*send_transport=*/nullptr,
|
|
|
|
|
/*media_transport=*/nullptr);
|
2015-10-16 14:35:07 -07:00
|
|
|
config.rtp.ssrc = 42;
|
|
|
|
|
AudioSendStream* stream = call->CreateAudioSendStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
call->DestroyAudioSendStream(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_AudioReceiveStream) {
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper call;
|
2015-10-16 14:35:07 -07:00
|
|
|
AudioReceiveStream::Config config;
|
2018-10-05 11:28:38 +02:00
|
|
|
MockTransport rtcp_send_transport;
|
2015-10-16 14:35:07 -07:00
|
|
|
config.rtp.remote_ssrc = 42;
|
2018-10-05 11:28:38 +02:00
|
|
|
config.rtcp_send_transport = &rtcp_send_transport;
|
2018-01-11 13:52:30 +01:00
|
|
|
config.decoder_factory =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>();
|
2015-10-16 14:35:07 -07:00
|
|
|
AudioReceiveStream* stream = call->CreateAudioReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
call->DestroyAudioReceiveStream(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_AudioSendStreams) {
|
|
|
|
|
CallHelper call;
|
2018-10-26 12:57:07 +02:00
|
|
|
AudioSendStream::Config config(/*send_transport=*/nullptr,
|
|
|
|
|
/*media_transport=*/nullptr);
|
2015-10-16 14:35:07 -07:00
|
|
|
std::list<AudioSendStream*> streams;
|
|
|
|
|
for (int i = 0; i < 2; ++i) {
|
|
|
|
|
for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) {
|
|
|
|
|
config.rtp.ssrc = ssrc;
|
|
|
|
|
AudioSendStream* stream = call->CreateAudioSendStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
if (ssrc & 1) {
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
} else {
|
|
|
|
|
streams.push_front(stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (auto s : streams) {
|
|
|
|
|
call->DestroyAudioSendStream(s);
|
|
|
|
|
}
|
|
|
|
|
streams.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_AudioReceiveStreams) {
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper call;
|
2015-10-16 14:35:07 -07:00
|
|
|
AudioReceiveStream::Config config;
|
2018-10-05 11:28:38 +02:00
|
|
|
MockTransport rtcp_send_transport;
|
|
|
|
|
config.rtcp_send_transport = &rtcp_send_transport;
|
2018-01-11 13:52:30 +01:00
|
|
|
config.decoder_factory =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>();
|
2015-10-16 14:35:07 -07:00
|
|
|
std::list<AudioReceiveStream*> streams;
|
|
|
|
|
for (int i = 0; i < 2; ++i) {
|
|
|
|
|
for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) {
|
|
|
|
|
config.rtp.remote_ssrc = ssrc;
|
|
|
|
|
AudioReceiveStream* stream = call->CreateAudioReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
if (ssrc & 1) {
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
} else {
|
|
|
|
|
streams.push_front(stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (auto s : streams) {
|
|
|
|
|
call->DestroyAudioReceiveStream(s);
|
|
|
|
|
}
|
|
|
|
|
streams.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-23 23:37:14 -07:00
|
|
|
|
2016-11-14 11:30:07 -08:00
|
|
|
TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_RecvFirst) {
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper call;
|
2016-11-14 11:30:07 -08:00
|
|
|
AudioReceiveStream::Config recv_config;
|
2018-10-05 11:28:38 +02:00
|
|
|
MockTransport rtcp_send_transport;
|
2016-11-14 11:30:07 -08:00
|
|
|
recv_config.rtp.remote_ssrc = 42;
|
|
|
|
|
recv_config.rtp.local_ssrc = 777;
|
2018-10-05 11:28:38 +02:00
|
|
|
recv_config.rtcp_send_transport = &rtcp_send_transport;
|
2018-01-11 13:52:30 +01:00
|
|
|
recv_config.decoder_factory =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>();
|
2016-11-14 11:30:07 -08:00
|
|
|
AudioReceiveStream* recv_stream = call->CreateAudioReceiveStream(recv_config);
|
|
|
|
|
EXPECT_NE(recv_stream, nullptr);
|
|
|
|
|
|
2018-10-26 12:57:07 +02:00
|
|
|
AudioSendStream::Config send_config(/*send_transport=*/nullptr,
|
|
|
|
|
/*media_transport=*/nullptr);
|
2016-11-14 11:30:07 -08:00
|
|
|
send_config.rtp.ssrc = 777;
|
|
|
|
|
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
|
|
|
|
|
EXPECT_NE(send_stream, nullptr);
|
|
|
|
|
|
2018-01-11 13:52:30 +01:00
|
|
|
internal::AudioReceiveStream* internal_recv_stream =
|
|
|
|
|
static_cast<internal::AudioReceiveStream*>(recv_stream);
|
|
|
|
|
EXPECT_EQ(send_stream,
|
|
|
|
|
internal_recv_stream->GetAssociatedSendStreamForTesting());
|
|
|
|
|
|
2016-11-14 11:30:07 -08:00
|
|
|
call->DestroyAudioSendStream(send_stream);
|
2018-01-11 13:52:30 +01:00
|
|
|
EXPECT_EQ(nullptr, internal_recv_stream->GetAssociatedSendStreamForTesting());
|
2016-11-14 11:30:07 -08:00
|
|
|
|
|
|
|
|
call->DestroyAudioReceiveStream(recv_stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_SendFirst) {
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper call;
|
2018-10-26 12:57:07 +02:00
|
|
|
AudioSendStream::Config send_config(/*send_transport=*/nullptr,
|
|
|
|
|
/*media_transport=*/nullptr);
|
2016-11-14 11:30:07 -08:00
|
|
|
send_config.rtp.ssrc = 777;
|
|
|
|
|
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
|
|
|
|
|
EXPECT_NE(send_stream, nullptr);
|
|
|
|
|
|
|
|
|
|
AudioReceiveStream::Config recv_config;
|
2018-10-05 11:28:38 +02:00
|
|
|
MockTransport rtcp_send_transport;
|
2016-11-14 11:30:07 -08:00
|
|
|
recv_config.rtp.remote_ssrc = 42;
|
|
|
|
|
recv_config.rtp.local_ssrc = 777;
|
2018-10-05 11:28:38 +02:00
|
|
|
recv_config.rtcp_send_transport = &rtcp_send_transport;
|
2018-01-11 13:52:30 +01:00
|
|
|
recv_config.decoder_factory =
|
|
|
|
|
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>();
|
2016-11-14 11:30:07 -08:00
|
|
|
AudioReceiveStream* recv_stream = call->CreateAudioReceiveStream(recv_config);
|
|
|
|
|
EXPECT_NE(recv_stream, nullptr);
|
|
|
|
|
|
2018-01-11 13:52:30 +01:00
|
|
|
internal::AudioReceiveStream* internal_recv_stream =
|
|
|
|
|
static_cast<internal::AudioReceiveStream*>(recv_stream);
|
|
|
|
|
EXPECT_EQ(send_stream,
|
|
|
|
|
internal_recv_stream->GetAssociatedSendStreamForTesting());
|
|
|
|
|
|
2016-11-14 11:30:07 -08:00
|
|
|
call->DestroyAudioReceiveStream(recv_stream);
|
|
|
|
|
|
|
|
|
|
call->DestroyAudioSendStream(send_stream);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-23 23:37:14 -07:00
|
|
|
TEST(CallTest, CreateDestroy_FlexfecReceiveStream) {
|
|
|
|
|
CallHelper call;
|
2017-01-13 07:41:19 -08:00
|
|
|
MockTransport rtcp_send_transport;
|
|
|
|
|
FlexfecReceiveStream::Config config(&rtcp_send_transport);
|
2016-12-08 04:17:53 -08:00
|
|
|
config.payload_type = 118;
|
|
|
|
|
config.remote_ssrc = 38837212;
|
2016-10-23 23:37:14 -07:00
|
|
|
config.protected_media_ssrcs = {27273};
|
|
|
|
|
|
|
|
|
|
FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
call->DestroyFlexfecReceiveStream(stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, CreateDestroy_FlexfecReceiveStreams) {
|
|
|
|
|
CallHelper call;
|
2017-01-13 07:41:19 -08:00
|
|
|
MockTransport rtcp_send_transport;
|
|
|
|
|
FlexfecReceiveStream::Config config(&rtcp_send_transport);
|
2016-12-08 04:17:53 -08:00
|
|
|
config.payload_type = 118;
|
2016-10-23 23:37:14 -07:00
|
|
|
std::list<FlexfecReceiveStream*> streams;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; ++i) {
|
|
|
|
|
for (uint32_t ssrc = 0; ssrc < 1234567; ssrc += 34567) {
|
2016-12-08 04:17:53 -08:00
|
|
|
config.remote_ssrc = ssrc;
|
2016-10-23 23:37:14 -07:00
|
|
|
config.protected_media_ssrcs = {ssrc + 1};
|
|
|
|
|
FlexfecReceiveStream* stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
if (ssrc & 1) {
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
} else {
|
|
|
|
|
streams.push_front(stream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (auto s : streams) {
|
|
|
|
|
call->DestroyFlexfecReceiveStream(s);
|
|
|
|
|
}
|
|
|
|
|
streams.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(CallTest, MultipleFlexfecReceiveStreamsProtectingSingleVideoStream) {
|
|
|
|
|
CallHelper call;
|
2017-01-13 07:41:19 -08:00
|
|
|
MockTransport rtcp_send_transport;
|
|
|
|
|
FlexfecReceiveStream::Config config(&rtcp_send_transport);
|
2016-12-08 04:17:53 -08:00
|
|
|
config.payload_type = 118;
|
2016-10-23 23:37:14 -07:00
|
|
|
config.protected_media_ssrcs = {1324234};
|
|
|
|
|
FlexfecReceiveStream* stream;
|
|
|
|
|
std::list<FlexfecReceiveStream*> streams;
|
|
|
|
|
|
2016-12-08 04:17:53 -08:00
|
|
|
config.remote_ssrc = 838383;
|
2016-10-23 23:37:14 -07:00
|
|
|
stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
|
2016-12-08 04:17:53 -08:00
|
|
|
config.remote_ssrc = 424993;
|
2016-10-23 23:37:14 -07:00
|
|
|
stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
|
2016-12-08 04:17:53 -08:00
|
|
|
config.remote_ssrc = 99383;
|
2016-10-23 23:37:14 -07:00
|
|
|
stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
|
2016-12-08 04:17:53 -08:00
|
|
|
config.remote_ssrc = 5548;
|
2016-10-23 23:37:14 -07:00
|
|
|
stream = call->CreateFlexfecReceiveStream(config);
|
|
|
|
|
EXPECT_NE(stream, nullptr);
|
|
|
|
|
streams.push_back(stream);
|
|
|
|
|
|
|
|
|
|
for (auto s : streams) {
|
|
|
|
|
call->DestroyFlexfecReceiveStream(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-23 06:07:11 -07:00
|
|
|
TEST(CallTest, RecreatingAudioStreamWithSameSsrcReusesRtpState) {
|
|
|
|
|
constexpr uint32_t kSSRC = 12345;
|
2018-01-11 13:52:30 +01:00
|
|
|
CallHelper call;
|
2017-05-23 06:07:11 -07:00
|
|
|
|
|
|
|
|
auto create_stream_and_get_rtp_state = [&](uint32_t ssrc) {
|
2018-10-26 12:57:07 +02:00
|
|
|
AudioSendStream::Config config(/*send_transport=*/nullptr,
|
|
|
|
|
/*media_transport=*/nullptr);
|
2017-05-23 06:07:11 -07:00
|
|
|
config.rtp.ssrc = ssrc;
|
|
|
|
|
AudioSendStream* stream = call->CreateAudioSendStream(config);
|
2018-01-11 13:52:30 +01:00
|
|
|
const RtpState rtp_state =
|
|
|
|
|
static_cast<internal::AudioSendStream*>(stream)->GetRtpState();
|
2017-05-23 06:07:11 -07:00
|
|
|
call->DestroyAudioSendStream(stream);
|
|
|
|
|
return rtp_state;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const RtpState rtp_state1 = create_stream_and_get_rtp_state(kSSRC);
|
|
|
|
|
const RtpState rtp_state2 = create_stream_and_get_rtp_state(kSSRC);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(rtp_state1.sequence_number, rtp_state2.sequence_number);
|
|
|
|
|
EXPECT_EQ(rtp_state1.start_timestamp, rtp_state2.start_timestamp);
|
|
|
|
|
EXPECT_EQ(rtp_state1.timestamp, rtp_state2.timestamp);
|
|
|
|
|
EXPECT_EQ(rtp_state1.capture_time_ms, rtp_state2.capture_time_ms);
|
|
|
|
|
EXPECT_EQ(rtp_state1.last_timestamp_time_ms,
|
|
|
|
|
rtp_state2.last_timestamp_time_ms);
|
|
|
|
|
EXPECT_EQ(rtp_state1.media_has_been_sent, rtp_state2.media_has_been_sent);
|
|
|
|
|
}
|
2018-01-11 13:52:30 +01:00
|
|
|
|
2015-10-16 14:35:07 -07:00
|
|
|
} // namespace webrtc
|