Implement OpenChannel() on test media transports and make it pure virtual.

Bug: webrtc:9719
Change-Id: I9ec89fca7d4555f31b5192980f193b58d99e3b71
Reviewed-on: https://webrtc-review.googlesource.com/c/125100
Reviewed-by: Peter Slatala <psla@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26910}
This commit is contained in:
Bjorn Mellem
2019-02-28 12:27:11 -08:00
committed by Commit Bot
parent 766f62432e
commit 9ded485caa
5 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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,

View File

@ -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;