Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 1 | /* Copyright 2018 The WebRTC project authors. All Rights Reserved. |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 2 | * |
| 3 | * Use of this source code is governed by a BSD-style license |
| 4 | * that can be found in the LICENSE file in the root of the source |
| 5 | * tree. An additional intellectual property rights grant can be found |
| 6 | * in the file PATENTS. All contributing project authors may |
| 7 | * be found in the AUTHORS file in the root of the source tree. |
| 8 | */ |
| 9 | |
| 10 | // This is EXPERIMENTAL interface for media transport. |
| 11 | // |
| 12 | // The goal is to refactor WebRTC code so that audio and video frames |
| 13 | // are sent / received through the media transport interface. This will |
| 14 | // enable different media transport implementations, including QUIC-based |
| 15 | // media transport. |
| 16 | |
| 17 | #ifndef API_MEDIA_TRANSPORT_INTERFACE_H_ |
| 18 | #define API_MEDIA_TRANSPORT_INTERFACE_H_ |
| 19 | |
Piotr (Peter) Slatala | 6b9d823 | 2018-10-26 07:59:46 -0700 | [diff] [blame] | 20 | #include <api/transport/network_control.h> |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 21 | #include <memory> |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 22 | #include <string> |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 23 | #include <utility> |
| 24 | #include <vector> |
| 25 | |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 26 | #include "absl/types/optional.h" |
Yves Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 27 | #include "api/array_view.h" |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 28 | #include "api/rtcerror.h" |
Niels Möller | 3a74239 | 2018-10-08 11:13:58 +0200 | [diff] [blame] | 29 | #include "api/video/encoded_image.h" |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 30 | #include "common_types.h" // NOLINT(build/include) |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 31 | #include "rtc_base/copyonwritebuffer.h" |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 32 | |
| 33 | namespace rtc { |
| 34 | class PacketTransportInternal; |
| 35 | class Thread; |
| 36 | } // namespace rtc |
| 37 | |
| 38 | namespace webrtc { |
| 39 | |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 40 | // A collection of settings for creation of media transport. |
| 41 | struct MediaTransportSettings final { |
| 42 | MediaTransportSettings(); |
Piotr (Peter) Slatala | ed7b8b1 | 2018-10-29 10:43:16 -0700 | [diff] [blame] | 43 | MediaTransportSettings(const MediaTransportSettings&); |
| 44 | MediaTransportSettings& operator=(const MediaTransportSettings&); |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 45 | ~MediaTransportSettings(); |
| 46 | |
| 47 | // Group calls are not currently supported, in 1:1 call one side must set |
| 48 | // is_caller = true and another is_caller = false. |
| 49 | bool is_caller; |
| 50 | |
| 51 | // Must be set if a pre-shared key is used for the call. |
Piotr (Peter) Slatala | 9f95625 | 2018-10-31 08:25:26 -0700 | [diff] [blame] | 52 | // TODO(bugs.webrtc.org/9944): This should become zero buffer in the distant |
| 53 | // future. |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 54 | absl::optional<std::string> pre_shared_key; |
| 55 | }; |
| 56 | |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 57 | // Represents encoded audio frame in any encoding (type of encoding is opaque). |
| 58 | // To avoid copying of encoded data use move semantics when passing by value. |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 59 | class MediaTransportEncodedAudioFrame final { |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 60 | public: |
| 61 | enum class FrameType { |
| 62 | // Normal audio frame (equivalent to webrtc::kAudioFrameSpeech). |
| 63 | kSpeech, |
| 64 | |
| 65 | // DTX frame (equivalent to webrtc::kAudioFrameCN). |
Niels Möller | 7d76a31 | 2018-10-26 12:57:07 +0200 | [diff] [blame] | 66 | // DTX frame (equivalent to webrtc::kAudioFrameCN). |
| 67 | kDiscontinuousTransmission, |
| 68 | // TODO(nisse): Mis-spelled version, update users, then delete. |
| 69 | kDiscountinuousTransmission = kDiscontinuousTransmission, |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | MediaTransportEncodedAudioFrame( |
| 73 | // Audio sampling rate, for example 48000. |
| 74 | int sampling_rate_hz, |
| 75 | |
| 76 | // Starting sample index of the frame, i.e. how many audio samples were |
| 77 | // before this frame since the beginning of the call or beginning of time |
| 78 | // in one channel (the starting point should not matter for NetEq). In |
| 79 | // WebRTC it is used as a timestamp of the frame. |
| 80 | // TODO(sukhanov): Starting_sample_index is currently adjusted on the |
| 81 | // receiver side in RTP path. Non-RTP implementations should preserve it. |
| 82 | // For NetEq initial offset should not matter so we should consider fixing |
| 83 | // RTP path. |
| 84 | int starting_sample_index, |
| 85 | |
| 86 | // Number of audio samples in audio frame in 1 channel. |
| 87 | int samples_per_channel, |
| 88 | |
| 89 | // Sequence number of the frame in the order sent, it is currently |
| 90 | // required by NetEq, but we can fix NetEq, because starting_sample_index |
| 91 | // should be enough. |
| 92 | int sequence_number, |
| 93 | |
| 94 | // If audio frame is a speech or discontinued transmission. |
| 95 | FrameType frame_type, |
| 96 | |
| 97 | // Opaque payload type. In RTP codepath payload type is stored in RTP |
| 98 | // header. In other implementations it should be simply passed through the |
| 99 | // wire -- it's needed for decoder. |
| 100 | uint8_t payload_type, |
| 101 | |
| 102 | // Vector with opaque encoded data. |
Niels Möller | 3a74239 | 2018-10-08 11:13:58 +0200 | [diff] [blame] | 103 | std::vector<uint8_t> encoded_data); |
| 104 | |
| 105 | ~MediaTransportEncodedAudioFrame(); |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 106 | MediaTransportEncodedAudioFrame(const MediaTransportEncodedAudioFrame&); |
| 107 | MediaTransportEncodedAudioFrame& operator=( |
| 108 | const MediaTransportEncodedAudioFrame& other); |
| 109 | MediaTransportEncodedAudioFrame& operator=( |
| 110 | MediaTransportEncodedAudioFrame&& other); |
| 111 | MediaTransportEncodedAudioFrame(MediaTransportEncodedAudioFrame&&); |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 112 | |
| 113 | // Getters. |
| 114 | int sampling_rate_hz() const { return sampling_rate_hz_; } |
| 115 | int starting_sample_index() const { return starting_sample_index_; } |
| 116 | int samples_per_channel() const { return samples_per_channel_; } |
| 117 | int sequence_number() const { return sequence_number_; } |
| 118 | |
| 119 | uint8_t payload_type() const { return payload_type_; } |
| 120 | FrameType frame_type() const { return frame_type_; } |
| 121 | |
| 122 | rtc::ArrayView<const uint8_t> encoded_data() const { return encoded_data_; } |
| 123 | |
| 124 | private: |
| 125 | int sampling_rate_hz_; |
| 126 | int starting_sample_index_; |
| 127 | int samples_per_channel_; |
| 128 | |
| 129 | // TODO(sukhanov): Refactor NetEq so we don't need sequence number. |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 130 | // Having sample_index and samples_per_channel should be enough. |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 131 | int sequence_number_; |
| 132 | |
| 133 | FrameType frame_type_; |
| 134 | |
| 135 | // TODO(sukhanov): Consider enumerating allowed encodings and store enum |
| 136 | // instead of uint payload_type. |
| 137 | uint8_t payload_type_; |
| 138 | |
| 139 | std::vector<uint8_t> encoded_data_; |
| 140 | }; |
| 141 | |
| 142 | // Interface for receiving encoded audio frames from MediaTransportInterface |
| 143 | // implementations. |
| 144 | class MediaTransportAudioSinkInterface { |
| 145 | public: |
| 146 | virtual ~MediaTransportAudioSinkInterface() = default; |
| 147 | |
| 148 | // Called when new encoded audio frame is received. |
| 149 | virtual void OnData(uint64_t channel_id, |
| 150 | MediaTransportEncodedAudioFrame frame) = 0; |
| 151 | }; |
| 152 | |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 153 | // Represents encoded video frame, along with the codec information. |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 154 | class MediaTransportEncodedVideoFrame final { |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 155 | public: |
| 156 | MediaTransportEncodedVideoFrame(int64_t frame_id, |
| 157 | std::vector<int64_t> referenced_frame_ids, |
| 158 | VideoCodecType codec_type, |
Niels Möller | 3a74239 | 2018-10-08 11:13:58 +0200 | [diff] [blame] | 159 | const webrtc::EncodedImage& encoded_image); |
| 160 | ~MediaTransportEncodedVideoFrame(); |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 161 | MediaTransportEncodedVideoFrame(const MediaTransportEncodedVideoFrame&); |
| 162 | MediaTransportEncodedVideoFrame& operator=( |
| 163 | const MediaTransportEncodedVideoFrame& other); |
| 164 | MediaTransportEncodedVideoFrame& operator=( |
| 165 | MediaTransportEncodedVideoFrame&& other); |
| 166 | MediaTransportEncodedVideoFrame(MediaTransportEncodedVideoFrame&&); |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 167 | |
| 168 | VideoCodecType codec_type() const { return codec_type_; } |
| 169 | const webrtc::EncodedImage& encoded_image() const { return encoded_image_; } |
| 170 | |
| 171 | int64_t frame_id() const { return frame_id_; } |
| 172 | const std::vector<int64_t>& referenced_frame_ids() const { |
| 173 | return referenced_frame_ids_; |
| 174 | } |
| 175 | |
| 176 | private: |
| 177 | VideoCodecType codec_type_; |
| 178 | |
| 179 | // The buffer is not owned by the encoded image by default. On the sender it |
| 180 | // means that it will need to make a copy of it if it wants to deliver it |
| 181 | // asynchronously. |
| 182 | webrtc::EncodedImage encoded_image_; |
| 183 | |
| 184 | // Frame id uniquely identifies a frame in a stream. It needs to be unique in |
| 185 | // a given time window (i.e. technically unique identifier for the lifetime of |
| 186 | // the connection is not needed, but you need to guarantee that remote side |
| 187 | // got rid of the previous frame_id if you plan to reuse it). |
| 188 | // |
| 189 | // It is required by a remote jitter buffer, and is the same as |
| 190 | // EncodedFrame::id::picture_id. |
| 191 | // |
| 192 | // This data must be opaque to the media transport, and media transport should |
| 193 | // itself not make any assumptions about what it is and its uniqueness. |
| 194 | int64_t frame_id_; |
| 195 | |
| 196 | // A single frame might depend on other frames. This is set of identifiers on |
| 197 | // which the current frame depends. |
| 198 | std::vector<int64_t> referenced_frame_ids_; |
| 199 | }; |
| 200 | |
| 201 | // Interface for receiving encoded video frames from MediaTransportInterface |
| 202 | // implementations. |
| 203 | class MediaTransportVideoSinkInterface { |
| 204 | public: |
| 205 | virtual ~MediaTransportVideoSinkInterface() = default; |
| 206 | |
| 207 | // Called when new encoded video frame is received. |
| 208 | virtual void OnData(uint64_t channel_id, |
| 209 | MediaTransportEncodedVideoFrame frame) = 0; |
| 210 | |
| 211 | // Called when the request for keyframe is received. |
| 212 | virtual void OnKeyFrameRequested(uint64_t channel_id) = 0; |
| 213 | }; |
| 214 | |
Bjorn Mellem | c78b0ea | 2018-10-29 15:21:31 -0700 | [diff] [blame] | 215 | // State of the media transport. Media transport begins in the pending state. |
| 216 | // It transitions to writable when it is ready to send media. It may transition |
| 217 | // back to pending if the connection is blocked. It may transition to closed at |
| 218 | // any time. Closed is terminal: a transport will never re-open once closed. |
| 219 | enum class MediaTransportState { |
| 220 | kPending, |
| 221 | kWritable, |
| 222 | kClosed, |
| 223 | }; |
| 224 | |
| 225 | // Callback invoked whenever the state of the media transport changes. |
| 226 | class MediaTransportStateCallback { |
| 227 | public: |
| 228 | virtual ~MediaTransportStateCallback() = default; |
| 229 | |
| 230 | // Invoked whenever the state of the media transport changes. |
| 231 | virtual void OnStateChanged(MediaTransportState state) = 0; |
| 232 | }; |
| 233 | |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 234 | // Supported types of application data messages. |
| 235 | enum class DataMessageType { |
| 236 | // Application data buffer with the binary bit unset. |
| 237 | kText, |
| 238 | |
| 239 | // Application data buffer with the binary bit set. |
| 240 | kBinary, |
| 241 | |
| 242 | // Transport-agnostic control messages, such as open or open-ack messages. |
| 243 | kControl, |
| 244 | }; |
| 245 | |
| 246 | // Parameters for sending data. The parameters may change from message to |
| 247 | // message, even within a single channel. For example, control messages may be |
| 248 | // sent reliably and in-order, even if the data channel is configured for |
| 249 | // unreliable delivery. |
| 250 | struct SendDataParams { |
| 251 | SendDataParams(); |
| 252 | |
| 253 | DataMessageType type = DataMessageType::kText; |
| 254 | |
| 255 | // Whether to deliver the message in order with respect to other ordered |
| 256 | // messages with the same channel_id. |
| 257 | bool ordered = false; |
| 258 | |
| 259 | // If set, the maximum number of times this message may be |
| 260 | // retransmitted by the transport before it is dropped. |
| 261 | // Setting this value to zero disables retransmission. |
| 262 | // Must be non-negative. |max_rtx_count| and |max_rtx_ms| may not be set |
| 263 | // simultaneously. |
| 264 | absl::optional<int> max_rtx_count; |
| 265 | |
| 266 | // If set, the maximum number of milliseconds for which the transport |
| 267 | // may retransmit this message before it is dropped. |
| 268 | // Setting this value to zero disables retransmission. |
| 269 | // Must be non-negative. |max_rtx_count| and |max_rtx_ms| may not be set |
| 270 | // simultaneously. |
| 271 | absl::optional<int> max_rtx_ms; |
| 272 | }; |
| 273 | |
| 274 | // Sink for callbacks related to a data channel. |
| 275 | class DataChannelSink { |
| 276 | public: |
| 277 | virtual ~DataChannelSink() = default; |
| 278 | |
| 279 | // Callback issued when data is received by the transport. |
| 280 | virtual void OnDataReceived(int channel_id, |
| 281 | DataMessageType type, |
| 282 | const rtc::CopyOnWriteBuffer& buffer) = 0; |
| 283 | |
| 284 | // Callback issued when a remote data channel begins the closing procedure. |
| 285 | // Messages sent after the closing procedure begins will not be transmitted. |
| 286 | virtual void OnChannelClosing(int channel_id) = 0; |
| 287 | |
| 288 | // Callback issued when a (remote or local) data channel completes the closing |
| 289 | // procedure. Closing channels become closed after all pending data has been |
| 290 | // transmitted. |
| 291 | virtual void OnChannelClosed(int channel_id) = 0; |
| 292 | }; |
| 293 | |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 294 | // Media transport interface for sending / receiving encoded audio/video frames |
| 295 | // and receiving bandwidth estimate update from congestion control. |
| 296 | class MediaTransportInterface { |
| 297 | public: |
| 298 | virtual ~MediaTransportInterface() = default; |
| 299 | |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 300 | // Start asynchronous send of audio frame. The status returned by this method |
| 301 | // only pertains to the synchronous operations (e.g. |
| 302 | // serialization/packetization), not to the asynchronous operation. |
| 303 | |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 304 | virtual RTCError SendAudioFrame(uint64_t channel_id, |
| 305 | MediaTransportEncodedAudioFrame frame) = 0; |
| 306 | |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 307 | // Start asynchronous send of video frame. The status returned by this method |
| 308 | // only pertains to the synchronous operations (e.g. |
| 309 | // serialization/packetization), not to the asynchronous operation. |
| 310 | virtual RTCError SendVideoFrame( |
| 311 | uint64_t channel_id, |
| 312 | const MediaTransportEncodedVideoFrame& frame) = 0; |
| 313 | |
| 314 | // Requests a keyframe for the particular channel (stream). The caller should |
| 315 | // check that the keyframe is not present in a jitter buffer already (i.e. |
| 316 | // don't request a keyframe if there is one that you will get from the jitter |
| 317 | // buffer in a moment). |
| 318 | virtual RTCError RequestKeyFrame(uint64_t channel_id) = 0; |
| 319 | |
| 320 | // Sets audio sink. Sink must be unset by calling SetReceiveAudioSink(nullptr) |
| 321 | // before the media transport is destroyed or before new sink is set. |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 322 | virtual void SetReceiveAudioSink(MediaTransportAudioSinkInterface* sink) = 0; |
| 323 | |
Piotr (Peter) Slatala | e804f92 | 2018-09-25 08:40:30 -0700 | [diff] [blame] | 324 | // Registers a video sink. Before destruction of media transport, you must |
| 325 | // pass a nullptr. |
| 326 | virtual void SetReceiveVideoSink(MediaTransportVideoSinkInterface* sink) = 0; |
| 327 | |
Piotr (Peter) Slatala | 6b9d823 | 2018-10-26 07:59:46 -0700 | [diff] [blame] | 328 | // Sets a target bitrate observer. Before media transport is destructed |
| 329 | // the observer must be unregistered (set to nullptr). |
| 330 | // A newly registered observer will be called back with the latest recorded |
| 331 | // target rate, if available. |
| 332 | virtual void SetTargetTransferRateObserver( |
| 333 | webrtc::TargetTransferRateObserver* observer) = 0; |
| 334 | |
Bjorn Mellem | c78b0ea | 2018-10-29 15:21:31 -0700 | [diff] [blame] | 335 | // Sets a state observer callback. Before media transport is destroyed, the |
| 336 | // callback must be unregistered by setting it to nullptr. |
| 337 | // A newly registered callback will be called with the current state. |
| 338 | // Media transport does not invoke this callback concurrently. |
Bjorn Mellem | c78b0ea | 2018-10-29 15:21:31 -0700 | [diff] [blame] | 339 | virtual void SetMediaTransportStateCallback( |
Bjorn Mellem | eb2c641 | 2018-10-31 15:25:32 -0700 | [diff] [blame^] | 340 | MediaTransportStateCallback* callback) = 0; |
Bjorn Mellem | c78b0ea | 2018-10-29 15:21:31 -0700 | [diff] [blame] | 341 | |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 342 | // Sends a data buffer to the remote endpoint using the given send parameters. |
| 343 | // |buffer| may not be larger than 256 KiB. Returns an error if the send |
| 344 | // fails. |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 345 | virtual RTCError SendData(int channel_id, |
| 346 | const SendDataParams& params, |
Bjorn Mellem | eb2c641 | 2018-10-31 15:25:32 -0700 | [diff] [blame^] | 347 | const rtc::CopyOnWriteBuffer& buffer) = 0; |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 348 | |
| 349 | // Closes |channel_id| gracefully. Returns an error if |channel_id| is not |
| 350 | // open. Data sent after the closing procedure begins will not be |
| 351 | // transmitted. The channel becomes closed after pending data is transmitted. |
Bjorn Mellem | eb2c641 | 2018-10-31 15:25:32 -0700 | [diff] [blame^] | 352 | virtual RTCError CloseChannel(int channel_id) = 0; |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 353 | |
| 354 | // Sets a sink for data messages and channel state callbacks. Before media |
| 355 | // transport is destroyed, the sink must be unregistered by setting it to |
| 356 | // nullptr. |
Bjorn Mellem | eb2c641 | 2018-10-31 15:25:32 -0700 | [diff] [blame^] | 357 | virtual void SetDataSink(DataChannelSink* sink) = 0; |
Bjorn Mellem | 1f6aa9f | 2018-10-30 15:15:00 -0700 | [diff] [blame] | 358 | |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 359 | // TODO(sukhanov): RtcEventLogs. |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 360 | }; |
| 361 | |
| 362 | // If media transport factory is set in peer connection factory, it will be |
| 363 | // used to create media transport for sending/receiving encoded frames and |
| 364 | // this transport will be used instead of default RTP/SRTP transport. |
| 365 | // |
| 366 | // Currently Media Transport negotiation is not supported in SDP. |
| 367 | // If application is using media transport, it must negotiate it before |
| 368 | // setting media transport factory in peer connection. |
| 369 | class MediaTransportFactory { |
| 370 | public: |
| 371 | virtual ~MediaTransportFactory() = default; |
| 372 | |
| 373 | // Creates media transport. |
| 374 | // - Does not take ownership of packet_transport or network_thread. |
| 375 | // - Does not support group calls, in 1:1 call one side must set |
| 376 | // is_caller = true and another is_caller = false. |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 377 | // TODO(bugs.webrtc.org/9938) This constructor will be removed and replaced |
| 378 | // with the one below. |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 379 | virtual RTCErrorOr<std::unique_ptr<MediaTransportInterface>> |
| 380 | CreateMediaTransport(rtc::PacketTransportInternal* packet_transport, |
| 381 | rtc::Thread* network_thread, |
Piotr (Peter) Slatala | a0677d1 | 2018-10-29 07:31:42 -0700 | [diff] [blame] | 382 | bool is_caller); |
| 383 | |
| 384 | // Creates media transport. |
| 385 | // - Does not take ownership of packet_transport or network_thread. |
| 386 | // TODO(bugs.webrtc.org/9938): remove default implementation once all children |
| 387 | // override it. |
| 388 | virtual RTCErrorOr<std::unique_ptr<MediaTransportInterface>> |
| 389 | CreateMediaTransport(rtc::PacketTransportInternal* packet_transport, |
| 390 | rtc::Thread* network_thread, |
Piotr (Peter) Slatala | ed7b8b1 | 2018-10-29 10:43:16 -0700 | [diff] [blame] | 391 | const MediaTransportSettings& settings); |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 392 | }; |
| 393 | |
| 394 | } // namespace webrtc |
Anton Sukhanov | f60bd4b | 2018-09-05 13:41:46 -0400 | [diff] [blame] | 395 | #endif // API_MEDIA_TRANSPORT_INTERFACE_H_ |