Split MediaChannel class to sender and receiver

This allows callers to differentiate on whether they need the
channel for sending or receiving purposes.

Note: This CL is incomplete, in that many places cast the pointers
to the concrete subclasses "VideoMediaChannel" and "AudioMediaChannel", which are not split into sending and receiving APIs.

The long term goal is to make two MediaChannel-like class APIs, with distinct implementations, and let the RtpSender and RtpReceiver manage those objects, rather than keeping them in the RtpTransceiver.

Bug: webrtc:13931
Change-Id: I8d56defe2287bd6552b71571cc6a5ec842927fa4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/287040
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38844}
This commit is contained in:
Harald Alvestrand 2022-12-08 08:47:42 +00:00 committed by WebRTC LUCI CQ
parent 01cac31d58
commit 36fafc8827
21 changed files with 377 additions and 259 deletions

View File

@ -162,29 +162,15 @@ struct VideoOptions {
}
};
class MediaChannel {
class MediaBaseChannelInterface {
public:
class NetworkInterface {
public:
enum SocketType { ST_RTP, ST_RTCP };
virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options) = 0;
virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options) = 0;
virtual int SetOption(SocketType type,
rtc::Socket::Option opt,
int option) = 0;
virtual ~NetworkInterface() {}
};
explicit MediaChannel(webrtc::TaskQueueBase* network_thread,
bool enable_dscp = false);
virtual ~MediaChannel();
virtual ~MediaBaseChannelInterface() = default;
virtual cricket::MediaType media_type() const = 0;
// Sets the abstract interface class for sending RTP/RTCP data.
virtual void SetInterface(NetworkInterface* iface);
// Networking functions. We assume that both the send channel and the
// receive channel send RTP packets (RTCP packets in the case of a receive
// channel).
// Called on the network when an RTP packet is received.
virtual void OnPacketReceived(rtc::CopyOnWriteBuffer packet,
int64_t packet_time_us) = 0;
@ -197,6 +183,13 @@ class MediaChannel {
virtual void OnNetworkRouteChanged(
absl::string_view transport_name,
const rtc::NetworkRoute& network_route) = 0;
};
class MediaSendChannelInterface : virtual public MediaBaseChannelInterface {
public:
virtual ~MediaSendChannelInterface() = default;
virtual cricket::MediaType media_type() const = 0;
// Creates a new outgoing media stream with SSRCs and CNAME as described
// by sp.
virtual bool AddSendStream(const StreamParams& sp) = 0;
@ -205,6 +198,36 @@ class MediaChannel {
// multiple SSRCs. In the case of an ssrc of 0, the possibly cached
// StreamParams is removed.
virtual bool RemoveSendStream(uint32_t ssrc) = 0;
// Set the frame encryptor to use on all outgoing frames. This is optional.
// This pointers lifetime is managed by the set of RtpSender it is attached
// to.
virtual void SetFrameEncryptor(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor) = 0;
virtual webrtc::RTCError SetRtpSendParameters(
uint32_t ssrc,
const webrtc::RtpParameters& parameters,
webrtc::SetParametersCallback callback = nullptr) = 0;
virtual void SetEncoderToPacketizerFrameTransformer(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameTransformerInterface>
frame_transformer) = 0;
// note: The encoder_selector object must remain valid for the lifetime of the
// MediaChannel, unless replaced.
virtual void SetEncoderSelector(
uint32_t ssrc,
webrtc::VideoEncoderFactory::EncoderSelectorInterface* encoder_selector) {
}
virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0;
};
class MediaReceiveChannelInterface : virtual public MediaBaseChannelInterface {
public:
virtual ~MediaReceiveChannelInterface() = default;
// Creates a new incoming media stream with SSRCs, CNAME as described
// by sp. In the case of a sp without SSRCs, the unsignaled sp is cached
// to be used later for unsignaled streams received.
@ -230,33 +253,46 @@ class MediaChannel {
// new unsignalled ssrcs.
virtual void OnDemuxerCriteriaUpdatePending() = 0;
virtual void OnDemuxerCriteriaUpdateComplete() = 0;
// Returns the absoulte sendtime extension id value from media channel.
virtual int GetRtpSendTimeExtnId() const;
// Set the frame encryptor to use on all outgoing frames. This is optional.
// This pointers lifetime is managed by the set of RtpSender it is attached
// to.
// TODO(benwright) make pure virtual once internal supports it.
virtual void SetFrameEncryptor(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameEncryptorInterface> frame_encryptor);
// Set the frame decryptor to use on all incoming frames. This is optional.
// This pointers lifetimes is managed by the set of RtpReceivers it is
// attached to.
// TODO(benwright) make pure virtual once internal supports it.
virtual void SetFrameDecryptor(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor);
rtc::scoped_refptr<webrtc::FrameDecryptorInterface> frame_decryptor) = 0;
virtual void SetDepacketizerToDecoderFrameTransformer(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameTransformerInterface>
frame_transformer) = 0;
};
class MediaChannel : public MediaSendChannelInterface,
public MediaReceiveChannelInterface {
public:
class NetworkInterface {
public:
enum SocketType { ST_RTP, ST_RTCP };
virtual bool SendPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options) = 0;
virtual bool SendRtcp(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options) = 0;
virtual int SetOption(SocketType type,
rtc::Socket::Option opt,
int option) = 0;
virtual ~NetworkInterface() {}
};
explicit MediaChannel(webrtc::TaskQueueBase* network_thread,
bool enable_dscp = false);
virtual ~MediaChannel();
// Sets the abstract interface class for sending RTP/RTCP data.
virtual void SetInterface(NetworkInterface* iface);
// Returns the absolute sendtime extension id value from media channel.
virtual int GetRtpSendTimeExtnId() const;
// Enable network condition based codec switching.
virtual void SetVideoCodecSwitchingEnabled(bool enabled);
// note: The encoder_selector object must remain valid for the lifetime of the
// MediaChannel, unless replaced.
virtual void SetEncoderSelector(
uint32_t ssrc,
webrtc::VideoEncoderFactory::EncoderSelectorInterface* encoder_selector) {
}
// Base method to send packet using NetworkInterface.
bool SendPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options);
@ -279,18 +315,21 @@ class MediaChannel {
// Must be called on the network thread.
bool HasNetworkInterface() const;
virtual webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const = 0;
virtual webrtc::RTCError SetRtpSendParameters(
uint32_t ssrc,
const webrtc::RtpParameters& parameters,
webrtc::SetParametersCallback callback = nullptr) = 0;
void SetFrameEncryptor(uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameEncryptorInterface>
frame_encryptor) override;
void SetFrameDecryptor(uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameDecryptorInterface>
frame_decryptor) override;
virtual void SetEncoderToPacketizerFrameTransformer(
void SetEncoderToPacketizerFrameTransformer(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer);
virtual void SetDepacketizerToDecoderFrameTransformer(
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer)
override;
void SetDepacketizerToDecoderFrameTransformer(
uint32_t ssrc,
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer);
rtc::scoped_refptr<webrtc::FrameTransformerInterface> frame_transformer)
override;
protected:
int SetOptionLocked(NetworkInterface::SocketType type,

View File

@ -314,7 +314,8 @@ void AudioRtpReceiver::SetJitterBufferMinimumDelay(
media_channel_->SetBaseMinimumPlayoutDelayMs(*ssrc_, delay_.GetMs());
}
void AudioRtpReceiver::SetMediaChannel(cricket::MediaChannel* media_channel) {
void AudioRtpReceiver::SetMediaChannel(
cricket::MediaReceiveChannelInterface* media_channel) {
RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(media_channel == nullptr ||
media_channel->media_type() == media_type());

View File

@ -111,7 +111,8 @@ class AudioRtpReceiver : public ObserverInterface,
void SetJitterBufferMinimumDelay(
absl::optional<double> delay_seconds) override;
void SetMediaChannel(cricket::MediaChannel* media_channel) override;
void SetMediaChannel(
cricket::MediaReceiveChannelInterface* media_channel) override;
std::vector<RtpSource> GetSources() const override;
int AttachmentId() const override { return attachment_id_; }

View File

@ -154,7 +154,7 @@ std::string BaseChannel::ToString() const {
bool BaseChannel::ConnectToRtpTransport_n() {
RTC_DCHECK(rtp_transport_);
RTC_DCHECK(media_channel());
RTC_DCHECK(media_send_channel());
// We don't need to call OnDemuxerCriteriaUpdatePending/Complete because
// there's no previous criteria to worry about.
@ -174,7 +174,7 @@ bool BaseChannel::ConnectToRtpTransport_n() {
void BaseChannel::DisconnectFromRtpTransport_n() {
RTC_DCHECK(rtp_transport_);
RTC_DCHECK(media_channel());
RTC_DCHECK(media_send_channel());
rtp_transport_->UnregisterRtpDemuxerSink(this);
rtp_transport_->SignalReadyToSend.disconnect(this);
rtp_transport_->SignalNetworkRouteChanged.disconnect(this);
@ -458,7 +458,7 @@ bool BaseChannel::MaybeUpdateDemuxerAndRtpExtensions_w(
// TODO(bugs.webrtc.org/13536): See if we can do this asynchronously.
if (update_demuxer)
media_channel()->OnDemuxerCriteriaUpdatePending();
media_receive_channel()->OnDemuxerCriteriaUpdatePending();
bool success = network_thread()->BlockingCall([&]() mutable {
RTC_DCHECK_RUN_ON(network_thread());
@ -481,7 +481,7 @@ bool BaseChannel::MaybeUpdateDemuxerAndRtpExtensions_w(
});
if (update_demuxer)
media_channel()->OnDemuxerCriteriaUpdateComplete();
media_receive_channel()->OnDemuxerCriteriaUpdateComplete();
return success;
}
@ -584,7 +584,7 @@ bool BaseChannel::SetPayloadTypeDemuxingEnabled_w(bool enabled) {
// were matched to this channel by MID or RID. Ideally we'd remove only the
// streams that were matched based on payload type alone, but currently
// there is no straightforward way to identify those streams.
media_channel()->ResetUnsignaledRecvStream();
media_receive_channel()->ResetUnsignaledRecvStream();
if (!demuxer_criteria_.payload_types().empty()) {
config_changed = true;
demuxer_criteria_.payload_types().clear();
@ -629,7 +629,7 @@ bool BaseChannel::UpdateLocalStreams_w(const std::vector<StreamParams>& streams,
GetStream(streams, StreamFinder(&old_stream))) {
continue;
}
if (!media_channel()->RemoveSendStream(old_stream.first_ssrc())) {
if (!media_send_channel()->RemoveSendStream(old_stream.first_ssrc())) {
error_desc = StringFormat(
"Failed to remove send stream with ssrc %u from m-section with "
"mid='%s'.",
@ -672,7 +672,7 @@ bool BaseChannel::UpdateLocalStreams_w(const std::vector<StreamParams>& streams,
/* flex_fec = */ false, ssrc_generator_);
}
if (media_channel()->AddSendStream(new_stream)) {
if (media_send_channel()->AddSendStream(new_stream)) {
RTC_LOG(LS_INFO) << "Add send stream ssrc: " << new_stream.ssrcs[0]
<< " into " << ToString();
} else {
@ -709,12 +709,12 @@ bool BaseChannel::UpdateRemoteStreams_w(const MediaContentDescription* content,
// If we no longer have an unsignaled stream, we would like to remove
// the unsignaled stream params that are cached.
if (!old_stream.has_ssrcs() && !new_has_unsignaled_ssrcs) {
media_channel()->ResetUnsignaledRecvStream();
media_receive_channel()->ResetUnsignaledRecvStream();
RTC_LOG(LS_INFO) << "Reset unsignaled remote stream for " << ToString()
<< ".";
} else if (old_stream.has_ssrcs() &&
!GetStreamBySsrc(streams, old_stream.first_ssrc())) {
if (media_channel()->RemoveRecvStream(old_stream.first_ssrc())) {
if (media_receive_channel()->RemoveRecvStream(old_stream.first_ssrc())) {
RTC_LOG(LS_INFO) << "Remove remote ssrc: " << old_stream.first_ssrc()
<< " from " << ToString() << ".";
} else {
@ -735,7 +735,7 @@ bool BaseChannel::UpdateRemoteStreams_w(const MediaContentDescription* content,
// stream received later.
if ((!new_stream.has_ssrcs() && !old_has_unsignaled_ssrcs) ||
!GetStreamBySsrc(remote_streams_, new_stream.first_ssrc())) {
if (media_channel()->AddRecvStream(new_stream)) {
if (media_receive_channel()->AddRecvStream(new_stream)) {
RTC_LOG(LS_INFO) << "Add remote ssrc: "
<< (new_stream.has_ssrcs()
? std::to_string(new_stream.first_ssrc())
@ -808,7 +808,7 @@ bool BaseChannel::ClearHandledPayloadTypes() {
void BaseChannel::SignalSentPacket_n(const rtc::SentPacket& sent_packet) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK(network_initialized());
media_channel()->OnPacketSent(sent_packet);
media_send_channel()->OnPacketSent(sent_packet);
}
VoiceChannel::VoiceChannel(rtc::Thread* worker_thread,
@ -839,12 +839,12 @@ void VoiceChannel::UpdateMediaSendRecvState_w() {
// content. We receive data on the default channel and multiplexed streams.
bool ready_to_receive = enabled() && webrtc::RtpTransceiverDirectionHasRecv(
local_content_direction());
media_channel()->SetPlayout(ready_to_receive);
media_receive_channel()->SetPlayout(ready_to_receive);
// Send outgoing data if we're the active call, we have the remote content,
// and we have had some form of connectivity.
bool send = IsReadyToSendMedia_w();
media_channel()->SetSend(send);
media_send_channel()->SetSend(send);
RTC_LOG(LS_INFO) << "Changing voice state, recv=" << ready_to_receive
<< " send=" << send << " for " << ToString();
@ -861,7 +861,7 @@ bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content,
RtpHeaderExtensions header_extensions =
GetDeduplicatedRtpHeaderExtensions(content->rtp_header_extensions());
bool update_header_extensions = true;
media_channel()->SetExtmapAllowMixed(content->extmap_allow_mixed());
media_send_channel()->SetExtmapAllowMixed(content->extmap_allow_mixed());
AudioRecvParameters recv_params = last_recv_params_;
RtpParametersFromMediaDescription(
@ -869,7 +869,7 @@ bool VoiceChannel::SetLocalContent_w(const MediaContentDescription* content,
webrtc::RtpTransceiverDirectionHasRecv(content->direction()),
&recv_params);
if (!media_channel()->SetRecvParameters(recv_params)) {
if (!media_send_channel()->SetRecvParameters(recv_params)) {
error_desc = StringFormat(
"Failed to set local audio description recv parameters for m-section "
"with mid='%s'.",
@ -921,7 +921,8 @@ bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content,
extensions_filter(), &send_params);
send_params.mid = mid();
bool parameters_applied = media_channel()->SetSendParameters(send_params);
bool parameters_applied =
media_send_channel()->SetSendParameters(send_params);
if (!parameters_applied) {
error_desc = StringFormat(
"Failed to set remote audio description send parameters for m-section "
@ -961,7 +962,7 @@ void VideoChannel::UpdateMediaSendRecvState_w() {
// Send outgoing data if we're the active call, we have the remote content,
// and we have had some form of connectivity.
bool send = IsReadyToSendMedia_w();
media_channel()->SetSend(send);
media_send_channel()->SetSend(send);
RTC_LOG(LS_INFO) << "Changing video state, send=" << send << " for "
<< ToString();
}
@ -977,7 +978,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
RtpHeaderExtensions header_extensions =
GetDeduplicatedRtpHeaderExtensions(content->rtp_header_extensions());
bool update_header_extensions = true;
media_channel()->SetExtmapAllowMixed(content->extmap_allow_mixed());
media_send_channel()->SetExtmapAllowMixed(content->extmap_allow_mixed());
VideoRecvParameters recv_params = last_recv_params_;
@ -1007,7 +1008,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
}
}
if (!media_channel()->SetRecvParameters(recv_params)) {
if (!media_send_channel()->SetRecvParameters(recv_params)) {
error_desc = StringFormat(
"Failed to set local video description recv parameters for m-section "
"with mid='%s'.",
@ -1026,7 +1027,7 @@ bool VideoChannel::SetLocalContent_w(const MediaContentDescription* content,
last_recv_params_ = recv_params;
if (needs_send_params_update) {
if (!media_channel()->SetSendParameters(send_params)) {
if (!media_send_channel()->SetSendParameters(send_params)) {
error_desc = StringFormat(
"Failed to set send parameters for m-section with mid='%s'.",
mid().c_str());
@ -1092,7 +1093,7 @@ bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content,
}
}
if (!media_channel()->SetSendParameters(send_params)) {
if (!media_send_channel()->SetSendParameters(send_params)) {
error_desc = StringFormat(
"Failed to set remote video description send parameters for m-section "
"with mid='%s'.",
@ -1102,7 +1103,7 @@ bool VideoChannel::SetRemoteContent_w(const MediaContentDescription* content,
last_send_params_ = send_params;
if (needs_recv_params_update) {
if (!media_channel()->SetRecvParameters(recv_params)) {
if (!media_send_channel()->SetRecvParameters(recv_params)) {
error_desc = StringFormat(
"Failed to set recv parameters for m-section with mid='%s'.",
mid().c_str());

View File

@ -155,14 +155,25 @@ class BaseChannel : public ChannelInterface,
// RtpPacketSinkInterface overrides.
void OnRtpPacket(const webrtc::RtpPacketReceived& packet) override;
MediaChannel* media_channel() const override {
MediaSendChannelInterface* media_send_channel() const override {
return media_channel_.get();
}
VideoMediaChannel* video_media_channel() const override {
VideoMediaChannel* video_media_send_channel() const override {
RTC_CHECK(false) << "Attempt to fetch video channel from non-video";
return nullptr;
}
VoiceMediaChannel* voice_media_channel() const override {
VoiceMediaChannel* voice_media_send_channel() const override {
RTC_CHECK(false) << "Attempt to fetch voice channel from non-voice";
return nullptr;
}
MediaReceiveChannelInterface* media_receive_channel() const override {
return media_channel_.get();
}
VideoMediaChannel* video_media_receive_channel() const override {
RTC_CHECK(false) << "Attempt to fetch video channel from non-video";
return nullptr;
}
VoiceMediaChannel* voice_media_receive_channel() const override {
RTC_CHECK(false) << "Attempt to fetch voice channel from non-voice";
return nullptr;
}
@ -368,12 +379,22 @@ class VoiceChannel : public BaseChannel {
~VoiceChannel();
// downcasts a MediaChannel
VoiceMediaChannel* media_channel() const override {
return static_cast<VoiceMediaChannel*>(BaseChannel::media_channel());
VoiceMediaChannel* media_send_channel() const override {
return static_cast<VoiceMediaChannel*>(BaseChannel::media_send_channel());
}
VoiceMediaChannel* voice_media_channel() const override {
return static_cast<VoiceMediaChannel*>(media_channel());
VoiceMediaChannel* voice_media_send_channel() const override {
return static_cast<VoiceMediaChannel*>(media_send_channel());
}
// downcasts a MediaChannel
VoiceMediaChannel* media_receive_channel() const override {
return static_cast<VoiceMediaChannel*>(
BaseChannel::media_receive_channel());
}
VoiceMediaChannel* voice_media_receive_channel() const override {
return static_cast<VoiceMediaChannel*>(media_receive_channel());
}
cricket::MediaType media_type() const override {
@ -414,12 +435,22 @@ class VideoChannel : public BaseChannel {
~VideoChannel();
// downcasts a MediaChannel
VideoMediaChannel* media_channel() const override {
return static_cast<VideoMediaChannel*>(BaseChannel::media_channel());
VideoMediaChannel* media_send_channel() const override {
return static_cast<VideoMediaChannel*>(BaseChannel::media_send_channel());
}
VideoMediaChannel* video_media_channel() const override {
return static_cast<cricket::VideoMediaChannel*>(media_channel());
VideoMediaChannel* video_media_send_channel() const override {
return static_cast<cricket::VideoMediaChannel*>(media_send_channel());
}
// downcasts a MediaChannel
VideoMediaChannel* media_receive_channel() const override {
return static_cast<VideoMediaChannel*>(
BaseChannel::media_receive_channel());
}
VideoMediaChannel* video_media_receive_channel() const override {
return static_cast<cricket::VideoMediaChannel*>(media_receive_channel());
}
cricket::MediaType media_type() const override {

View File

@ -47,11 +47,16 @@ class ChannelInterface {
virtual ~ChannelInterface() = default;
virtual cricket::MediaType media_type() const = 0;
virtual MediaChannel* media_channel() const = 0;
virtual MediaSendChannelInterface* media_send_channel() const = 0;
// Typecasts of media_channel(). Will cause an exception if the
// channel is of the wrong type.
virtual VideoMediaChannel* video_media_channel() const = 0;
virtual VoiceMediaChannel* voice_media_channel() const = 0;
virtual VideoMediaChannel* video_media_send_channel() const = 0;
virtual VoiceMediaChannel* voice_media_send_channel() const = 0;
virtual MediaReceiveChannelInterface* media_receive_channel() const = 0;
// Typecasts of media_channel(). Will cause an exception if the
// channel is of the wrong type.
virtual VideoMediaChannel* video_media_receive_channel() const = 0;
virtual VoiceMediaChannel* voice_media_receive_channel() const = 0;
// Returns a string view for the transport name. Fetching the transport name
// must be done on the network thread only and note that the lifetime of

View File

@ -429,7 +429,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
}
void SendRtp1(rtc::Buffer data) {
SendRtp(media_channel1(), std::move(data));
SendRtp(media_send_channel1(), std::move(data));
}
void SendRtp2() {
@ -449,7 +449,8 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
}
bool CheckRtp1() {
return media_channel1()->CheckRtp(rtp_packet_.data(), rtp_packet_.size());
return media_send_channel1()->CheckRtp(rtp_packet_.data(),
rtp_packet_.size());
}
bool CheckRtp2() {
return media_channel2()->CheckRtp(rtp_packet_.data(), rtp_packet_.size());
@ -457,7 +458,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
// Methods to check custom data.
bool CheckCustomRtp1(uint32_t ssrc, int sequence_number, int pl_type = -1) {
rtc::Buffer data = CreateRtpData(ssrc, sequence_number, pl_type);
return media_channel1()->CheckRtp(data.data(), data.size());
return media_send_channel1()->CheckRtp(data.data(), data.size());
}
bool CheckCustomRtp2(uint32_t ssrc, int sequence_number, int pl_type = -1) {
rtc::Buffer data = CreateRtpData(ssrc, sequence_number, pl_type);
@ -474,7 +475,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
return data;
}
bool CheckNoRtp1() { return media_channel1()->CheckNoRtp(); }
bool CheckNoRtp1() { return media_send_channel1()->CheckNoRtp(); }
bool CheckNoRtp2() { return media_channel2()->CheckNoRtp(); }
void CreateContent(int flags,
@ -557,13 +558,13 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
void TestInit() {
CreateChannels(0, 0);
EXPECT_FALSE(IsSrtpActive(channel1_));
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_FALSE(media_channel1()->playout());
EXPECT_FALSE(media_send_channel1()->playout());
}
EXPECT_TRUE(media_channel1()->codecs().empty());
EXPECT_TRUE(media_channel1()->recv_streams().empty());
EXPECT_TRUE(media_channel1()->rtp_packets().empty());
EXPECT_TRUE(media_send_channel1()->codecs().empty());
EXPECT_TRUE(media_send_channel1()->recv_streams().empty());
EXPECT_TRUE(media_send_channel1()->rtp_packets().empty());
}
// Test that SetLocalContent and SetRemoteContent properly configure
@ -574,11 +575,11 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateContent(0, kPcmuCodec, kH264Codec, &content);
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&content, SdpType::kOffer, err));
EXPECT_EQ(0U, media_channel1()->codecs().size());
EXPECT_EQ(0U, media_send_channel1()->codecs().size());
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kAnswer, err));
ASSERT_EQ(1U, media_channel1()->codecs().size());
ASSERT_EQ(1U, media_send_channel1()->codecs().size());
EXPECT_TRUE(
CodecMatches(content.codecs()[0], media_channel1()->codecs()[0]));
CodecMatches(content.codecs()[0], media_send_channel1()->codecs()[0]));
}
// Test that SetLocalContent and SetRemoteContent properly configure
@ -596,7 +597,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(channel1_->SetLocalContent(&content, SdpType::kOffer, err));
content.set_extmap_allow_mixed_enum(answer_enum);
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kAnswer, err));
EXPECT_EQ(answer, media_channel1()->ExtmapAllowMixed());
EXPECT_EQ(answer, media_send_channel1()->ExtmapAllowMixed());
}
void TestSetContentsExtmapAllowMixedCallee(bool offer, bool answer) {
// For a callee, SetRemoteContent() is called first with an offer and next
@ -611,7 +612,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kOffer, err));
content.set_extmap_allow_mixed_enum(answer_enum);
EXPECT_TRUE(channel1_->SetLocalContent(&content, SdpType::kAnswer, err));
EXPECT_EQ(answer, media_channel1()->ExtmapAllowMixed());
EXPECT_EQ(answer, media_send_channel1()->ExtmapAllowMixed());
}
// Test that SetLocalContent and SetRemoteContent properly deals
@ -622,11 +623,11 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&content, SdpType::kOffer, err));
CreateContent(0, kPcmuCodec, kH264Codec, &content);
EXPECT_EQ(0U, media_channel1()->codecs().size());
EXPECT_EQ(0U, media_send_channel1()->codecs().size());
EXPECT_TRUE(channel1_->SetRemoteContent(&content, SdpType::kAnswer, err));
ASSERT_EQ(1U, media_channel1()->codecs().size());
ASSERT_EQ(1U, media_send_channel1()->codecs().size());
EXPECT_TRUE(
CodecMatches(content.codecs()[0], media_channel1()->codecs()[0]));
CodecMatches(content.codecs()[0], media_send_channel1()->codecs()[0]));
}
// Test that SetLocalContent and SetRemoteContent properly set RTCP
@ -668,7 +669,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&content1, SdpType::kOffer, err));
channel1_->Enable(true);
EXPECT_EQ(1u, media_channel1()->send_streams().size());
EXPECT_EQ(1u, media_send_channel1()->send_streams().size());
EXPECT_TRUE(channel2_->SetRemoteContent(&content1, SdpType::kOffer, err));
EXPECT_EQ(1u, media_channel2()->recv_streams().size());
@ -678,7 +679,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
typename T::Content content2;
CreateContent(0, kPcmuCodec, kH264Codec, &content2);
EXPECT_TRUE(channel1_->SetRemoteContent(&content2, SdpType::kAnswer, err));
EXPECT_EQ(0u, media_channel1()->recv_streams().size());
EXPECT_EQ(0u, media_send_channel1()->recv_streams().size());
EXPECT_TRUE(channel2_->SetLocalContent(&content2, SdpType::kAnswer, err));
channel2_->Enable(true);
EXPECT_EQ(0u, media_channel2()->send_streams().size());
@ -696,14 +697,14 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_EQ(stream2, media_channel2()->send_streams()[0]);
EXPECT_TRUE(channel1_->SetRemoteContent(&content3, SdpType::kOffer, err));
ASSERT_EQ(1u, media_channel1()->recv_streams().size());
EXPECT_EQ(stream2, media_channel1()->recv_streams()[0]);
ASSERT_EQ(1u, media_send_channel1()->recv_streams().size());
EXPECT_EQ(stream2, media_send_channel1()->recv_streams()[0]);
// Channel 1 replies but stop sending stream1.
typename T::Content content4;
CreateContent(0, kPcmuCodec, kH264Codec, &content4);
EXPECT_TRUE(channel1_->SetLocalContent(&content4, SdpType::kAnswer, err));
EXPECT_EQ(0u, media_channel1()->send_streams().size());
EXPECT_EQ(0u, media_send_channel1()->send_streams().size());
EXPECT_TRUE(channel2_->SetRemoteContent(&content4, SdpType::kAnswer, err));
EXPECT_EQ(0u, media_channel2()->recv_streams().size());
@ -717,9 +718,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
void TestPlayoutAndSendingStates() {
CreateChannels(0, 0);
if (verify_playout_) {
EXPECT_FALSE(media_channel1()->playout());
EXPECT_FALSE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_FALSE(media_channel2()->playout());
}
@ -727,16 +728,16 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
channel1_->Enable(true);
FlushCurrentThread();
if (verify_playout_) {
EXPECT_FALSE(media_channel1()->playout());
EXPECT_FALSE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&local_media_content1_,
SdpType::kOffer, err));
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
EXPECT_TRUE(channel2_->SetRemoteContent(&local_media_content1_,
SdpType::kOffer, err));
if (verify_playout_) {
@ -751,9 +752,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_FALSE(media_channel2()->sending());
ConnectFakeTransports();
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_FALSE(media_channel2()->playout());
}
@ -767,9 +768,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(channel1_->SetRemoteContent(&local_media_content2_,
SdpType::kAnswer, err));
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
}
// Test that changing the MediaContentDirection in the local and remote
@ -787,9 +788,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
channel2_->Enable(true);
FlushCurrentThread();
if (verify_playout_) {
EXPECT_FALSE(media_channel1()->playout());
EXPECT_FALSE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_FALSE(media_channel2()->playout());
}
@ -804,9 +805,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
ConnectFakeTransports();
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending()); // remote InActive
EXPECT_FALSE(media_send_channel1()->sending()); // remote InActive
if (verify_playout_) {
EXPECT_FALSE(media_channel2()->playout()); // local InActive
}
@ -819,9 +820,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
channel1_->SetRemoteContent(&content2, SdpType::kPrAnswer, err));
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_TRUE(media_channel2()->playout()); // local RecvOnly
}
@ -833,9 +834,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_TRUE(channel1_->SetRemoteContent(&content2, SdpType::kAnswer, err));
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
if (verify_playout_) {
EXPECT_TRUE(media_channel2()->playout());
}
@ -855,15 +856,15 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateChannels(DTLS, DTLS);
SendInitiate();
typename T::MediaChannel* media_channel1 =
static_cast<typename T::MediaChannel*>(channel1_->media_channel());
ASSERT_TRUE(media_channel1);
typename T::MediaChannel* media_send_channel1 =
static_cast<typename T::MediaChannel*>(channel1_->media_send_channel());
ASSERT_TRUE(media_send_channel1);
// Need to wait for the threads before calling
// `set_num_network_route_changes` because the network route would be set
// when creating the channel.
WaitForThreads();
media_channel1->set_num_network_route_changes(0);
media_send_channel1->set_num_network_route_changes(0);
SendTask(network_thread_, [this] {
rtc::NetworkRoute network_route;
// The transport channel becomes disconnected.
@ -871,9 +872,9 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
absl::optional<rtc::NetworkRoute>(network_route));
});
WaitForThreads();
EXPECT_EQ(1, media_channel1->num_network_route_changes());
EXPECT_FALSE(media_channel1->last_network_route().connected);
media_channel1->set_num_network_route_changes(0);
EXPECT_EQ(1, media_send_channel1->num_network_route_changes());
EXPECT_FALSE(media_send_channel1->last_network_route().connected);
media_send_channel1->set_num_network_route_changes(0);
SendTask(network_thread_, [this] {
rtc::NetworkRoute network_route;
@ -890,16 +891,16 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
absl::optional<rtc::NetworkRoute>(network_route));
});
WaitForThreads();
EXPECT_EQ(1, media_channel1->num_network_route_changes());
EXPECT_TRUE(media_channel1->last_network_route().connected);
EXPECT_EQ(1, media_send_channel1->num_network_route_changes());
EXPECT_TRUE(media_send_channel1->last_network_route().connected);
EXPECT_EQ(kLocalNetId,
media_channel1->last_network_route().local.network_id());
media_send_channel1->last_network_route().local.network_id());
EXPECT_EQ(kRemoteNetId,
media_channel1->last_network_route().remote.network_id());
media_send_channel1->last_network_route().remote.network_id());
EXPECT_EQ(kLastPacketId,
media_channel1->last_network_route().last_sent_packet_id);
media_send_channel1->last_network_route().last_sent_packet_id);
EXPECT_EQ(kTransportOverheadPerPacket + kSrtpOverheadPerPacket,
media_channel1->transport_overhead_per_packet());
media_send_channel1->transport_overhead_per_packet());
}
// Test setting up a call.
@ -908,13 +909,13 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
EXPECT_FALSE(IsSrtpActive(channel1_));
EXPECT_TRUE(SendInitiate());
if (verify_playout_) {
EXPECT_TRUE(media_channel1()->playout());
EXPECT_TRUE(media_send_channel1()->playout());
}
EXPECT_FALSE(media_channel1()->sending());
EXPECT_FALSE(media_send_channel1()->sending());
EXPECT_TRUE(SendAccept());
EXPECT_FALSE(IsSrtpActive(channel1_));
EXPECT_TRUE(media_channel1()->sending());
EXPECT_EQ(1U, media_channel1()->codecs().size());
EXPECT_TRUE(media_send_channel1()->sending());
EXPECT_EQ(1U, media_send_channel1()->codecs().size());
if (verify_playout_) {
EXPECT_TRUE(media_channel2()->playout());
}
@ -1046,7 +1047,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
// Regain writability
SendTask(network_thread_,
[this] { fake_rtp_dtls_transport1_->SetWritable(true); });
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
SendRtp1();
SendRtp2();
WaitForThreads();
@ -1060,7 +1061,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
bool asymmetric = true;
fake_rtp_dtls_transport1_->SetDestination(nullptr, asymmetric);
});
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
// Should fail also.
SendRtp1();
@ -1076,7 +1077,7 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
fake_rtp_dtls_transport1_->SetDestination(fake_rtp_dtls_transport2_.get(),
asymmetric);
});
EXPECT_TRUE(media_channel1()->sending());
EXPECT_TRUE(media_send_channel1()->sending());
SendRtp1();
SendRtp2();
WaitForThreads();
@ -1129,17 +1130,17 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
std::unique_ptr<typename T::Content> content(
CreateMediaContentWithStream(1));
media_channel1()->set_fail_set_recv_codecs(true);
media_send_channel1()->set_fail_set_recv_codecs(true);
EXPECT_FALSE(
channel1_->SetLocalContent(content.get(), SdpType::kOffer, err));
EXPECT_FALSE(
channel1_->SetLocalContent(content.get(), SdpType::kAnswer, err));
media_channel1()->set_fail_set_send_codecs(true);
media_send_channel1()->set_fail_set_send_codecs(true);
EXPECT_FALSE(
channel1_->SetRemoteContent(content.get(), SdpType::kOffer, err));
media_channel1()->set_fail_set_send_codecs(true);
media_send_channel1()->set_fail_set_send_codecs(true);
EXPECT_FALSE(
channel1_->SetRemoteContent(content.get(), SdpType::kAnswer, err));
}
@ -1152,14 +1153,14 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateMediaContentWithStream(1));
EXPECT_TRUE(
channel1_->SetLocalContent(content1.get(), SdpType::kOffer, err));
EXPECT_TRUE(media_channel1()->HasSendStream(1));
EXPECT_TRUE(media_send_channel1()->HasSendStream(1));
std::unique_ptr<typename T::Content> content2(
CreateMediaContentWithStream(2));
EXPECT_TRUE(
channel1_->SetLocalContent(content2.get(), SdpType::kOffer, err));
EXPECT_FALSE(media_channel1()->HasSendStream(1));
EXPECT_TRUE(media_channel1()->HasSendStream(2));
EXPECT_FALSE(media_send_channel1()->HasSendStream(1));
EXPECT_TRUE(media_send_channel1()->HasSendStream(2));
}
void TestReceiveTwoOffers() {
@ -1170,14 +1171,14 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateMediaContentWithStream(1));
EXPECT_TRUE(
channel1_->SetRemoteContent(content1.get(), SdpType::kOffer, err));
EXPECT_TRUE(media_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(1));
std::unique_ptr<typename T::Content> content2(
CreateMediaContentWithStream(2));
EXPECT_TRUE(
channel1_->SetRemoteContent(content2.get(), SdpType::kOffer, err));
EXPECT_FALSE(media_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_channel1()->HasRecvStream(2));
EXPECT_FALSE(media_send_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(2));
}
void TestSendPrAnswer() {
@ -1189,24 +1190,24 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateMediaContentWithStream(1));
EXPECT_TRUE(
channel1_->SetRemoteContent(content1.get(), SdpType::kOffer, err));
EXPECT_TRUE(media_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(1));
// Send PR answer
std::unique_ptr<typename T::Content> content2(
CreateMediaContentWithStream(2));
EXPECT_TRUE(
channel1_->SetLocalContent(content2.get(), SdpType::kPrAnswer, err));
EXPECT_TRUE(media_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_channel1()->HasSendStream(2));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(1));
EXPECT_TRUE(media_send_channel1()->HasSendStream(2));
// Send answer
std::unique_ptr<typename T::Content> content3(
CreateMediaContentWithStream(3));
EXPECT_TRUE(
channel1_->SetLocalContent(content3.get(), SdpType::kAnswer, err));
EXPECT_TRUE(media_channel1()->HasRecvStream(1));
EXPECT_FALSE(media_channel1()->HasSendStream(2));
EXPECT_TRUE(media_channel1()->HasSendStream(3));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(1));
EXPECT_FALSE(media_send_channel1()->HasSendStream(2));
EXPECT_TRUE(media_send_channel1()->HasSendStream(3));
}
void TestReceivePrAnswer() {
@ -1218,39 +1219,39 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
CreateMediaContentWithStream(1));
EXPECT_TRUE(
channel1_->SetLocalContent(content1.get(), SdpType::kOffer, err));
EXPECT_TRUE(media_channel1()->HasSendStream(1));
EXPECT_TRUE(media_send_channel1()->HasSendStream(1));
// Receive PR answer
std::unique_ptr<typename T::Content> content2(
CreateMediaContentWithStream(2));
EXPECT_TRUE(
channel1_->SetRemoteContent(content2.get(), SdpType::kPrAnswer, err));
EXPECT_TRUE(media_channel1()->HasSendStream(1));
EXPECT_TRUE(media_channel1()->HasRecvStream(2));
EXPECT_TRUE(media_send_channel1()->HasSendStream(1));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(2));
// Receive answer
std::unique_ptr<typename T::Content> content3(
CreateMediaContentWithStream(3));
EXPECT_TRUE(
channel1_->SetRemoteContent(content3.get(), SdpType::kAnswer, err));
EXPECT_TRUE(media_channel1()->HasSendStream(1));
EXPECT_FALSE(media_channel1()->HasRecvStream(2));
EXPECT_TRUE(media_channel1()->HasRecvStream(3));
EXPECT_TRUE(media_send_channel1()->HasSendStream(1));
EXPECT_FALSE(media_send_channel1()->HasRecvStream(2));
EXPECT_TRUE(media_send_channel1()->HasRecvStream(3));
}
void TestOnTransportReadyToSend() {
CreateChannels(0, 0);
EXPECT_FALSE(media_channel1()->ready_to_send());
EXPECT_FALSE(media_send_channel1()->ready_to_send());
network_thread_->PostTask(
[this] { channel1_->OnTransportReadyToSend(true); });
WaitForThreads();
EXPECT_TRUE(media_channel1()->ready_to_send());
EXPECT_TRUE(media_send_channel1()->ready_to_send());
network_thread_->PostTask(
[this] { channel1_->OnTransportReadyToSend(false); });
WaitForThreads();
EXPECT_FALSE(media_channel1()->ready_to_send());
EXPECT_FALSE(media_send_channel1()->ready_to_send());
}
bool SetRemoteContentWithBitrateLimit(int remote_limit) {
@ -1279,8 +1280,8 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&local_media_content1_,
SdpType::kOffer, err));
EXPECT_EQ(media_channel1()->max_bps(), -1);
VerifyMaxBitrate(media_channel1()->GetRtpSendParameters(kSsrc1),
EXPECT_EQ(media_send_channel1()->max_bps(), -1);
VerifyMaxBitrate(media_send_channel1()->GetRtpSendParameters(kSsrc1),
absl::nullopt);
}
@ -1397,16 +1398,18 @@ class ChannelTest : public ::testing::Test, public sigslot::has_slots<> {
ProcessThreadQueue(rtc::Thread::Current());
}
typename T::MediaChannel* media_channel1() {
typename T::MediaChannel* media_send_channel1() {
RTC_DCHECK(channel1_);
RTC_DCHECK(channel1_->media_channel());
return static_cast<typename T::MediaChannel*>(channel1_->media_channel());
RTC_DCHECK(channel1_->media_send_channel());
return static_cast<typename T::MediaChannel*>(
channel1_->media_send_channel());
}
typename T::MediaChannel* media_channel2() {
RTC_DCHECK(channel2_);
RTC_DCHECK(channel2_->media_channel());
return static_cast<typename T::MediaChannel*>(channel2_->media_channel());
RTC_DCHECK(channel2_->media_send_channel());
return static_cast<typename T::MediaChannel*>(
channel2_->media_send_channel());
}
rtc::AutoThread main_thread_;
@ -1595,8 +1598,8 @@ class VideoChannelDoubleThreadTest : public ChannelTest<VideoTraits> {
TEST_F(VoiceChannelSingleThreadTest, TestInit) {
Base::TestInit();
EXPECT_FALSE(media_channel1()->IsStreamMuted(0));
EXPECT_TRUE(media_channel1()->dtmf_info_queue().empty());
EXPECT_FALSE(media_send_channel1()->IsStreamMuted(0));
EXPECT_TRUE(media_send_channel1()->dtmf_info_queue().empty());
}
TEST_F(VoiceChannelSingleThreadTest, TestDeinit) {
@ -1732,8 +1735,8 @@ TEST_F(VoiceChannelSingleThreadTest, SocketOptionsMergedOnSetTransport) {
// VoiceChannelDoubleThreadTest
TEST_F(VoiceChannelDoubleThreadTest, TestInit) {
Base::TestInit();
EXPECT_FALSE(media_channel1()->IsStreamMuted(0));
EXPECT_TRUE(media_channel1()->dtmf_info_queue().empty());
EXPECT_FALSE(media_send_channel1()->IsStreamMuted(0));
EXPECT_TRUE(media_send_channel1()->dtmf_info_queue().empty());
}
TEST_F(VoiceChannelDoubleThreadTest, TestDeinit) {
@ -2016,14 +2019,15 @@ TEST_F(VideoChannelSingleThreadTest, TestSetLocalOfferWithPacketization) {
std::string err;
EXPECT_TRUE(channel1_->SetLocalContent(&video, SdpType::kOffer, err));
EXPECT_THAT(media_channel1()->send_codecs(), testing::IsEmpty());
ASSERT_THAT(media_channel1()->recv_codecs(), testing::SizeIs(2));
EXPECT_TRUE(
media_channel1()->recv_codecs()[0].Matches(kVp8Codec, &field_trials_));
EXPECT_EQ(media_channel1()->recv_codecs()[0].packetization, absl::nullopt);
EXPECT_TRUE(
media_channel1()->recv_codecs()[1].Matches(vp9_codec, &field_trials_));
EXPECT_EQ(media_channel1()->recv_codecs()[1].packetization,
EXPECT_THAT(media_send_channel1()->send_codecs(), testing::IsEmpty());
ASSERT_THAT(media_send_channel1()->recv_codecs(), testing::SizeIs(2));
EXPECT_TRUE(media_send_channel1()->recv_codecs()[0].Matches(kVp8Codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->recv_codecs()[0].packetization,
absl::nullopt);
EXPECT_TRUE(media_send_channel1()->recv_codecs()[1].Matches(vp9_codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->recv_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
@ -2039,14 +2043,15 @@ TEST_F(VideoChannelSingleThreadTest, TestSetRemoteOfferWithPacketization) {
std::string err;
EXPECT_TRUE(channel1_->SetRemoteContent(&video, SdpType::kOffer, err));
EXPECT_TRUE(err.empty());
EXPECT_THAT(media_channel1()->recv_codecs(), testing::IsEmpty());
ASSERT_THAT(media_channel1()->send_codecs(), testing::SizeIs(2));
EXPECT_TRUE(
media_channel1()->send_codecs()[0].Matches(kVp8Codec, &field_trials_));
EXPECT_EQ(media_channel1()->send_codecs()[0].packetization, absl::nullopt);
EXPECT_TRUE(
media_channel1()->send_codecs()[1].Matches(vp9_codec, &field_trials_));
EXPECT_EQ(media_channel1()->send_codecs()[1].packetization,
EXPECT_THAT(media_send_channel1()->recv_codecs(), testing::IsEmpty());
ASSERT_THAT(media_send_channel1()->send_codecs(), testing::SizeIs(2));
EXPECT_TRUE(media_send_channel1()->send_codecs()[0].Matches(kVp8Codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->send_codecs()[0].packetization,
absl::nullopt);
EXPECT_TRUE(media_send_channel1()->send_codecs()[1].Matches(vp9_codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->send_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
@ -2064,21 +2069,23 @@ TEST_F(VideoChannelSingleThreadTest, TestSetAnswerWithPacketization) {
EXPECT_TRUE(err.empty());
EXPECT_TRUE(channel1_->SetRemoteContent(&video, SdpType::kAnswer, err));
EXPECT_TRUE(err.empty());
ASSERT_THAT(media_channel1()->recv_codecs(), testing::SizeIs(2));
EXPECT_TRUE(
media_channel1()->recv_codecs()[0].Matches(kVp8Codec, &field_trials_));
EXPECT_EQ(media_channel1()->recv_codecs()[0].packetization, absl::nullopt);
EXPECT_TRUE(
media_channel1()->recv_codecs()[1].Matches(vp9_codec, &field_trials_));
EXPECT_EQ(media_channel1()->recv_codecs()[1].packetization,
ASSERT_THAT(media_send_channel1()->recv_codecs(), testing::SizeIs(2));
EXPECT_TRUE(media_send_channel1()->recv_codecs()[0].Matches(kVp8Codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->recv_codecs()[0].packetization,
absl::nullopt);
EXPECT_TRUE(media_send_channel1()->recv_codecs()[1].Matches(vp9_codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->recv_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
EXPECT_THAT(media_channel1()->send_codecs(), testing::SizeIs(2));
EXPECT_TRUE(
media_channel1()->send_codecs()[0].Matches(kVp8Codec, &field_trials_));
EXPECT_EQ(media_channel1()->send_codecs()[0].packetization, absl::nullopt);
EXPECT_TRUE(
media_channel1()->send_codecs()[1].Matches(vp9_codec, &field_trials_));
EXPECT_EQ(media_channel1()->send_codecs()[1].packetization,
EXPECT_THAT(media_send_channel1()->send_codecs(), testing::SizeIs(2));
EXPECT_TRUE(media_send_channel1()->send_codecs()[0].Matches(kVp8Codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->send_codecs()[0].packetization,
absl::nullopt);
EXPECT_TRUE(media_send_channel1()->send_codecs()[1].Matches(vp9_codec,
&field_trials_));
EXPECT_EQ(media_send_channel1()->send_codecs()[1].packetization,
cricket::kPacketizationParamRaw);
}
@ -2096,10 +2103,12 @@ TEST_F(VideoChannelSingleThreadTest, TestSetLocalAnswerWithoutPacketization) {
std::string err;
EXPECT_TRUE(channel1_->SetRemoteContent(&remote_video, SdpType::kOffer, err));
EXPECT_TRUE(channel1_->SetLocalContent(&local_video, SdpType::kAnswer, err));
ASSERT_THAT(media_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->recv_codecs()[0].packetization, absl::nullopt);
ASSERT_THAT(media_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->send_codecs()[0].packetization, absl::nullopt);
ASSERT_THAT(media_send_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->recv_codecs()[0].packetization,
absl::nullopt);
ASSERT_THAT(media_send_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->send_codecs()[0].packetization,
absl::nullopt);
}
TEST_F(VideoChannelSingleThreadTest, TestSetRemoteAnswerWithoutPacketization) {
@ -2117,10 +2126,12 @@ TEST_F(VideoChannelSingleThreadTest, TestSetRemoteAnswerWithoutPacketization) {
EXPECT_TRUE(channel1_->SetLocalContent(&local_video, SdpType::kOffer, err));
EXPECT_TRUE(
channel1_->SetRemoteContent(&remote_video, SdpType::kAnswer, err));
ASSERT_THAT(media_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->recv_codecs()[0].packetization, absl::nullopt);
ASSERT_THAT(media_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->send_codecs()[0].packetization, absl::nullopt);
ASSERT_THAT(media_send_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->recv_codecs()[0].packetization,
absl::nullopt);
ASSERT_THAT(media_send_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->send_codecs()[0].packetization,
absl::nullopt);
}
TEST_F(VideoChannelSingleThreadTest,
@ -2142,10 +2153,10 @@ TEST_F(VideoChannelSingleThreadTest,
EXPECT_FALSE(
channel1_->SetRemoteContent(&remote_video, SdpType::kAnswer, err));
EXPECT_FALSE(err.empty());
ASSERT_THAT(media_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->recv_codecs()[0].packetization,
ASSERT_THAT(media_send_channel1()->recv_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->recv_codecs()[0].packetization,
cricket::kPacketizationParamRaw);
EXPECT_THAT(media_channel1()->send_codecs(), testing::IsEmpty());
EXPECT_THAT(media_send_channel1()->send_codecs(), testing::IsEmpty());
}
TEST_F(VideoChannelSingleThreadTest,
@ -2165,9 +2176,10 @@ TEST_F(VideoChannelSingleThreadTest,
EXPECT_TRUE(err.empty());
EXPECT_FALSE(channel1_->SetLocalContent(&local_video, SdpType::kAnswer, err));
EXPECT_FALSE(err.empty());
EXPECT_THAT(media_channel1()->recv_codecs(), testing::IsEmpty());
ASSERT_THAT(media_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_channel1()->send_codecs()[0].packetization, absl::nullopt);
EXPECT_THAT(media_send_channel1()->recv_codecs(), testing::IsEmpty());
ASSERT_THAT(media_send_channel1()->send_codecs(), testing::SizeIs(1));
EXPECT_EQ(media_send_channel1()->send_codecs()[0].packetization,
absl::nullopt);
}
// VideoChannelDoubleThreadTest

View File

@ -1042,8 +1042,7 @@ void LegacyStatsCollector::ExtractBweInfo() {
}
auto* video_channel = transceiver->internal()->channel();
if (video_channel) {
video_media_channels.push_back(static_cast<cricket::VideoMediaChannel*>(
video_channel->media_channel()));
video_media_channels.push_back(video_channel->video_media_send_channel());
}
}
@ -1151,7 +1150,7 @@ class VideoMediaChannelStatsGatherer final : public MediaChannelStatsGatherer {
};
std::unique_ptr<MediaChannelStatsGatherer> CreateMediaChannelStatsGatherer(
cricket::MediaChannel* channel) {
cricket::MediaSendChannelInterface* channel) {
RTC_DCHECK(channel);
if (channel->media_type() == cricket::MEDIA_TYPE_AUDIO) {
return std::make_unique<VoiceMediaChannelStatsGatherer>(
@ -1180,7 +1179,7 @@ void LegacyStatsCollector::ExtractMediaInfo(
continue;
}
std::unique_ptr<MediaChannelStatsGatherer> gatherer =
CreateMediaChannelStatsGatherer(channel->media_channel());
CreateMediaChannelStatsGatherer(channel->media_send_channel());
gatherer->mid = channel->mid();
gatherer->transport_name = transport_names_by_mid.at(gatherer->mid);

View File

@ -1637,7 +1637,7 @@ RTCError PeerConnection::SetConfiguration(
auto* video_channel = transceiver->internal()->channel();
if (video_channel)
channels.push_back(static_cast<cricket::VideoMediaChannel*>(
video_channel->media_channel()));
video_channel->media_send_channel()));
}
worker_thread()->BlockingCall(

View File

@ -2360,13 +2360,13 @@ void RTCStatsCollector::PrepareTransceiverStatsInfosAndCallStats_s_w_n() {
if (media_type == cricket::MEDIA_TYPE_AUDIO) {
cricket::VoiceMediaChannel* voice_channel =
static_cast<cricket::VoiceMediaChannel*>(channel->media_channel());
channel->voice_media_send_channel();
RTC_DCHECK(voice_stats.find(voice_channel) == voice_stats.end());
voice_stats.insert(
std::make_pair(voice_channel, cricket::VoiceMediaInfo()));
} else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
cricket::VideoMediaChannel* video_channel =
static_cast<cricket::VideoMediaChannel*>(channel->media_channel());
channel->video_media_send_channel();
RTC_DCHECK(video_stats.find(video_channel) == video_stats.end());
video_stats.insert(
std::make_pair(video_channel, cricket::VideoMediaInfo()));
@ -2405,14 +2405,12 @@ void RTCStatsCollector::PrepareTransceiverStatsInfosAndCallStats_s_w_n() {
cricket::MediaType media_type = transceiver->media_type();
if (media_type == cricket::MEDIA_TYPE_AUDIO) {
cricket::VoiceMediaChannel* voice_channel =
static_cast<cricket::VoiceMediaChannel*>(
channel->media_channel());
channel->voice_media_send_channel();
RTC_DCHECK(voice_stats.find(voice_channel) != voice_stats.end());
voice_media_info = std::move(voice_stats[voice_channel]);
} else if (media_type == cricket::MEDIA_TYPE_VIDEO) {
cricket::VideoMediaChannel* video_channel =
static_cast<cricket::VideoMediaChannel*>(
channel->media_channel());
channel->video_media_send_channel();
RTC_DCHECK(video_stats.find(video_channel) != video_stats.end());
video_media_info = std::move(video_stats[video_channel]);
}

View File

@ -53,7 +53,8 @@ class RtpReceiverInternal : public RtpReceiverInterface {
// * SetMediaChannel(nullptr) must be called before the media channel is
// destroyed.
// * This method must be invoked on the worker thread.
virtual void SetMediaChannel(cricket::MediaChannel* media_channel) = 0;
virtual void SetMediaChannel(
cricket::MediaReceiveChannelInterface* media_channel) = 0;
// Configures the RtpReceiver with the underlying media channel, with the
// given SSRC as the stream identifier.

View File

@ -186,7 +186,8 @@ void RtpSenderBase::SetEncoderSelectorOnChannel() {
}
}
void RtpSenderBase::SetMediaChannel(cricket::MediaChannel* media_channel) {
void RtpSenderBase::SetMediaChannel(
cricket::MediaSendChannelInterface* media_channel) {
RTC_DCHECK(media_channel == nullptr ||
media_channel->media_type() == media_type());
media_channel_ = media_channel;

View File

@ -54,7 +54,8 @@ class RtpSenderInternal : public RtpSenderInterface {
// A VoiceMediaChannel should be used for audio RtpSenders and
// a VideoMediaChannel should be used for video RtpSenders.
// Must call SetMediaChannel(nullptr) before the media channel is destroyed.
virtual void SetMediaChannel(cricket::MediaChannel* media_channel) = 0;
virtual void SetMediaChannel(
cricket::MediaSendChannelInterface* media_channel) = 0;
// Used to set the SSRC of the sender, once a local description has been set.
// If `ssrc` is 0, this indiates that the sender should disconnect from the
@ -120,7 +121,8 @@ class RtpSenderBase : public RtpSenderInternal, public ObserverInterface {
// A VoiceMediaChannel should be used for audio RtpSenders and
// a VideoMediaChannel should be used for video RtpSenders.
// Must call SetMediaChannel(nullptr) before the media channel is destroyed.
void SetMediaChannel(cricket::MediaChannel* media_channel) override;
void SetMediaChannel(
cricket::MediaSendChannelInterface* media_channel) override;
bool SetTrack(MediaStreamTrackInterface* track) override;
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
@ -267,7 +269,7 @@ class RtpSenderBase : public RtpSenderInternal, public ObserverInterface {
// a guard or lock. Internally there are also several Invoke()s that we could
// remove since the upstream code may already be performing several operations
// on the worker thread.
cricket::MediaChannel* media_channel_ = nullptr;
cricket::MediaSendChannelInterface* media_channel_ = nullptr;
rtc::scoped_refptr<MediaStreamTrackInterface> track_;
rtc::scoped_refptr<DtlsTransportInterface> dtls_transport_;

View File

@ -339,13 +339,16 @@ void RtpTransceiver::PushNewMediaChannelAndDeleteChannel(
}
context()->worker_thread()->BlockingCall([&]() {
// Push down the new media_channel, if any, otherwise clear it.
auto* media_channel = channel_ ? channel_->media_channel() : nullptr;
auto* media_send_channel =
channel_ ? channel_->media_send_channel() : nullptr;
for (const auto& sender : senders_) {
sender->internal()->SetMediaChannel(media_channel);
sender->internal()->SetMediaChannel(media_send_channel);
}
auto* media_receive_channel =
channel_ ? channel_->media_receive_channel() : nullptr;
for (const auto& receiver : receivers_) {
receiver->internal()->SetMediaChannel(media_channel);
receiver->internal()->SetMediaChannel(media_receive_channel);
}
// Destroy the channel, if we had one, now _after_ updating the receivers

View File

@ -344,7 +344,8 @@ TEST_F(RtpTransceiverTestForHeaderExtensions,
EXPECT_CALL(*mock_channel, SetFirstPacketReceivedCallback(_));
EXPECT_CALL(*mock_channel, media_type())
.WillRepeatedly(Return(cricket::MediaType::MEDIA_TYPE_AUDIO));
EXPECT_CALL(*mock_channel, media_channel()).WillRepeatedly(Return(nullptr));
EXPECT_CALL(*mock_channel, media_send_channel())
.WillRepeatedly(Return(nullptr));
EXPECT_CALL(*mock_channel, mid()).WillRepeatedly(ReturnRef(content_name));
EXPECT_CALL(*mock_channel, SetRtpTransport(_)).WillRepeatedly(Return(true));
transceiver_->SetChannel(std::move(mock_channel),
@ -368,7 +369,8 @@ TEST_F(RtpTransceiverTestForHeaderExtensions, ReturnsNegotiatedHdrExts) {
EXPECT_CALL(*mock_channel, SetFirstPacketReceivedCallback(_));
EXPECT_CALL(*mock_channel, media_type())
.WillRepeatedly(Return(cricket::MediaType::MEDIA_TYPE_AUDIO));
EXPECT_CALL(*mock_channel, media_channel()).WillRepeatedly(Return(nullptr));
EXPECT_CALL(*mock_channel, media_send_channel())
.WillRepeatedly(Return(nullptr));
EXPECT_CALL(*mock_channel, mid()).WillRepeatedly(ReturnRef(content_name));
EXPECT_CALL(*mock_channel, SetRtpTransport(_)).WillRepeatedly(Return(true));

View File

@ -78,7 +78,7 @@ cricket::VoiceMediaChannel* RtpTransmissionManager::voice_media_channel()
RTC_DCHECK(!IsUnifiedPlan());
auto* voice_channel = GetAudioTransceiver()->internal()->channel();
if (voice_channel) {
return voice_channel->voice_media_channel();
return voice_channel->voice_media_send_channel();
} else {
return nullptr;
}
@ -90,7 +90,7 @@ cricket::VideoMediaChannel* RtpTransmissionManager::video_media_channel()
RTC_DCHECK(!IsUnifiedPlan());
auto* video_channel = GetVideoTransceiver()->internal()->channel();
if (video_channel) {
return video_channel->video_media_channel();
return video_channel->video_media_send_channel();
} else {
return nullptr;
}

View File

@ -25,9 +25,24 @@ namespace cricket {
class MockChannelInterface : public cricket::ChannelInterface {
public:
MOCK_METHOD(cricket::MediaType, media_type, (), (const, override));
MOCK_METHOD(MediaChannel*, media_channel, (), (const, override));
MOCK_METHOD(VoiceMediaChannel*, voice_media_channel, (), (const, override));
MOCK_METHOD(VideoMediaChannel*, video_media_channel, (), (const, override));
MOCK_METHOD(MediaChannel*, media_send_channel, (), (const, override));
MOCK_METHOD(VoiceMediaChannel*,
voice_media_send_channel,
(),
(const, override));
MOCK_METHOD(VideoMediaChannel*,
video_media_send_channel,
(),
(const, override));
MOCK_METHOD(MediaChannel*, media_receive_channel, (), (const, override));
MOCK_METHOD(VoiceMediaChannel*,
voice_media_receive_channel,
(),
(const, override));
MOCK_METHOD(VideoMediaChannel*,
video_media_receive_channel,
(),
(const, override));
MOCK_METHOD(absl::string_view, transport_name, (), (const, override));
MOCK_METHOD(const std::string&, mid, (), (const, override));
MOCK_METHOD(void, Enable, (bool), (override));

View File

@ -57,7 +57,10 @@ class MockRtpReceiverInternal : public RtpReceiverInternal {
// RtpReceiverInternal methods.
MOCK_METHOD(void, Stop, (), (override));
MOCK_METHOD(void, SetMediaChannel, (cricket::MediaChannel*), (override));
MOCK_METHOD(void,
SetMediaChannel,
(cricket::MediaReceiveChannelInterface*),
(override));
MOCK_METHOD(void, SetupMediaChannel, (uint32_t), (override));
MOCK_METHOD(void, SetupUnsignaledMediaChannel, (), (override));
MOCK_METHOD(uint32_t, ssrc, (), (const, override));

View File

@ -91,7 +91,7 @@ class MockRtpSenderInternal : public RtpSenderInternal {
(override));
// RtpSenderInternal methods.
MOCK_METHOD1(SetMediaChannel, void(cricket::MediaChannel*));
MOCK_METHOD1(SetMediaChannel, void(cricket::MediaSendChannelInterface*));
MOCK_METHOD1(SetSsrc, void(uint32_t));
MOCK_METHOD1(set_stream_ids, void(const std::vector<std::string>&));
MOCK_METHOD1(SetStreams, void(const std::vector<std::string>&));

View File

@ -251,7 +251,8 @@ void VideoRtpReceiver::SetJitterBufferMinimumDelay(
media_channel_->SetBaseMinimumPlayoutDelayMs(*ssrc_, delay_.GetMs());
}
void VideoRtpReceiver::SetMediaChannel(cricket::MediaChannel* media_channel) {
void VideoRtpReceiver::SetMediaChannel(
cricket::MediaReceiveChannelInterface* media_channel) {
RTC_DCHECK_RUN_ON(worker_thread_);
RTC_DCHECK(media_channel == nullptr ||
media_channel->media_type() == media_type());
@ -259,7 +260,8 @@ void VideoRtpReceiver::SetMediaChannel(cricket::MediaChannel* media_channel) {
SetMediaChannel_w(media_channel);
}
void VideoRtpReceiver::SetMediaChannel_w(cricket::MediaChannel* media_channel) {
void VideoRtpReceiver::SetMediaChannel_w(
cricket::MediaReceiveChannelInterface* media_channel) {
RTC_DCHECK_RUN_ON(worker_thread_);
if (media_channel == media_channel_)
return;
@ -310,8 +312,9 @@ std::vector<RtpSource> VideoRtpReceiver::GetSources() const {
return media_channel_->GetSources(*ssrc_);
}
void VideoRtpReceiver::SetupMediaChannel(absl::optional<uint32_t> ssrc,
cricket::MediaChannel* media_channel) {
void VideoRtpReceiver::SetupMediaChannel(
absl::optional<uint32_t> ssrc,
cricket::MediaReceiveChannelInterface* media_channel) {
RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
RTC_DCHECK(media_channel);
MediaSourceInterface::SourceState state = source_->state();

View File

@ -102,7 +102,8 @@ class VideoRtpReceiver : public RtpReceiverInternal {
void SetJitterBufferMinimumDelay(
absl::optional<double> delay_seconds) override;
void SetMediaChannel(cricket::MediaChannel* media_channel) override;
void SetMediaChannel(
cricket::MediaReceiveChannelInterface* media_channel) override;
int AttachmentId() const override { return attachment_id_; }
@ -111,7 +112,7 @@ class VideoRtpReceiver : public RtpReceiverInternal {
// Combines SetMediaChannel, SetupMediaChannel and
// SetupUnsignaledMediaChannel.
void SetupMediaChannel(absl::optional<uint32_t> ssrc,
cricket::MediaChannel* media_channel);
cricket::MediaReceiveChannelInterface* media_channel);
private:
void RestartMediaChannel(absl::optional<uint32_t> ssrc)
@ -121,7 +122,7 @@ class VideoRtpReceiver : public RtpReceiverInternal {
RTC_RUN_ON(worker_thread_);
void SetSink(rtc::VideoSinkInterface<VideoFrame>* sink)
RTC_RUN_ON(worker_thread_);
void SetMediaChannel_w(cricket::MediaChannel* media_channel)
void SetMediaChannel_w(cricket::MediaReceiveChannelInterface* media_channel)
RTC_RUN_ON(worker_thread_);
// VideoRtpTrackSource::Callback