Rename internal::AudioReceiveStream to AudioReceiveStreamImpl

Bug: webrtc:7484
Change-Id: Id0836a7fdd6fabbdc9bdc3b15e9965d9102bffa5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262803
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36959}
This commit is contained in:
Tommi 2022-05-20 15:21:33 +02:00 committed by WebRTC LUCI CQ
parent f6f4543304
commit dddbbebe2b
6 changed files with 103 additions and 100 deletions

View File

@ -65,7 +65,6 @@ std::string AudioReceiveStream::Config::ToString() const {
return ss.str(); return ss.str();
} }
namespace internal {
namespace { namespace {
std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive( std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
Clock* clock, Clock* clock,
@ -87,14 +86,14 @@ std::unique_ptr<voe::ChannelReceiveInterface> CreateChannelReceive(
} }
} // namespace } // namespace
AudioReceiveStream::AudioReceiveStream( AudioReceiveStreamImpl::AudioReceiveStreamImpl(
Clock* clock, Clock* clock,
PacketRouter* packet_router, PacketRouter* packet_router,
NetEqFactory* neteq_factory, NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config, const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log) webrtc::RtcEventLog* event_log)
: AudioReceiveStream(clock, : AudioReceiveStreamImpl(clock,
packet_router, packet_router,
config, config,
audio_state, audio_state,
@ -105,7 +104,7 @@ AudioReceiveStream::AudioReceiveStream(
config, config,
event_log)) {} event_log)) {}
AudioReceiveStream::AudioReceiveStream( AudioReceiveStreamImpl::AudioReceiveStreamImpl(
Clock* clock, Clock* clock,
PacketRouter* packet_router, PacketRouter* packet_router,
const webrtc::AudioReceiveStream::Config& config, const webrtc::AudioReceiveStream::Config& config,
@ -116,7 +115,7 @@ AudioReceiveStream::AudioReceiveStream(
audio_state_(audio_state), audio_state_(audio_state),
source_tracker_(clock), source_tracker_(clock),
channel_receive_(std::move(channel_receive)) { channel_receive_(std::move(channel_receive)) {
RTC_LOG(LS_INFO) << "AudioReceiveStream: " << config.rtp.remote_ssrc; RTC_LOG(LS_INFO) << "AudioReceiveStreamImpl: " << config.rtp.remote_ssrc;
RTC_DCHECK(config.decoder_factory); RTC_DCHECK(config.decoder_factory);
RTC_DCHECK(config.rtcp_send_transport); RTC_DCHECK(config.rtcp_send_transport);
RTC_DCHECK(audio_state_); RTC_DCHECK(audio_state_);
@ -143,15 +142,15 @@ AudioReceiveStream::AudioReceiveStream(
// `channel_receive_` already. // `channel_receive_` already.
} }
AudioReceiveStream::~AudioReceiveStream() { AudioReceiveStreamImpl::~AudioReceiveStreamImpl() {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_LOG(LS_INFO) << "~AudioReceiveStream: " << remote_ssrc(); RTC_LOG(LS_INFO) << "~AudioReceiveStreamImpl: " << remote_ssrc();
Stop(); Stop();
channel_receive_->SetAssociatedSendChannel(nullptr); channel_receive_->SetAssociatedSendChannel(nullptr);
channel_receive_->ResetReceiverCongestionControlObjects(); channel_receive_->ResetReceiverCongestionControlObjects();
} }
void AudioReceiveStream::RegisterWithTransport( void AudioReceiveStreamImpl::RegisterWithTransport(
RtpStreamReceiverControllerInterface* receiver_controller) { RtpStreamReceiverControllerInterface* receiver_controller) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
RTC_DCHECK(!rtp_stream_receiver_); RTC_DCHECK(!rtp_stream_receiver_);
@ -159,12 +158,12 @@ void AudioReceiveStream::RegisterWithTransport(
remote_ssrc(), channel_receive_.get()); remote_ssrc(), channel_receive_.get());
} }
void AudioReceiveStream::UnregisterFromTransport() { void AudioReceiveStreamImpl::UnregisterFromTransport() {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
rtp_stream_receiver_.reset(); rtp_stream_receiver_.reset();
} }
void AudioReceiveStream::ReconfigureForTesting( void AudioReceiveStreamImpl::ReconfigureForTesting(
const webrtc::AudioReceiveStream::Config& config) { const webrtc::AudioReceiveStream::Config& config) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
@ -190,7 +189,7 @@ void AudioReceiveStream::ReconfigureForTesting(
config_ = config; config_ = config;
} }
void AudioReceiveStream::Start() { void AudioReceiveStreamImpl::Start() {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
if (playing_) { if (playing_) {
return; return;
@ -200,7 +199,7 @@ void AudioReceiveStream::Start() {
audio_state()->AddReceivingStream(this); audio_state()->AddReceivingStream(this);
} }
void AudioReceiveStream::Stop() { void AudioReceiveStreamImpl::Stop() {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
if (!playing_) { if (!playing_) {
return; return;
@ -210,31 +209,32 @@ void AudioReceiveStream::Stop() {
audio_state()->RemoveReceivingStream(this); audio_state()->RemoveReceivingStream(this);
} }
bool AudioReceiveStream::transport_cc() const { bool AudioReceiveStreamImpl::transport_cc() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
return config_.rtp.transport_cc; return config_.rtp.transport_cc;
} }
bool AudioReceiveStream::IsRunning() const { bool AudioReceiveStreamImpl::IsRunning() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return playing_; return playing_;
} }
void AudioReceiveStream::SetDepacketizerToDecoderFrameTransformer( void AudioReceiveStreamImpl::SetDepacketizerToDecoderFrameTransformer(
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) { rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_receive_->SetDepacketizerToDecoderFrameTransformer( channel_receive_->SetDepacketizerToDecoderFrameTransformer(
std::move(frame_transformer)); std::move(frame_transformer));
} }
void AudioReceiveStream::SetDecoderMap( void AudioReceiveStreamImpl::SetDecoderMap(
std::map<int, SdpAudioFormat> decoder_map) { std::map<int, SdpAudioFormat> decoder_map) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
config_.decoder_map = std::move(decoder_map); config_.decoder_map = std::move(decoder_map);
channel_receive_->SetReceiveCodecs(config_.decoder_map); channel_receive_->SetReceiveCodecs(config_.decoder_map);
} }
void AudioReceiveStream::SetUseTransportCcAndNackHistory(bool use_transport_cc, void AudioReceiveStreamImpl::SetUseTransportCcAndNackHistory(
bool use_transport_cc,
int history_ms) { int history_ms) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
RTC_DCHECK_GE(history_ms, 0); RTC_DCHECK_GE(history_ms, 0);
@ -247,13 +247,13 @@ void AudioReceiveStream::SetUseTransportCcAndNackHistory(bool use_transport_cc,
} }
} }
void AudioReceiveStream::SetNonSenderRttMeasurement(bool enabled) { void AudioReceiveStreamImpl::SetNonSenderRttMeasurement(bool enabled) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
config_.enable_non_sender_rtt = enabled; config_.enable_non_sender_rtt = enabled;
channel_receive_->SetNonSenderRttMeasurement(enabled); channel_receive_->SetNonSenderRttMeasurement(enabled);
} }
void AudioReceiveStream::SetFrameDecryptor( void AudioReceiveStreamImpl::SetFrameDecryptor(
rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) { rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) {
// TODO(bugs.webrtc.org/11993): This is called via WebRtcAudioReceiveStream, // TODO(bugs.webrtc.org/11993): This is called via WebRtcAudioReceiveStream,
// expect to be called on the network thread. // expect to be called on the network thread.
@ -261,7 +261,7 @@ void AudioReceiveStream::SetFrameDecryptor(
channel_receive_->SetFrameDecryptor(std::move(frame_decryptor)); channel_receive_->SetFrameDecryptor(std::move(frame_decryptor));
} }
void AudioReceiveStream::SetRtpExtensions( void AudioReceiveStreamImpl::SetRtpExtensions(
std::vector<RtpExtension> extensions) { std::vector<RtpExtension> extensions) {
// TODO(bugs.webrtc.org/11993): This is called via WebRtcAudioReceiveStream, // TODO(bugs.webrtc.org/11993): This is called via WebRtcAudioReceiveStream,
// expect to be called on the network thread. // expect to be called on the network thread.
@ -269,16 +269,17 @@ void AudioReceiveStream::SetRtpExtensions(
config_.rtp.extensions = std::move(extensions); config_.rtp.extensions = std::move(extensions);
} }
const std::vector<RtpExtension>& AudioReceiveStream::GetRtpExtensions() const { const std::vector<RtpExtension>& AudioReceiveStreamImpl::GetRtpExtensions()
const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return config_.rtp.extensions; return config_.rtp.extensions;
} }
RtpHeaderExtensionMap AudioReceiveStream::GetRtpExtensionMap() const { RtpHeaderExtensionMap AudioReceiveStreamImpl::GetRtpExtensionMap() const {
return RtpHeaderExtensionMap(config_.rtp.extensions); return RtpHeaderExtensionMap(config_.rtp.extensions);
} }
webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats( webrtc::AudioReceiveStream::Stats AudioReceiveStreamImpl::GetStats(
bool get_and_clear_legacy_stats) const { bool get_and_clear_legacy_stats) const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
webrtc::AudioReceiveStream::Stats stats; webrtc::AudioReceiveStream::Stats stats;
@ -374,33 +375,33 @@ webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats(
return stats; return stats;
} }
void AudioReceiveStream::SetSink(AudioSinkInterface* sink) { void AudioReceiveStreamImpl::SetSink(AudioSinkInterface* sink) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_receive_->SetSink(sink); channel_receive_->SetSink(sink);
} }
void AudioReceiveStream::SetGain(float gain) { void AudioReceiveStreamImpl::SetGain(float gain) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
channel_receive_->SetChannelOutputVolumeScaling(gain); channel_receive_->SetChannelOutputVolumeScaling(gain);
} }
bool AudioReceiveStream::SetBaseMinimumPlayoutDelayMs(int delay_ms) { bool AudioReceiveStreamImpl::SetBaseMinimumPlayoutDelayMs(int delay_ms) {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return channel_receive_->SetBaseMinimumPlayoutDelayMs(delay_ms); return channel_receive_->SetBaseMinimumPlayoutDelayMs(delay_ms);
} }
int AudioReceiveStream::GetBaseMinimumPlayoutDelayMs() const { int AudioReceiveStreamImpl::GetBaseMinimumPlayoutDelayMs() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return channel_receive_->GetBaseMinimumPlayoutDelayMs(); return channel_receive_->GetBaseMinimumPlayoutDelayMs();
} }
std::vector<RtpSource> AudioReceiveStream::GetSources() const { std::vector<RtpSource> AudioReceiveStreamImpl::GetSources() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return source_tracker_.GetSources(); return source_tracker_.GetSources();
} }
AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo( AudioMixer::Source::AudioFrameInfo
int sample_rate_hz, AudioReceiveStreamImpl::GetAudioFrameWithInfo(int sample_rate_hz,
AudioFrame* audio_frame) { AudioFrame* audio_frame) {
AudioMixer::Source::AudioFrameInfo audio_frame_info = AudioMixer::Source::AudioFrameInfo audio_frame_info =
channel_receive_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); channel_receive_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame);
@ -410,33 +411,33 @@ AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo(
return audio_frame_info; return audio_frame_info;
} }
int AudioReceiveStream::Ssrc() const { int AudioReceiveStreamImpl::Ssrc() const {
return remote_ssrc(); return remote_ssrc();
} }
int AudioReceiveStream::PreferredSampleRate() const { int AudioReceiveStreamImpl::PreferredSampleRate() const {
return channel_receive_->PreferredSampleRate(); return channel_receive_->PreferredSampleRate();
} }
uint32_t AudioReceiveStream::id() const { uint32_t AudioReceiveStreamImpl::id() const {
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return remote_ssrc(); return remote_ssrc();
} }
absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const { absl::optional<Syncable::Info> AudioReceiveStreamImpl::GetInfo() const {
// TODO(bugs.webrtc.org/11993): This is called via RtpStreamsSynchronizer, // TODO(bugs.webrtc.org/11993): This is called via RtpStreamsSynchronizer,
// expect to be called on the network thread. // expect to be called on the network thread.
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return channel_receive_->GetSyncInfo(); return channel_receive_->GetSyncInfo();
} }
bool AudioReceiveStream::GetPlayoutRtpTimestamp(uint32_t* rtp_timestamp, bool AudioReceiveStreamImpl::GetPlayoutRtpTimestamp(uint32_t* rtp_timestamp,
int64_t* time_ms) const { int64_t* time_ms) const {
// Called on video capture thread. // Called on video capture thread.
return channel_receive_->GetPlayoutRtpTimestamp(rtp_timestamp, time_ms); return channel_receive_->GetPlayoutRtpTimestamp(rtp_timestamp, time_ms);
} }
void AudioReceiveStream::SetEstimatedPlayoutNtpTimestampMs( void AudioReceiveStreamImpl::SetEstimatedPlayoutNtpTimestampMs(
int64_t ntp_timestamp_ms, int64_t ntp_timestamp_ms,
int64_t time_ms) { int64_t time_ms) {
// Called on video capture thread. // Called on video capture thread.
@ -444,21 +445,22 @@ void AudioReceiveStream::SetEstimatedPlayoutNtpTimestampMs(
time_ms); time_ms);
} }
bool AudioReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { bool AudioReceiveStreamImpl::SetMinimumPlayoutDelay(int delay_ms) {
// TODO(bugs.webrtc.org/11993): This is called via RtpStreamsSynchronizer, // TODO(bugs.webrtc.org/11993): This is called via RtpStreamsSynchronizer,
// expect to be called on the network thread. // expect to be called on the network thread.
RTC_DCHECK_RUN_ON(&worker_thread_checker_); RTC_DCHECK_RUN_ON(&worker_thread_checker_);
return channel_receive_->SetMinimumPlayoutDelay(delay_ms); return channel_receive_->SetMinimumPlayoutDelay(delay_ms);
} }
void AudioReceiveStream::AssociateSendStream(AudioSendStream* send_stream) { void AudioReceiveStreamImpl::AssociateSendStream(
internal::AudioSendStream* send_stream) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
channel_receive_->SetAssociatedSendChannel( channel_receive_->SetAssociatedSendChannel(
send_stream ? send_stream->GetChannel() : nullptr); send_stream ? send_stream->GetChannel() : nullptr);
associated_send_stream_ = send_stream; associated_send_stream_ = send_stream;
} }
void AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { void AudioReceiveStreamImpl::DeliverRtcp(const uint8_t* packet, size_t length) {
// TODO(solenberg): Tests call this function on a network thread, libjingle // TODO(solenberg): Tests call this function on a network thread, libjingle
// calls on the worker thread. We should move towards always using a network // calls on the worker thread. We should move towards always using a network
// thread. Then this check can be enabled. // thread. Then this check can be enabled.
@ -466,39 +468,38 @@ void AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
channel_receive_->ReceivedRTCPPacket(packet, length); channel_receive_->ReceivedRTCPPacket(packet, length);
} }
void AudioReceiveStream::SetSyncGroup(absl::string_view sync_group) { void AudioReceiveStreamImpl::SetSyncGroup(absl::string_view sync_group) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
config_.sync_group = std::string(sync_group); config_.sync_group = std::string(sync_group);
} }
void AudioReceiveStream::SetLocalSsrc(uint32_t local_ssrc) { void AudioReceiveStreamImpl::SetLocalSsrc(uint32_t local_ssrc) {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
// TODO(tommi): Consider storing local_ssrc in one place. // TODO(tommi): Consider storing local_ssrc in one place.
config_.rtp.local_ssrc = local_ssrc; config_.rtp.local_ssrc = local_ssrc;
channel_receive_->OnLocalSsrcChange(local_ssrc); channel_receive_->OnLocalSsrcChange(local_ssrc);
} }
uint32_t AudioReceiveStream::local_ssrc() const { uint32_t AudioReceiveStreamImpl::local_ssrc() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
RTC_DCHECK_EQ(config_.rtp.local_ssrc, channel_receive_->GetLocalSsrc()); RTC_DCHECK_EQ(config_.rtp.local_ssrc, channel_receive_->GetLocalSsrc());
return config_.rtp.local_ssrc; return config_.rtp.local_ssrc;
} }
const std::string& AudioReceiveStream::sync_group() const { const std::string& AudioReceiveStreamImpl::sync_group() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
return config_.sync_group; return config_.sync_group;
} }
const AudioSendStream* AudioReceiveStream::GetAssociatedSendStreamForTesting() const AudioSendStream*
const { AudioReceiveStreamImpl::GetAssociatedSendStreamForTesting() const {
RTC_DCHECK_RUN_ON(&packet_sequence_checker_); RTC_DCHECK_RUN_ON(&packet_sequence_checker_);
return associated_send_stream_; return associated_send_stream_;
} }
internal::AudioState* AudioReceiveStream::audio_state() const { internal::AudioState* AudioReceiveStreamImpl::audio_state() const {
auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get());
RTC_DCHECK(audio_state); RTC_DCHECK(audio_state);
return audio_state; return audio_state;
} }
} // namespace internal
} // namespace webrtc } // namespace webrtc

View File

@ -40,19 +40,21 @@ class ChannelReceiveInterface;
namespace internal { namespace internal {
class AudioSendStream; class AudioSendStream;
} // namespace internal
class AudioReceiveStream final : public webrtc::AudioReceiveStream, class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStream,
public AudioMixer::Source, public AudioMixer::Source,
public Syncable { public Syncable {
public: public:
AudioReceiveStream(Clock* clock, AudioReceiveStreamImpl(
Clock* clock,
PacketRouter* packet_router, PacketRouter* packet_router,
NetEqFactory* neteq_factory, NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config, const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state, const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log); webrtc::RtcEventLog* event_log);
// For unit tests, which need to supply a mock channel receive. // For unit tests, which need to supply a mock channel receive.
AudioReceiveStream( AudioReceiveStreamImpl(
Clock* clock, Clock* clock,
PacketRouter* packet_router, PacketRouter* packet_router,
const webrtc::AudioReceiveStream::Config& config, const webrtc::AudioReceiveStream::Config& config,
@ -60,16 +62,16 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
webrtc::RtcEventLog* event_log, webrtc::RtcEventLog* event_log,
std::unique_ptr<voe::ChannelReceiveInterface> channel_receive); std::unique_ptr<voe::ChannelReceiveInterface> channel_receive);
AudioReceiveStream() = delete; AudioReceiveStreamImpl() = delete;
AudioReceiveStream(const AudioReceiveStream&) = delete; AudioReceiveStreamImpl(const AudioReceiveStreamImpl&) = delete;
AudioReceiveStream& operator=(const AudioReceiveStream&) = delete; AudioReceiveStreamImpl& operator=(const AudioReceiveStreamImpl&) = delete;
// Destruction happens on the worker thread. Prior to destruction the caller // Destruction happens on the worker thread. Prior to destruction the caller
// must ensure that a registration with the transport has been cleared. See // must ensure that a registration with the transport has been cleared. See
// `RegisterWithTransport` for details. // `RegisterWithTransport` for details.
// TODO(tommi): As a further improvement to this, performing the full // TODO(tommi): As a further improvement to this, performing the full
// destruction on the network thread could be made the default. // destruction on the network thread could be made the default.
~AudioReceiveStream() override; ~AudioReceiveStreamImpl() override;
// Called on the network thread to register/unregister with the network // Called on the network thread to register/unregister with the network
// transport. // transport.
@ -121,7 +123,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
int64_t time_ms) override; int64_t time_ms) override;
bool SetMinimumPlayoutDelay(int delay_ms) override; bool SetMinimumPlayoutDelay(int delay_ms) override;
void AssociateSendStream(AudioSendStream* send_stream); void AssociateSendStream(internal::AudioSendStream* send_stream);
void DeliverRtcp(const uint8_t* packet, size_t length); void DeliverRtcp(const uint8_t* packet, size_t length);
void SetSyncGroup(absl::string_view sync_group); void SetSyncGroup(absl::string_view sync_group);
@ -146,7 +148,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
void ReconfigureForTesting(const webrtc::AudioReceiveStream::Config& config); void ReconfigureForTesting(const webrtc::AudioReceiveStream::Config& config);
private: private:
AudioState* audio_state() const; internal::AudioState* audio_state() const;
RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_; RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
// TODO(bugs.webrtc.org/11993): This checker conceptually represents // TODO(bugs.webrtc.org/11993): This checker conceptually represents
@ -169,7 +171,6 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_ std::unique_ptr<RtpStreamReceiverInterface> rtp_stream_receiver_
RTC_GUARDED_BY(packet_sequence_checker_); RTC_GUARDED_BY(packet_sequence_checker_);
}; };
} // namespace internal
} // namespace webrtc } // namespace webrtc
#endif // AUDIO_AUDIO_RECEIVE_STREAM_H_ #endif // AUDIO_AUDIO_RECEIVE_STREAM_H_

View File

@ -146,8 +146,8 @@ struct ConfigHelper {
rtc::make_ref_counted<MockAudioDecoderFactory>(); rtc::make_ref_counted<MockAudioDecoderFactory>();
} }
std::unique_ptr<internal::AudioReceiveStream> CreateAudioReceiveStream() { std::unique_ptr<AudioReceiveStreamImpl> CreateAudioReceiveStream() {
auto ret = std::make_unique<internal::AudioReceiveStream>( auto ret = std::make_unique<AudioReceiveStreamImpl>(
Clock::GetRealTimeClock(), &packet_router_, stream_config_, Clock::GetRealTimeClock(), &packet_router_, stream_config_,
audio_state_, &event_log_, audio_state_, &event_log_,
std::unique_ptr<voe::ChannelReceiveInterface>(channel_receive_)); std::unique_ptr<voe::ChannelReceiveInterface>(channel_receive_));

View File

@ -55,7 +55,7 @@ void AudioState::AddReceivingStream(webrtc::AudioReceiveStream* stream) {
RTC_DCHECK_EQ(0, receiving_streams_.count(stream)); RTC_DCHECK_EQ(0, receiving_streams_.count(stream));
receiving_streams_.insert(stream); receiving_streams_.insert(stream);
if (!config_.audio_mixer->AddSource( if (!config_.audio_mixer->AddSource(
static_cast<internal::AudioReceiveStream*>(stream))) { static_cast<AudioReceiveStreamImpl*>(stream))) {
RTC_DLOG(LS_ERROR) << "Failed to add source to mixer."; RTC_DLOG(LS_ERROR) << "Failed to add source to mixer.";
} }
@ -78,7 +78,7 @@ void AudioState::RemoveReceivingStream(webrtc::AudioReceiveStream* stream) {
auto count = receiving_streams_.erase(stream); auto count = receiving_streams_.erase(stream);
RTC_DCHECK_EQ(1, count); RTC_DCHECK_EQ(1, count);
config_.audio_mixer->RemoveSource( config_.audio_mixer->RemoveSource(
static_cast<internal::AudioReceiveStream*>(stream)); static_cast<AudioReceiveStreamImpl*>(stream));
UpdateNullAudioPollerState(); UpdateNullAudioPollerState();
if (receiving_streams_.empty()) { if (receiving_streams_.empty()) {
config_.audio_device_module->StopPlayout(); config_.audio_device_module->StopPlayout();

View File

@ -350,8 +350,8 @@ class Call final : public webrtc::Call,
rtc::CopyOnWriteBuffer packet, rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) RTC_RUN_ON(worker_thread_); int64_t packet_time_us) RTC_RUN_ON(worker_thread_);
AudioReceiveStream* FindAudioStreamForSyncGroup(absl::string_view sync_group) AudioReceiveStreamImpl* FindAudioStreamForSyncGroup(
RTC_RUN_ON(worker_thread_); absl::string_view sync_group) RTC_RUN_ON(worker_thread_);
void ConfigureSync(absl::string_view sync_group) RTC_RUN_ON(worker_thread_); void ConfigureSync(absl::string_view sync_group) RTC_RUN_ON(worker_thread_);
void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet, void NotifyBweOfReceivedPacket(const RtpPacketReceived& packet,
@ -398,7 +398,7 @@ class Call final : public webrtc::Call,
// creates them. // creates them.
// TODO(bugs.webrtc.org/11993): Move audio_receive_streams_, // TODO(bugs.webrtc.org/11993): Move audio_receive_streams_,
// video_receive_streams_ over to the network thread. // video_receive_streams_ over to the network thread.
std::set<AudioReceiveStream*> audio_receive_streams_ std::set<AudioReceiveStreamImpl*> audio_receive_streams_
RTC_GUARDED_BY(worker_thread_); RTC_GUARDED_BY(worker_thread_);
std::set<VideoReceiveStream2*> video_receive_streams_ std::set<VideoReceiveStream2*> video_receive_streams_
RTC_GUARDED_BY(worker_thread_); RTC_GUARDED_BY(worker_thread_);
@ -927,7 +927,7 @@ webrtc::AudioSendStream* Call::CreateAudioSendStream(
// TODO(bugs.webrtc.org/11993): call AssociateSendStream and // TODO(bugs.webrtc.org/11993): call AssociateSendStream and
// UpdateAggregateNetworkState asynchronously on the network thread. // UpdateAggregateNetworkState asynchronously on the network thread.
for (AudioReceiveStream* stream : audio_receive_streams_) { for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
if (stream->local_ssrc() == config.rtp.ssrc) { if (stream->local_ssrc() == config.rtp.ssrc) {
stream->AssociateSendStream(send_stream); stream->AssociateSendStream(send_stream);
} }
@ -955,7 +955,7 @@ void Call::DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) {
// TODO(bugs.webrtc.org/11993): call AssociateSendStream and // TODO(bugs.webrtc.org/11993): call AssociateSendStream and
// UpdateAggregateNetworkState asynchronously on the network thread. // UpdateAggregateNetworkState asynchronously on the network thread.
for (AudioReceiveStream* stream : audio_receive_streams_) { for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
if (stream->local_ssrc() == ssrc) { if (stream->local_ssrc() == ssrc) {
stream->AssociateSendStream(nullptr); stream->AssociateSendStream(nullptr);
} }
@ -974,7 +974,7 @@ webrtc::AudioReceiveStream* Call::CreateAudioReceiveStream(
event_log_->Log(std::make_unique<RtcEventAudioReceiveStreamConfig>( event_log_->Log(std::make_unique<RtcEventAudioReceiveStreamConfig>(
CreateRtcLogStreamConfig(config))); CreateRtcLogStreamConfig(config)));
AudioReceiveStream* receive_stream = new AudioReceiveStream( AudioReceiveStreamImpl* receive_stream = new AudioReceiveStreamImpl(
clock_, transport_send_->packet_router(), config_.neteq_factory, config, clock_, transport_send_->packet_router(), config_.neteq_factory, config,
config_.audio_state, event_log_); config_.audio_state, event_log_);
audio_receive_streams_.insert(receive_stream); audio_receive_streams_.insert(receive_stream);
@ -1005,8 +1005,8 @@ void Call::DestroyAudioReceiveStream(
TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream"); TRACE_EVENT0("webrtc", "Call::DestroyAudioReceiveStream");
RTC_DCHECK_RUN_ON(worker_thread_); RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(receive_stream != nullptr); RTC_DCHECK(receive_stream != nullptr);
webrtc::internal::AudioReceiveStream* audio_receive_stream = webrtc::AudioReceiveStreamImpl* audio_receive_stream =
static_cast<webrtc::internal::AudioReceiveStream*>(receive_stream); static_cast<webrtc::AudioReceiveStreamImpl*>(receive_stream);
// TODO(bugs.webrtc.org/11993): Access the map, rtp config, call ConfigureSync // TODO(bugs.webrtc.org/11993): Access the map, rtp config, call ConfigureSync
// and UpdateAggregateNetworkState on the network thread. The call to // and UpdateAggregateNetworkState on the network thread. The call to
@ -1383,8 +1383,8 @@ void Call::UpdateAggregateNetworkState() {
void Call::OnLocalSsrcUpdated(webrtc::AudioReceiveStream& stream, void Call::OnLocalSsrcUpdated(webrtc::AudioReceiveStream& stream,
uint32_t local_ssrc) { uint32_t local_ssrc) {
RTC_DCHECK_RUN_ON(worker_thread_); RTC_DCHECK_RUN_ON(worker_thread_);
webrtc::internal::AudioReceiveStream& receive_stream = webrtc::AudioReceiveStreamImpl& receive_stream =
static_cast<webrtc::internal::AudioReceiveStream&>(stream); static_cast<webrtc::AudioReceiveStreamImpl&>(stream);
receive_stream.SetLocalSsrc(local_ssrc); receive_stream.SetLocalSsrc(local_ssrc);
auto it = audio_send_ssrcs_.find(local_ssrc); auto it = audio_send_ssrcs_.find(local_ssrc);
@ -1407,8 +1407,8 @@ void Call::OnLocalSsrcUpdated(FlexfecReceiveStream& stream,
void Call::OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream, void Call::OnUpdateSyncGroup(webrtc::AudioReceiveStream& stream,
absl::string_view sync_group) { absl::string_view sync_group) {
RTC_DCHECK_RUN_ON(worker_thread_); RTC_DCHECK_RUN_ON(worker_thread_);
webrtc::internal::AudioReceiveStream& receive_stream = webrtc::AudioReceiveStreamImpl& receive_stream =
static_cast<webrtc::internal::AudioReceiveStream&>(stream); static_cast<webrtc::AudioReceiveStreamImpl&>(stream);
receive_stream.SetSyncGroup(sync_group); receive_stream.SetSyncGroup(sync_group);
ConfigureSync(sync_group); ConfigureSync(sync_group);
} }
@ -1477,11 +1477,11 @@ void Call::OnAllocationLimitsChanged(BitrateAllocationLimits limits) {
} }
// RTC_RUN_ON(worker_thread_) // RTC_RUN_ON(worker_thread_)
AudioReceiveStream* Call::FindAudioStreamForSyncGroup( AudioReceiveStreamImpl* Call::FindAudioStreamForSyncGroup(
absl::string_view sync_group) { absl::string_view sync_group) {
RTC_DCHECK_RUN_ON(&receive_11993_checker_); RTC_DCHECK_RUN_ON(&receive_11993_checker_);
if (!sync_group.empty()) { if (!sync_group.empty()) {
for (AudioReceiveStream* stream : audio_receive_streams_) { for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
if (stream->sync_group() == sync_group) if (stream->sync_group() == sync_group)
return stream; return stream;
} }
@ -1494,7 +1494,8 @@ AudioReceiveStream* Call::FindAudioStreamForSyncGroup(
// RTC_RUN_ON(worker_thread_) // RTC_RUN_ON(worker_thread_)
void Call::ConfigureSync(absl::string_view sync_group) { void Call::ConfigureSync(absl::string_view sync_group) {
// `audio_stream` may be nullptr when clearing the audio stream for a group. // `audio_stream` may be nullptr when clearing the audio stream for a group.
AudioReceiveStream* audio_stream = FindAudioStreamForSyncGroup(sync_group); AudioReceiveStreamImpl* audio_stream =
FindAudioStreamForSyncGroup(sync_group);
size_t num_synced_streams = 0; size_t num_synced_streams = 0;
for (VideoReceiveStream2* video_stream : video_receive_streams_) { for (VideoReceiveStream2* video_stream : video_receive_streams_) {
@ -1543,7 +1544,7 @@ void Call::DeliverRtcp(MediaType media_type, rtc::CopyOnWriteBuffer packet) {
rtcp_delivered = true; rtcp_delivered = true;
} }
for (AudioReceiveStream* stream : audio_receive_streams_) { for (AudioReceiveStreamImpl* stream : audio_receive_streams_) {
stream->DeliverRtcp(packet.cdata(), packet.size()); stream->DeliverRtcp(packet.cdata(), packet.size());
rtcp_delivered = true; rtcp_delivered = true;
} }

View File

@ -199,8 +199,8 @@ TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_RecvFirst) {
AudioSendStream* send_stream = call->CreateAudioSendStream(send_config); AudioSendStream* send_stream = call->CreateAudioSendStream(send_config);
EXPECT_NE(send_stream, nullptr); EXPECT_NE(send_stream, nullptr);
internal::AudioReceiveStream* internal_recv_stream = AudioReceiveStreamImpl* internal_recv_stream =
static_cast<internal::AudioReceiveStream*>(recv_stream); static_cast<AudioReceiveStreamImpl*>(recv_stream);
EXPECT_EQ(send_stream, EXPECT_EQ(send_stream,
internal_recv_stream->GetAssociatedSendStreamForTesting()); internal_recv_stream->GetAssociatedSendStreamForTesting());
@ -232,8 +232,8 @@ TEST(CallTest, CreateDestroy_AssociateAudioSendReceiveStreams_SendFirst) {
call->CreateAudioReceiveStream(recv_config); call->CreateAudioReceiveStream(recv_config);
EXPECT_NE(recv_stream, nullptr); EXPECT_NE(recv_stream, nullptr);
internal::AudioReceiveStream* internal_recv_stream = AudioReceiveStreamImpl* internal_recv_stream =
static_cast<internal::AudioReceiveStream*>(recv_stream); static_cast<AudioReceiveStreamImpl*>(recv_stream);
EXPECT_EQ(send_stream, EXPECT_EQ(send_stream,
internal_recv_stream->GetAssociatedSendStreamForTesting()); internal_recv_stream->GetAssociatedSendStreamForTesting());