diff --git a/api/media_transport_interface.cc b/api/media_transport_interface.cc index c89ce0b01c..20bbe26cdb 100644 --- a/api/media_transport_interface.cc +++ b/api/media_transport_interface.cc @@ -97,11 +97,4 @@ size_t MediaTransportInterface::GetAudioPacketOverhead() const { void MediaTransportInterface::SetAllocatedBitrateLimits( const MediaTransportAllocatedBitrateLimits& limits) {} -// TODO(mellem): Delete when all implementations support it. -RTCError MediaTransportInterface::OpenChannel(int channel_id) { - // NB: This must return OK to avoid breaking existing implementations, which - // do not require calling OpenChannel. - return RTCError::OK(); -} - } // namespace webrtc diff --git a/api/media_transport_interface.h b/api/media_transport_interface.h index 69e0eba1ea..d333bec5bf 100644 --- a/api/media_transport_interface.h +++ b/api/media_transport_interface.h @@ -305,8 +305,7 @@ class MediaTransportInterface { // Opens a data |channel_id| for sending. May return an error if the // specified |channel_id| is unusable. Must be called before |SendData|. - // TODO(mellem): Make pure virtual when all implementations support it. - virtual RTCError OpenChannel(int channel_id); + virtual RTCError OpenChannel(int channel_id) = 0; // Sends a data buffer to the remote endpoint using the given send parameters. // |buffer| may not be larger than 256 KiB. Returns an error if the send diff --git a/api/test/fake_media_transport.h b/api/test/fake_media_transport.h index 6f87dfcb01..bdf56162af 100644 --- a/api/test/fake_media_transport.h +++ b/api/test/fake_media_transport.h @@ -55,6 +55,8 @@ class FakeMediaTransport : public MediaTransportInterface { return settings_.pre_shared_key; } + RTCError OpenChannel(int channel_id) override { return RTCError::OK(); } + RTCError SendData(int channel_id, const SendDataParams& params, const rtc::CopyOnWriteBuffer& buffer) override { diff --git a/api/test/loopback_media_transport.cc b/api/test/loopback_media_transport.cc index c466170c80..490fc46d7c 100644 --- a/api/test/loopback_media_transport.cc +++ b/api/test/loopback_media_transport.cc @@ -67,6 +67,10 @@ class WrapperMediaTransport : public MediaTransportInterface { wrapped_->SetMediaTransportStateCallback(callback); } + RTCError OpenChannel(int channel_id) override { + return wrapped_->OpenChannel(channel_id); + } + RTCError SendData(int channel_id, const SendDataParams& params, const rtc::CopyOnWriteBuffer& buffer) override { @@ -265,6 +269,12 @@ void MediaTransportPair::LoopbackMediaTransport::SetMediaTransportStateCallback( }); } +RTCError MediaTransportPair::LoopbackMediaTransport::OpenChannel( + int channel_id) { + // No-op. No need to open channels for the loopback. + return RTCError::OK(); +} + RTCError MediaTransportPair::LoopbackMediaTransport::SendData( int channel_id, const SendDataParams& params, diff --git a/api/test/loopback_media_transport.h b/api/test/loopback_media_transport.h index bcfdb63fd5..280dc9aaa9 100644 --- a/api/test/loopback_media_transport.h +++ b/api/test/loopback_media_transport.h @@ -113,6 +113,8 @@ class MediaTransportPair { void SetMediaTransportStateCallback( MediaTransportStateCallback* callback) override; + RTCError OpenChannel(int channel_id) override; + RTCError SendData(int channel_id, const SendDataParams& params, const rtc::CopyOnWriteBuffer& buffer) override;