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

View File

@ -40,19 +40,21 @@ class ChannelReceiveInterface;
namespace internal {
class AudioSendStream;
} // namespace internal
class AudioReceiveStream final : public webrtc::AudioReceiveStream,
public AudioMixer::Source,
public Syncable {
class AudioReceiveStreamImpl final : public webrtc::AudioReceiveStream,
public AudioMixer::Source,
public Syncable {
public:
AudioReceiveStream(Clock* clock,
PacketRouter* packet_router,
NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log);
AudioReceiveStreamImpl(
Clock* clock,
PacketRouter* packet_router,
NetEqFactory* neteq_factory,
const webrtc::AudioReceiveStream::Config& config,
const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
webrtc::RtcEventLog* event_log);
// For unit tests, which need to supply a mock channel receive.
AudioReceiveStream(
AudioReceiveStreamImpl(
Clock* clock,
PacketRouter* packet_router,
const webrtc::AudioReceiveStream::Config& config,
@ -60,16 +62,16 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
webrtc::RtcEventLog* event_log,
std::unique_ptr<voe::ChannelReceiveInterface> channel_receive);
AudioReceiveStream() = delete;
AudioReceiveStream(const AudioReceiveStream&) = delete;
AudioReceiveStream& operator=(const AudioReceiveStream&) = delete;
AudioReceiveStreamImpl() = delete;
AudioReceiveStreamImpl(const AudioReceiveStreamImpl&) = delete;
AudioReceiveStreamImpl& operator=(const AudioReceiveStreamImpl&) = delete;
// Destruction happens on the worker thread. Prior to destruction the caller
// must ensure that a registration with the transport has been cleared. See
// `RegisterWithTransport` for details.
// TODO(tommi): As a further improvement to this, performing the full
// 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
// transport.
@ -121,7 +123,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
int64_t time_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 SetSyncGroup(absl::string_view sync_group);
@ -146,7 +148,7 @@ class AudioReceiveStream final : public webrtc::AudioReceiveStream,
void ReconfigureForTesting(const webrtc::AudioReceiveStream::Config& config);
private:
AudioState* audio_state() const;
internal::AudioState* audio_state() const;
RTC_NO_UNIQUE_ADDRESS SequenceChecker worker_thread_checker_;
// 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_
RTC_GUARDED_BY(packet_sequence_checker_);
};
} // namespace internal
} // namespace webrtc
#endif // AUDIO_AUDIO_RECEIVE_STREAM_H_

View File

@ -146,8 +146,8 @@ struct ConfigHelper {
rtc::make_ref_counted<MockAudioDecoderFactory>();
}
std::unique_ptr<internal::AudioReceiveStream> CreateAudioReceiveStream() {
auto ret = std::make_unique<internal::AudioReceiveStream>(
std::unique_ptr<AudioReceiveStreamImpl> CreateAudioReceiveStream() {
auto ret = std::make_unique<AudioReceiveStreamImpl>(
Clock::GetRealTimeClock(), &packet_router_, stream_config_,
audio_state_, &event_log_,
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));
receiving_streams_.insert(stream);
if (!config_.audio_mixer->AddSource(
static_cast<internal::AudioReceiveStream*>(stream))) {
static_cast<AudioReceiveStreamImpl*>(stream))) {
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);
RTC_DCHECK_EQ(1, count);
config_.audio_mixer->RemoveSource(
static_cast<internal::AudioReceiveStream*>(stream));
static_cast<AudioReceiveStreamImpl*>(stream));
UpdateNullAudioPollerState();
if (receiving_streams_.empty()) {
config_.audio_device_module->StopPlayout();

View File

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

View File

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