Cleanup AssociateSendStream for audio.
It was previously used to get RTT for a receive stream, but it is no longer used. Also some minor cleanup: fixed includes and removed comments about network thread. Bug: none Change-Id: Ia2612ea04be5df82cfe6528c0226095827ea3c77 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374042 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#43704}
This commit is contained in:
parent
cdd2922312
commit
75dc9c9ed3
@ -166,6 +166,7 @@ if (rtc_include_tests) {
|
||||
":channel_receive_unittest",
|
||||
"../api:array_view",
|
||||
"../api:bitrate_allocation",
|
||||
"../api:call_api",
|
||||
"../api:frame_transformer_factory",
|
||||
"../api:frame_transformer_interface",
|
||||
"../api:function_view",
|
||||
@ -181,6 +182,7 @@ if (rtc_include_tests) {
|
||||
"../api:scoped_refptr",
|
||||
"../api:transport_api",
|
||||
"../api/audio:audio_frame_api",
|
||||
"../api/audio:audio_mixer_api",
|
||||
"../api/audio:audio_processing_statistics",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/audio_codecs:builtin_audio_encoder_factory",
|
||||
@ -195,6 +197,7 @@ if (rtc_include_tests) {
|
||||
"../api/task_queue/test:mock_task_queue_base",
|
||||
"../api/transport:bitrate_settings",
|
||||
"../api/transport:network_control",
|
||||
"../api/transport/rtp:rtp_source",
|
||||
"../api/units:data_rate",
|
||||
"../api/units:data_size",
|
||||
"../api/units:time_delta",
|
||||
@ -216,6 +219,7 @@ if (rtc_include_tests) {
|
||||
"../modules/audio_processing:mocks",
|
||||
"../modules/pacing",
|
||||
"../modules/rtp_rtcp:mock_rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp",
|
||||
"../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:gunit_helpers",
|
||||
@ -240,6 +244,7 @@ if (rtc_include_tests) {
|
||||
"utility:utility_tests",
|
||||
"//testing/gtest",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -10,22 +10,36 @@
|
||||
|
||||
#include "audio/audio_receive_stream.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/array_view.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/call/audio_sink.h"
|
||||
#include "api/rtp_parameters.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/frame_transformer_interface.h"
|
||||
#include "api/neteq/neteq_factory.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/transport/rtp/rtp_source.h"
|
||||
#include "audio/audio_send_stream.h"
|
||||
#include "audio/audio_state.h"
|
||||
#include "audio/channel_receive.h"
|
||||
#include "audio/conversion.h"
|
||||
#include "call/audio_state.h"
|
||||
#include "call/rtp_config.h"
|
||||
#include "call/rtp_stream_receiver_controller_interface.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "call/syncable.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
@ -128,7 +142,6 @@ AudioReceiveStreamImpl::~AudioReceiveStreamImpl() {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
RTC_LOG(LS_INFO) << "~AudioReceiveStreamImpl: " << remote_ssrc();
|
||||
Stop();
|
||||
channel_receive_->SetAssociatedSendChannel(nullptr);
|
||||
channel_receive_->ResetReceiverCongestionControlObjects();
|
||||
}
|
||||
|
||||
@ -417,14 +430,6 @@ bool AudioReceiveStreamImpl::SetMinimumPlayoutDelay(int delay_ms) {
|
||||
return channel_receive_->SetMinimumPlayoutDelay(delay_ms);
|
||||
}
|
||||
|
||||
void AudioReceiveStreamImpl::AssociateSendStream(
|
||||
internal::AudioSendStream* send_stream) {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
channel_receive_->SetAssociatedSendChannel(
|
||||
send_stream ? send_stream->GetChannel() : nullptr);
|
||||
associated_send_stream_ = send_stream;
|
||||
}
|
||||
|
||||
void AudioReceiveStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) {
|
||||
// TODO(solenberg): Tests call this function on a network thread, libjingle
|
||||
// calls on the worker thread. We should move towards always using a network
|
||||
@ -456,12 +461,6 @@ const std::string& AudioReceiveStreamImpl::sync_group() const {
|
||||
return config_.sync_group;
|
||||
}
|
||||
|
||||
const AudioSendStream*
|
||||
AudioReceiveStreamImpl::GetAssociatedSendStreamForTesting() const {
|
||||
RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
|
||||
return associated_send_stream_;
|
||||
}
|
||||
|
||||
internal::AudioState* AudioReceiveStreamImpl::audio_state() const {
|
||||
auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get());
|
||||
RTC_DCHECK(audio_state);
|
||||
|
||||
@ -11,21 +11,32 @@
|
||||
#ifndef AUDIO_AUDIO_RECEIVE_STREAM_H_
|
||||
#define AUDIO_AUDIO_RECEIVE_STREAM_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/frame_transformer_interface.h"
|
||||
#include "api/neteq/neteq_factory.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/sequence_checker.h"
|
||||
#include "api/transport/rtp/rtp_source.h"
|
||||
#include "audio/audio_state.h"
|
||||
#include "call/audio_receive_stream.h"
|
||||
#include "call/audio_state.h"
|
||||
#include "call/syncable.h"
|
||||
#include "rtc_base/system/no_unique_address.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
|
||||
namespace webrtc {
|
||||
class PacketRouter;
|
||||
@ -36,10 +47,6 @@ namespace voe {
|
||||
class ChannelReceiveInterface;
|
||||
} // namespace voe
|
||||
|
||||
namespace internal {
|
||||
class AudioSendStream;
|
||||
} // namespace internal
|
||||
|
||||
class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStreamInterface,
|
||||
public AudioMixer::Source,
|
||||
public Syncable {
|
||||
@ -115,7 +122,6 @@ class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStreamInterface,
|
||||
int64_t time_ms) override;
|
||||
bool SetMinimumPlayoutDelay(int delay_ms) override;
|
||||
|
||||
void AssociateSendStream(internal::AudioSendStream* send_stream);
|
||||
void DeliverRtcp(const uint8_t* packet, size_t length);
|
||||
|
||||
void SetSyncGroup(absl::string_view sync_group);
|
||||
@ -134,8 +140,6 @@ class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStreamInterface,
|
||||
// Must be called on the packet delivery thread.
|
||||
const std::string& sync_group() const;
|
||||
|
||||
const AudioSendStream* GetAssociatedSendStreamForTesting() const;
|
||||
|
||||
// TODO(tommi): Remove this method.
|
||||
void ReconfigureForTesting(
|
||||
const webrtc::AudioReceiveStreamInterface::Config& config);
|
||||
@ -156,8 +160,6 @@ class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStreamInterface,
|
||||
webrtc::AudioReceiveStreamInterface::Config config_;
|
||||
rtc::scoped_refptr<webrtc::AudioState> audio_state_;
|
||||
const std::unique_ptr<voe::ChannelReceiveInterface> channel_receive_;
|
||||
AudioSendStream* associated_send_stream_
|
||||
RTC_GUARDED_BY(packet_sequence_checker_) = nullptr;
|
||||
|
||||
bool playing_ RTC_GUARDED_BY(worker_thread_checker_) = false;
|
||||
|
||||
|
||||
@ -10,17 +10,28 @@
|
||||
|
||||
#include "audio/audio_receive_stream.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/environment/environment_factory.h"
|
||||
#include "api/make_ref_counted.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/test/mock_audio_mixer.h"
|
||||
#include "api/test/mock_frame_decryptor.h"
|
||||
#include "audio/channel_receive.h"
|
||||
#include "audio/conversion.h"
|
||||
#include "audio/mock_voe_channel_proxy.h"
|
||||
#include "call/audio_receive_stream.h"
|
||||
#include "call/audio_state.h"
|
||||
#include "call/rtp_stream_receiver_controller.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/audio_device/include/mock_audio_device.h"
|
||||
#include "modules/audio_processing/include/mock_audio_processing.h"
|
||||
#include "modules/pacing/packet_router.h"
|
||||
@ -127,7 +138,6 @@ struct ConfigHelper {
|
||||
.Times(1);
|
||||
EXPECT_CALL(*channel_receive_, ResetReceiverCongestionControlObjects())
|
||||
.Times(1);
|
||||
EXPECT_CALL(*channel_receive_, SetAssociatedSendChannel(nullptr)).Times(1);
|
||||
EXPECT_CALL(*channel_receive_, SetReceiveCodecs(_))
|
||||
.WillRepeatedly(Invoke([](const std::map<int, SdpAudioFormat>& codecs) {
|
||||
EXPECT_THAT(codecs, ::testing::IsEmpty());
|
||||
@ -190,7 +200,7 @@ struct ConfigHelper {
|
||||
MockTransport rtcp_send_transport_;
|
||||
};
|
||||
|
||||
const std::vector<uint8_t> CreateRtcpSenderReport() {
|
||||
std::vector<uint8_t> CreateRtcpSenderReport() {
|
||||
std::vector<uint8_t> packet;
|
||||
const size_t kRtcpSrLength = 28; // In bytes.
|
||||
packet.resize(kRtcpSrLength);
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "api/units/timestamp.h"
|
||||
#include "audio/audio_level.h"
|
||||
#include "audio/channel_receive_frame_transformer_delegate.h"
|
||||
#include "audio/channel_send.h"
|
||||
#include "audio/utility/audio_frame_operations.h"
|
||||
#include "call/syncable.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
|
||||
@ -203,10 +202,6 @@ class ChannelReceive : public ChannelReceiveInterface,
|
||||
|
||||
std::vector<RtpSource> GetSources() const override;
|
||||
|
||||
// Associate to a send channel.
|
||||
// Used for obtaining RTT for a receive-only channel.
|
||||
void SetAssociatedSendChannel(const ChannelSendInterface* channel) override;
|
||||
|
||||
// Sets a frame transformer between the depacketizer and the decoder, to
|
||||
// transform the received frames before decoding them.
|
||||
void SetDepacketizerToDecoderFrameTransformer(
|
||||
@ -248,7 +243,6 @@ class ChannelReceive : public ChannelReceiveInterface,
|
||||
// parts with single-threaded semantics, and thereby reduce the need for
|
||||
// locks.
|
||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
|
||||
RTC_NO_UNIQUE_ADDRESS SequenceChecker network_thread_checker_;
|
||||
|
||||
const Environment env_;
|
||||
TaskQueueBase* const worker_thread_;
|
||||
@ -273,8 +267,6 @@ class ChannelReceive : public ChannelReceiveInterface,
|
||||
const uint32_t remote_ssrc_;
|
||||
SourceTracker source_tracker_ RTC_GUARDED_BY(&worker_thread_checker_);
|
||||
|
||||
// Info for GetSyncInfo is updated on network or worker thread, and queried on
|
||||
// the worker thread.
|
||||
std::optional<uint32_t> last_received_rtp_timestamp_
|
||||
RTC_GUARDED_BY(&worker_thread_checker_);
|
||||
std::optional<int64_t> last_received_rtp_system_time_ms_
|
||||
@ -313,9 +305,6 @@ class ChannelReceive : public ChannelReceiveInterface,
|
||||
AudioDeviceModule* _audioDeviceModulePtr;
|
||||
float _outputGain RTC_GUARDED_BY(volume_settings_mutex_);
|
||||
|
||||
const ChannelSendInterface* associated_send_channel_
|
||||
RTC_GUARDED_BY(network_thread_checker_);
|
||||
|
||||
PacketRouter* packet_router_ = nullptr;
|
||||
|
||||
SequenceChecker construction_thread_;
|
||||
@ -601,14 +590,11 @@ ChannelReceive::ChannelReceive(
|
||||
capture_start_ntp_time_ms_(-1),
|
||||
_audioDeviceModulePtr(audio_device_module),
|
||||
_outputGain(1.0f),
|
||||
associated_send_channel_(nullptr),
|
||||
frame_decryptor_(frame_decryptor),
|
||||
crypto_options_(crypto_options),
|
||||
absolute_capture_time_interpolator_(&env_.clock()) {
|
||||
RTC_DCHECK(audio_device_module);
|
||||
|
||||
network_thread_checker_.Detach();
|
||||
|
||||
rtp_receive_statistics_->EnableRetransmitDetection(remote_ssrc_, true);
|
||||
RtpRtcpInterface::Configuration configuration;
|
||||
configuration.audio = true;
|
||||
@ -681,9 +667,6 @@ void ChannelReceive::SetReceiveCodecs(
|
||||
|
||||
void ChannelReceive::OnRtpPacket(const RtpPacketReceived& packet) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called exclusively on the
|
||||
// network thread. Once that's done, the same applies to
|
||||
// UpdatePlayoutTimestamp and
|
||||
int64_t now_ms = rtc::TimeMillis();
|
||||
|
||||
last_received_rtp_timestamp_ = packet.Timestamp();
|
||||
@ -780,8 +763,6 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet,
|
||||
|
||||
void ChannelReceive::ReceivedRTCPPacket(const uint8_t* data, size_t length) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called exclusively on the
|
||||
// network thread.
|
||||
|
||||
// Store playout timestamp for the received RTCP packet
|
||||
UpdatePlayoutTimestamp(true, rtc::TimeMillis());
|
||||
@ -955,12 +936,6 @@ void ChannelReceive::RtcpPacketTypesCounterUpdated(
|
||||
rtcp_packet_type_counter_ = packet_counter;
|
||||
}
|
||||
|
||||
void ChannelReceive::SetAssociatedSendChannel(
|
||||
const ChannelSendInterface* channel) {
|
||||
RTC_DCHECK_RUN_ON(&network_thread_checker_);
|
||||
associated_send_channel_ = channel;
|
||||
}
|
||||
|
||||
void ChannelReceive::SetDepacketizerToDecoderFrameTransformer(
|
||||
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
@ -983,19 +958,16 @@ void ChannelReceive::SetDepacketizerToDecoderFrameTransformer(
|
||||
|
||||
void ChannelReceive::SetFrameDecryptor(
|
||||
rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) {
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called on the network thread.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
frame_decryptor_ = std::move(frame_decryptor);
|
||||
}
|
||||
|
||||
void ChannelReceive::OnLocalSsrcChange(uint32_t local_ssrc) {
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called on the network thread.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
rtp_rtcp_->SetLocalSsrc(local_ssrc);
|
||||
}
|
||||
|
||||
uint32_t ChannelReceive::GetLocalSsrc() const {
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called on the network thread.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
return rtp_rtcp_->local_media_ssrc();
|
||||
}
|
||||
@ -1083,9 +1055,6 @@ uint32_t ChannelReceive::GetDelayEstimate() const {
|
||||
}
|
||||
|
||||
bool ChannelReceive::SetMinimumPlayoutDelay(int delay_ms) {
|
||||
// TODO(bugs.webrtc.org/11993): This should run on the network thread.
|
||||
// We get here via RtpStreamsSynchronizer. Once that's done, many (all?) of
|
||||
// these locks aren't needed.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// Limit to range accepted by both VoE and ACM, so we're at least getting as
|
||||
// close as possible, instead of failing.
|
||||
@ -1138,9 +1107,6 @@ int ChannelReceive::GetBaseMinimumPlayoutDelayMs() const {
|
||||
}
|
||||
|
||||
std::optional<Syncable::Info> ChannelReceive::GetSyncInfo() const {
|
||||
// TODO(bugs.webrtc.org/11993): This should run on the network thread.
|
||||
// We get here via RtpStreamsSynchronizer. Once that's done, many of
|
||||
// these locks aren't needed.
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
Syncable::Info info;
|
||||
std::optional<RtpRtcpInterface::SenderReportStats> last_sr =
|
||||
@ -1166,8 +1132,6 @@ std::optional<Syncable::Info> ChannelReceive::GetSyncInfo() const {
|
||||
|
||||
void ChannelReceive::UpdatePlayoutTimestamp(bool rtcp, int64_t now_ms) {
|
||||
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
|
||||
// TODO(bugs.webrtc.org/11993): Expect to be called exclusively on the
|
||||
// network thread. Once that's done, we won't need video_sync_lock_.
|
||||
|
||||
jitter_buffer_playout_timestamp_ = neteq_->GetPlayoutTimestamp();
|
||||
|
||||
|
||||
@ -11,25 +11,33 @@
|
||||
#ifndef AUDIO_CHANNEL_RECEIVE_H_
|
||||
#define AUDIO_CHANNEL_RECEIVE_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/call/audio_sink.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/crypto/crypto_options.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/frame_transformer_interface.h"
|
||||
#include "api/neteq/neteq_factory.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/transport/rtp/rtp_source.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
#include "call/rtp_packet_sink_interface.h"
|
||||
#include "call/syncable.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/rtp_rtcp/source/source_tracker.h"
|
||||
|
||||
// TODO(solenberg, nisse): This file contains a few NOLINT marks, to silence
|
||||
// warnings about use of unsigned short.
|
||||
@ -153,11 +161,6 @@ class ChannelReceiveInterface : public RtpPacketSinkInterface {
|
||||
|
||||
virtual std::vector<RtpSource> GetSources() const = 0;
|
||||
|
||||
// Associate to a send channel.
|
||||
// Used for obtaining RTT for a receive-only channel.
|
||||
virtual void SetAssociatedSendChannel(
|
||||
const ChannelSendInterface* channel) = 0;
|
||||
|
||||
// Sets a frame transformer between the depacketizer and the decoder, to
|
||||
// transform the received frames before decoding them.
|
||||
virtual void SetDepacketizerToDecoderFrameTransformer(
|
||||
|
||||
@ -11,17 +11,36 @@
|
||||
#ifndef AUDIO_MOCK_VOE_CHANNEL_PROXY_H_
|
||||
#define AUDIO_MOCK_VOE_CHANNEL_PROXY_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio/audio_mixer.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/call/audio_sink.h"
|
||||
#include "api/call/bitrate_allocation.h"
|
||||
#include "api/crypto/frame_decryptor_interface.h"
|
||||
#include "api/test/mock_frame_encryptor.h"
|
||||
#include "api/crypto/frame_encryptor_interface.h"
|
||||
#include "api/frame_transformer_interface.h"
|
||||
#include "api/function_view.h"
|
||||
#include "api/rtp_headers.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "api/transport/rtp/rtp_source.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "audio/channel_receive.h"
|
||||
#include "audio/channel_send.h"
|
||||
#include "call/syncable.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/rtp_rtcp/include/report_block_data.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -63,10 +82,6 @@ class MockChannelReceive : public voe::ChannelReceiveInterface {
|
||||
(override));
|
||||
MOCK_METHOD(int, PreferredSampleRate, (), (const, override));
|
||||
MOCK_METHOD(std::vector<RtpSource>, GetSources, (), (const, override));
|
||||
MOCK_METHOD(void,
|
||||
SetAssociatedSendChannel,
|
||||
(const voe::ChannelSendInterface*),
|
||||
(override));
|
||||
MOCK_METHOD(bool,
|
||||
GetPlayoutRtpTimestamp,
|
||||
(uint32_t*, int64_t*),
|
||||
|
||||
29
call/call.cc
29
call/call.cc
@ -845,14 +845,6 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
|
||||
audio_send_ssrcs_.end());
|
||||
audio_send_ssrcs_[config.rtp.ssrc] = send_stream;
|
||||
|
||||
// TODO(bugs.webrtc.org/11993): call AssociateSendStream and
|
||||
// UpdateAggregateNetworkState asynchronously on the network thread.
|
||||
for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
|
||||
if (stream->local_ssrc() == config.rtp.ssrc) {
|
||||
stream->AssociateSendStream(send_stream);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAggregateNetworkState();
|
||||
|
||||
return send_stream;
|
||||
@ -873,14 +865,6 @@ void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
|
||||
size_t num_deleted = audio_send_ssrcs_.erase(ssrc);
|
||||
RTC_DCHECK_EQ(1, num_deleted);
|
||||
|
||||
// TODO(bugs.webrtc.org/11993): call AssociateSendStream and
|
||||
// UpdateAggregateNetworkState asynchronously on the network thread.
|
||||
for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
|
||||
if (stream->local_ssrc() == ssrc) {
|
||||
stream->AssociateSendStream(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAggregateNetworkState();
|
||||
|
||||
delete send_stream;
|
||||
@ -906,11 +890,6 @@ webrtc::AudioReceiveStreamInterface* Call::CreateAudioReceiveStream(
|
||||
|
||||
ConfigureSync(config.sync_group);
|
||||
|
||||
auto it = audio_send_ssrcs_.find(config.rtp.local_ssrc);
|
||||
if (it != audio_send_ssrcs_.end()) {
|
||||
receive_stream->AssociateSendStream(it->second);
|
||||
}
|
||||
|
||||
UpdateAggregateNetworkState();
|
||||
return receive_stream;
|
||||
}
|
||||
@ -1295,13 +1274,7 @@ void Call::UpdateAggregateNetworkState() {
|
||||
void Call::OnLocalSsrcUpdated(webrtc::AudioReceiveStreamInterface& stream,
|
||||
uint32_t local_ssrc) {
|
||||
RTC_DCHECK_RUN_ON(worker_thread_);
|
||||
webrtc::AudioReceiveStreamImpl& receive_stream =
|
||||
static_cast<webrtc::AudioReceiveStreamImpl&>(stream);
|
||||
|
||||
receive_stream.SetLocalSsrc(local_ssrc);
|
||||
auto it = audio_send_ssrcs_.find(local_ssrc);
|
||||
receive_stream.AssociateSendStream(it != audio_send_ssrcs_.end() ? it->second
|
||||
: nullptr);
|
||||
static_cast<webrtc::AudioReceiveStreamImpl&>(stream).SetLocalSsrc(local_ssrc);
|
||||
}
|
||||
|
||||
void Call::OnLocalSsrcUpdated(VideoReceiveStreamInterface& stream,
|
||||
|
||||
@ -188,70 +188,6 @@ TEST(CallTest, CreateDestroy_AudioReceiveStreams) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_RecvFirst) {
|
||||
for (bool use_null_audio_processing : {false, true}) {
|
||||
CallHelper call(use_null_audio_processing);
|
||||
AudioReceiveStreamInterface::Config recv_config;
|
||||
MockTransport rtcp_send_transport;
|
||||
recv_config.rtp.remote_ssrc = 42;
|
||||
recv_config.rtp.local_ssrc = 777;
|
||||
recv_config.rtcp_send_transport = &rtcp_send_transport;
|
||||
recv_config.decoder_factory =
|
||||
rtc::make_ref_counted<webrtc::MockAudioDecoderFactory>();
|
||||
AudioReceiveStreamInterface* recv_stream =
|
||||
call->CreateAudioReceiveStream(recv_config);
|
||||
EXPECT_NE(recv_stream, nullptr);
|
||||
|
||||
MockTransport send_transport;
|
||||
AudioSendStream::Config send_config(&send_transport);
|
||||
send_config.rtp.ssrc = 777;
|
||||
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
|
||||
EXPECT_NE(send_stream, nullptr);
|
||||
|
||||
AudioReceiveStreamImpl* internal_recv_stream =
|
||||
static_cast<AudioReceiveStreamImpl*>(recv_stream);
|
||||
EXPECT_EQ(send_stream,
|
||||
internal_recv_stream->GetAssociatedSendStreamForTesting());
|
||||
|
||||
call->DestroyAudioSendStream(send_stream);
|
||||
EXPECT_EQ(nullptr,
|
||||
internal_recv_stream->GetAssociatedSendStreamForTesting());
|
||||
|
||||
call->DestroyAudioReceiveStream(recv_stream);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_SendFirst) {
|
||||
for (bool use_null_audio_processing : {false, true}) {
|
||||
CallHelper call(use_null_audio_processing);
|
||||
MockTransport send_transport;
|
||||
AudioSendStream::Config send_config(&send_transport);
|
||||
send_config.rtp.ssrc = 777;
|
||||
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
|
||||
EXPECT_NE(send_stream, nullptr);
|
||||
|
||||
AudioReceiveStreamInterface::Config recv_config;
|
||||
MockTransport rtcp_send_transport;
|
||||
recv_config.rtp.remote_ssrc = 42;
|
||||
recv_config.rtp.local_ssrc = 777;
|
||||
recv_config.rtcp_send_transport = &rtcp_send_transport;
|
||||
recv_config.decoder_factory =
|
||||
rtc::make_ref_counted<webrtc::MockAudioDecoderFactory>();
|
||||
AudioReceiveStreamInterface* recv_stream =
|
||||
call->CreateAudioReceiveStream(recv_config);
|
||||
EXPECT_NE(recv_stream, nullptr);
|
||||
|
||||
AudioReceiveStreamImpl* internal_recv_stream =
|
||||
static_cast<AudioReceiveStreamImpl*>(recv_stream);
|
||||
EXPECT_EQ(send_stream,
|
||||
internal_recv_stream->GetAssociatedSendStreamForTesting());
|
||||
|
||||
call->DestroyAudioReceiveStream(recv_stream);
|
||||
|
||||
call->DestroyAudioSendStream(send_stream);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CallTest, CreateDestroy_FlexfecReceiveStream) {
|
||||
for (bool use_null_audio_processing : {false, true}) {
|
||||
CallHelper call(use_null_audio_processing);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user