Add an OpenChannel method to MediaTransportInterface and call it whenever PeerConnection opens a new data channel.

This informs the media transport that PeerConnection wants to use a data channel
and gives it a chance to set up before the data channel sends the first message.

Bug: webrtc:9719
Change-Id: I6ea905a74b29b8735e77ac68bc8606e7bca77f18
Reviewed-on: https://webrtc-review.googlesource.com/c/124020
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Slatala <psla@webrtc.org>
Commit-Queue: Bjorn Mellem <mellem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26823}
This commit is contained in:
Bjorn Mellem
2019-02-22 10:31:48 -08:00
committed by Commit Bot
parent 8f096d01fa
commit f58e43e2a6
3 changed files with 13 additions and 1 deletions

View File

@ -88,4 +88,11 @@ 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

@ -278,6 +278,11 @@ class MediaTransportInterface {
virtual void SetAllocatedBitrateLimits(
const MediaTransportAllocatedBitrateLimits& limits);
// 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);
// 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
// fails.