blob: e0a762a450d50566fb59797d78907077aaac6c02 [file] [log] [blame]
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -07001/* Copyright 2018 The WebRTC project authors. All Rights Reserved.
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -04002 *
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) Slatala6b9d8232018-10-26 07:59:46 -070020#include <api/transport/network_control.h>
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040021#include <memory>
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070022#include <string>
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040023#include <utility>
24#include <vector>
25
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070026#include "absl/types/optional.h"
Yves Gerey988cc082018-10-23 12:03:01 +020027#include "api/array_view.h"
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040028#include "api/rtcerror.h"
Niels Möller3a742392018-10-08 11:13:58 +020029#include "api/video/encoded_image.h"
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -070030#include "rtc_base/copyonwritebuffer.h"
Niels Möllerd8a1b7a2018-12-06 13:00:27 +010031#include "rtc_base/deprecation.h"
Piotr (Peter) Slatalaada077f2018-11-08 07:43:31 -080032#include "rtc_base/networkroute.h"
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040033
34namespace rtc {
35class PacketTransportInternal;
36class Thread;
37} // namespace rtc
38
39namespace webrtc {
40
Piotr (Peter) Slatala0c022502018-12-28 10:39:39 -080041class RtcEventLog;
42
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070043// A collection of settings for creation of media transport.
44struct MediaTransportSettings final {
45 MediaTransportSettings();
Piotr (Peter) Slatalaed7b8b12018-10-29 10:43:16 -070046 MediaTransportSettings(const MediaTransportSettings&);
47 MediaTransportSettings& operator=(const MediaTransportSettings&);
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070048 ~MediaTransportSettings();
49
50 // Group calls are not currently supported, in 1:1 call one side must set
51 // is_caller = true and another is_caller = false.
52 bool is_caller;
53
54 // Must be set if a pre-shared key is used for the call.
Piotr (Peter) Slatala9f956252018-10-31 08:25:26 -070055 // TODO(bugs.webrtc.org/9944): This should become zero buffer in the distant
56 // future.
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070057 absl::optional<std::string> pre_shared_key;
Piotr (Peter) Slatala0c022502018-12-28 10:39:39 -080058
59 // If present, provides the event log that media transport should use.
60 // Media transport does not own it. The lifetime of |event_log| will exceed
61 // the lifetime of the instance of MediaTransportInterface instance.
62 RtcEventLog* event_log = nullptr;
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -070063};
64
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040065// Represents encoded audio frame in any encoding (type of encoding is opaque).
66// To avoid copying of encoded data use move semantics when passing by value.
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -070067class MediaTransportEncodedAudioFrame final {
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040068 public:
69 enum class FrameType {
70 // Normal audio frame (equivalent to webrtc::kAudioFrameSpeech).
71 kSpeech,
72
73 // DTX frame (equivalent to webrtc::kAudioFrameCN).
Niels Möller7d76a312018-10-26 12:57:07 +020074 // DTX frame (equivalent to webrtc::kAudioFrameCN).
75 kDiscontinuousTransmission,
76 // TODO(nisse): Mis-spelled version, update users, then delete.
77 kDiscountinuousTransmission = kDiscontinuousTransmission,
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -040078 };
79
80 MediaTransportEncodedAudioFrame(
81 // Audio sampling rate, for example 48000.
82 int sampling_rate_hz,
83
84 // Starting sample index of the frame, i.e. how many audio samples were
85 // before this frame since the beginning of the call or beginning of time
86 // in one channel (the starting point should not matter for NetEq). In
87 // WebRTC it is used as a timestamp of the frame.
88 // TODO(sukhanov): Starting_sample_index is currently adjusted on the
89 // receiver side in RTP path. Non-RTP implementations should preserve it.
90 // For NetEq initial offset should not matter so we should consider fixing
91 // RTP path.
92 int starting_sample_index,
93
94 // Number of audio samples in audio frame in 1 channel.
95 int samples_per_channel,
96
97 // Sequence number of the frame in the order sent, it is currently
98 // required by NetEq, but we can fix NetEq, because starting_sample_index
99 // should be enough.
100 int sequence_number,
101
102 // If audio frame is a speech or discontinued transmission.
103 FrameType frame_type,
104
105 // Opaque payload type. In RTP codepath payload type is stored in RTP
106 // header. In other implementations it should be simply passed through the
107 // wire -- it's needed for decoder.
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100108 int payload_type,
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400109
110 // Vector with opaque encoded data.
Niels Möller3a742392018-10-08 11:13:58 +0200111 std::vector<uint8_t> encoded_data);
112
113 ~MediaTransportEncodedAudioFrame();
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700114 MediaTransportEncodedAudioFrame(const MediaTransportEncodedAudioFrame&);
115 MediaTransportEncodedAudioFrame& operator=(
116 const MediaTransportEncodedAudioFrame& other);
117 MediaTransportEncodedAudioFrame& operator=(
118 MediaTransportEncodedAudioFrame&& other);
119 MediaTransportEncodedAudioFrame(MediaTransportEncodedAudioFrame&&);
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400120
121 // Getters.
122 int sampling_rate_hz() const { return sampling_rate_hz_; }
123 int starting_sample_index() const { return starting_sample_index_; }
124 int samples_per_channel() const { return samples_per_channel_; }
125 int sequence_number() const { return sequence_number_; }
126
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100127 int payload_type() const { return payload_type_; }
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400128 FrameType frame_type() const { return frame_type_; }
129
130 rtc::ArrayView<const uint8_t> encoded_data() const { return encoded_data_; }
131
132 private:
133 int sampling_rate_hz_;
134 int starting_sample_index_;
135 int samples_per_channel_;
136
137 // TODO(sukhanov): Refactor NetEq so we don't need sequence number.
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700138 // Having sample_index and samples_per_channel should be enough.
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400139 int sequence_number_;
140
141 FrameType frame_type_;
142
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100143 int payload_type_;
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400144
145 std::vector<uint8_t> encoded_data_;
146};
147
Piotr (Peter) Slatalaada077f2018-11-08 07:43:31 -0800148// Callback to notify about network route changes.
149class MediaTransportNetworkChangeCallback {
150 public:
151 virtual ~MediaTransportNetworkChangeCallback() = default;
152
153 // Called when the network route is changed, with the new network route.
154 virtual void OnNetworkRouteChanged(
155 const rtc::NetworkRoute& new_network_route) = 0;
156};
157
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400158// Interface for receiving encoded audio frames from MediaTransportInterface
159// implementations.
160class MediaTransportAudioSinkInterface {
161 public:
162 virtual ~MediaTransportAudioSinkInterface() = default;
163
164 // Called when new encoded audio frame is received.
165 virtual void OnData(uint64_t channel_id,
166 MediaTransportEncodedAudioFrame frame) = 0;
167};
168
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700169// Represents encoded video frame, along with the codec information.
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700170class MediaTransportEncodedVideoFrame final {
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700171 public:
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100172 // TODO(bugs.webrtc.org/9719): Switch to payload_type
173 RTC_DEPRECATED MediaTransportEncodedVideoFrame(
174 int64_t frame_id,
175 std::vector<int64_t> referenced_frame_ids,
176 VideoCodecType codec_type,
177 const webrtc::EncodedImage& encoded_image);
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700178 MediaTransportEncodedVideoFrame(int64_t frame_id,
179 std::vector<int64_t> referenced_frame_ids,
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100180 int payload_type,
Niels Möller3a742392018-10-08 11:13:58 +0200181 const webrtc::EncodedImage& encoded_image);
182 ~MediaTransportEncodedVideoFrame();
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700183 MediaTransportEncodedVideoFrame(const MediaTransportEncodedVideoFrame&);
184 MediaTransportEncodedVideoFrame& operator=(
185 const MediaTransportEncodedVideoFrame& other);
186 MediaTransportEncodedVideoFrame& operator=(
187 MediaTransportEncodedVideoFrame&& other);
188 MediaTransportEncodedVideoFrame(MediaTransportEncodedVideoFrame&&);
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700189
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100190 // TODO(bugs.webrtc.org/9719): Switch to payload_type
191 RTC_DEPRECATED VideoCodecType codec_type() const { return codec_type_; }
192 int payload_type() const { return payload_type_; }
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700193 const webrtc::EncodedImage& encoded_image() const { return encoded_image_; }
194
195 int64_t frame_id() const { return frame_id_; }
196 const std::vector<int64_t>& referenced_frame_ids() const {
197 return referenced_frame_ids_;
198 }
199
Niels Möllerd5696fb2018-11-28 15:34:37 +0100200 // Hack to workaround lack of ownership of the encoded_image_._buffer. If we
201 // don't already own the underlying data, make a copy.
202 void Retain();
203
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700204 private:
Niels Möllerd5696fb2018-11-28 15:34:37 +0100205 MediaTransportEncodedVideoFrame();
206
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700207 VideoCodecType codec_type_;
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100208 int payload_type_;
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700209
Niels Möllerd5696fb2018-11-28 15:34:37 +0100210 // The buffer is not owned by the encoded image. On the sender it means that
211 // it will need to make a copy using the Retain() method, if it wants to
212 // deliver it asynchronously.
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700213 webrtc::EncodedImage encoded_image_;
214
Niels Möllerd5696fb2018-11-28 15:34:37 +0100215 // If non-empty, this is the data for the encoded image.
216 std::vector<uint8_t> encoded_data_;
217
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700218 // Frame id uniquely identifies a frame in a stream. It needs to be unique in
219 // a given time window (i.e. technically unique identifier for the lifetime of
220 // the connection is not needed, but you need to guarantee that remote side
221 // got rid of the previous frame_id if you plan to reuse it).
222 //
223 // It is required by a remote jitter buffer, and is the same as
224 // EncodedFrame::id::picture_id.
225 //
226 // This data must be opaque to the media transport, and media transport should
227 // itself not make any assumptions about what it is and its uniqueness.
228 int64_t frame_id_;
229
230 // A single frame might depend on other frames. This is set of identifiers on
231 // which the current frame depends.
232 std::vector<int64_t> referenced_frame_ids_;
233};
234
235// Interface for receiving encoded video frames from MediaTransportInterface
236// implementations.
237class MediaTransportVideoSinkInterface {
238 public:
239 virtual ~MediaTransportVideoSinkInterface() = default;
240
241 // Called when new encoded video frame is received.
242 virtual void OnData(uint64_t channel_id,
243 MediaTransportEncodedVideoFrame frame) = 0;
244
Niels Möllerd8a1b7a2018-12-06 13:00:27 +0100245 // TODO(bugs.webrtc.org/9719): Belongs on send side, not receive side.
246 RTC_DEPRECATED virtual void OnKeyFrameRequested(uint64_t channel_id) {}
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700247};
248
Niels Möller1c7f5f62018-12-10 11:06:02 +0100249// Interface for video sender to be notified of received key frame request.
250class MediaTransportKeyFrameRequestCallback {
251 public:
252 virtual ~MediaTransportKeyFrameRequestCallback() = default;
253
254 // Called when a key frame request is received on the transport.
255 virtual void OnKeyFrameRequested(uint64_t channel_id) = 0;
256};
257
Bjorn Mellemc78b0ea2018-10-29 15:21:31 -0700258// State of the media transport. Media transport begins in the pending state.
259// It transitions to writable when it is ready to send media. It may transition
260// back to pending if the connection is blocked. It may transition to closed at
261// any time. Closed is terminal: a transport will never re-open once closed.
262enum class MediaTransportState {
263 kPending,
264 kWritable,
265 kClosed,
266};
267
268// Callback invoked whenever the state of the media transport changes.
269class MediaTransportStateCallback {
270 public:
271 virtual ~MediaTransportStateCallback() = default;
272
273 // Invoked whenever the state of the media transport changes.
274 virtual void OnStateChanged(MediaTransportState state) = 0;
275};
276
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700277// Supported types of application data messages.
278enum class DataMessageType {
279 // Application data buffer with the binary bit unset.
280 kText,
281
282 // Application data buffer with the binary bit set.
283 kBinary,
284
285 // Transport-agnostic control messages, such as open or open-ack messages.
286 kControl,
287};
288
289// Parameters for sending data. The parameters may change from message to
290// message, even within a single channel. For example, control messages may be
291// sent reliably and in-order, even if the data channel is configured for
292// unreliable delivery.
293struct SendDataParams {
294 SendDataParams();
Niels Möllere0446cb2018-11-30 09:35:52 +0100295 SendDataParams(const SendDataParams&);
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700296
297 DataMessageType type = DataMessageType::kText;
298
299 // Whether to deliver the message in order with respect to other ordered
300 // messages with the same channel_id.
301 bool ordered = false;
302
303 // If set, the maximum number of times this message may be
304 // retransmitted by the transport before it is dropped.
305 // Setting this value to zero disables retransmission.
306 // Must be non-negative. |max_rtx_count| and |max_rtx_ms| may not be set
307 // simultaneously.
308 absl::optional<int> max_rtx_count;
309
310 // If set, the maximum number of milliseconds for which the transport
311 // may retransmit this message before it is dropped.
312 // Setting this value to zero disables retransmission.
313 // Must be non-negative. |max_rtx_count| and |max_rtx_ms| may not be set
314 // simultaneously.
315 absl::optional<int> max_rtx_ms;
316};
317
318// Sink for callbacks related to a data channel.
319class DataChannelSink {
320 public:
321 virtual ~DataChannelSink() = default;
322
323 // Callback issued when data is received by the transport.
324 virtual void OnDataReceived(int channel_id,
325 DataMessageType type,
326 const rtc::CopyOnWriteBuffer& buffer) = 0;
327
328 // Callback issued when a remote data channel begins the closing procedure.
329 // Messages sent after the closing procedure begins will not be transmitted.
330 virtual void OnChannelClosing(int channel_id) = 0;
331
332 // Callback issued when a (remote or local) data channel completes the closing
333 // procedure. Closing channels become closed after all pending data has been
334 // transmitted.
335 virtual void OnChannelClosed(int channel_id) = 0;
336};
337
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400338// Media transport interface for sending / receiving encoded audio/video frames
339// and receiving bandwidth estimate update from congestion control.
340class MediaTransportInterface {
341 public:
342 virtual ~MediaTransportInterface() = default;
343
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700344 // Start asynchronous send of audio frame. The status returned by this method
345 // only pertains to the synchronous operations (e.g.
346 // serialization/packetization), not to the asynchronous operation.
347
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400348 virtual RTCError SendAudioFrame(uint64_t channel_id,
349 MediaTransportEncodedAudioFrame frame) = 0;
350
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700351 // Start asynchronous send of video frame. The status returned by this method
352 // only pertains to the synchronous operations (e.g.
353 // serialization/packetization), not to the asynchronous operation.
354 virtual RTCError SendVideoFrame(
355 uint64_t channel_id,
356 const MediaTransportEncodedVideoFrame& frame) = 0;
357
Niels Möller1c7f5f62018-12-10 11:06:02 +0100358 // Used by video sender to be notified on key frame requests.
359 virtual void SetKeyFrameRequestCallback(
360 MediaTransportKeyFrameRequestCallback* callback);
361
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700362 // Requests a keyframe for the particular channel (stream). The caller should
363 // check that the keyframe is not present in a jitter buffer already (i.e.
364 // don't request a keyframe if there is one that you will get from the jitter
365 // buffer in a moment).
366 virtual RTCError RequestKeyFrame(uint64_t channel_id) = 0;
367
368 // Sets audio sink. Sink must be unset by calling SetReceiveAudioSink(nullptr)
369 // before the media transport is destroyed or before new sink is set.
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400370 virtual void SetReceiveAudioSink(MediaTransportAudioSinkInterface* sink) = 0;
371
Piotr (Peter) Slatalae804f922018-09-25 08:40:30 -0700372 // Registers a video sink. Before destruction of media transport, you must
373 // pass a nullptr.
374 virtual void SetReceiveVideoSink(MediaTransportVideoSinkInterface* sink) = 0;
375
Piotr (Peter) Slatalaada077f2018-11-08 07:43:31 -0800376 // Adds a target bitrate observer. Before media transport is destructed
377 // the observer must be unregistered (by calling
378 // RemoveTargetTransferRateObserver).
379 // A newly registered observer will be called back with the latest recorded
380 // target rate, if available.
381 virtual void AddTargetTransferRateObserver(
382 webrtc::TargetTransferRateObserver* observer);
383
384 // Removes an existing |observer| from observers. If observer was never
385 // registered, an error is logged and method does nothing.
386 virtual void RemoveTargetTransferRateObserver(
387 webrtc::TargetTransferRateObserver* observer);
388
389 // Returns the last known target transfer rate as reported to the above
390 // observers.
391 virtual absl::optional<TargetTransferRate> GetLatestTargetTransferRate();
392
393 // Gets the audio packet overhead in bytes. Returned overhead does not include
394 // transport overhead (ipv4/6, turn channeldata, tcp/udp, etc.).
395 // If the transport is capable of fusing packets together, this overhead
396 // might not be a very accurate number.
397 virtual size_t GetAudioPacketOverhead() const;
398
399 // Sets an observer for network change events. If the network route is already
400 // established when the callback is set, |callback| will be called immediately
401 // with the current network route.
402 // Before media transport is destroyed, the callback must be unregistered by
403 // setting it to nullptr.
404 virtual void SetNetworkChangeCallback(
405 MediaTransportNetworkChangeCallback* callback);
Piotr (Peter) Slatala6b9d8232018-10-26 07:59:46 -0700406
Bjorn Mellemc78b0ea2018-10-29 15:21:31 -0700407 // Sets a state observer callback. Before media transport is destroyed, the
408 // callback must be unregistered by setting it to nullptr.
409 // A newly registered callback will be called with the current state.
410 // Media transport does not invoke this callback concurrently.
Bjorn Mellemc78b0ea2018-10-29 15:21:31 -0700411 virtual void SetMediaTransportStateCallback(
Bjorn Mellemeb2c6412018-10-31 15:25:32 -0700412 MediaTransportStateCallback* callback) = 0;
Bjorn Mellemc78b0ea2018-10-29 15:21:31 -0700413
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700414 // Sends a data buffer to the remote endpoint using the given send parameters.
415 // |buffer| may not be larger than 256 KiB. Returns an error if the send
416 // fails.
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700417 virtual RTCError SendData(int channel_id,
418 const SendDataParams& params,
Bjorn Mellemeb2c6412018-10-31 15:25:32 -0700419 const rtc::CopyOnWriteBuffer& buffer) = 0;
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700420
421 // Closes |channel_id| gracefully. Returns an error if |channel_id| is not
422 // open. Data sent after the closing procedure begins will not be
423 // transmitted. The channel becomes closed after pending data is transmitted.
Bjorn Mellemeb2c6412018-10-31 15:25:32 -0700424 virtual RTCError CloseChannel(int channel_id) = 0;
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700425
426 // Sets a sink for data messages and channel state callbacks. Before media
427 // transport is destroyed, the sink must be unregistered by setting it to
428 // nullptr.
Bjorn Mellemeb2c6412018-10-31 15:25:32 -0700429 virtual void SetDataSink(DataChannelSink* sink) = 0;
Bjorn Mellem1f6aa9f2018-10-30 15:15:00 -0700430
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400431 // TODO(sukhanov): RtcEventLogs.
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400432};
433
434// If media transport factory is set in peer connection factory, it will be
435// used to create media transport for sending/receiving encoded frames and
436// this transport will be used instead of default RTP/SRTP transport.
437//
438// Currently Media Transport negotiation is not supported in SDP.
439// If application is using media transport, it must negotiate it before
440// setting media transport factory in peer connection.
441class MediaTransportFactory {
442 public:
443 virtual ~MediaTransportFactory() = default;
444
445 // Creates media transport.
446 // - Does not take ownership of packet_transport or network_thread.
447 // - Does not support group calls, in 1:1 call one side must set
448 // is_caller = true and another is_caller = false.
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -0700449 // TODO(bugs.webrtc.org/9938) This constructor will be removed and replaced
450 // with the one below.
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400451 virtual RTCErrorOr<std::unique_ptr<MediaTransportInterface>>
452 CreateMediaTransport(rtc::PacketTransportInternal* packet_transport,
453 rtc::Thread* network_thread,
Piotr (Peter) Slatalaa0677d12018-10-29 07:31:42 -0700454 bool is_caller);
455
456 // Creates media transport.
457 // - Does not take ownership of packet_transport or network_thread.
458 // TODO(bugs.webrtc.org/9938): remove default implementation once all children
459 // override it.
460 virtual RTCErrorOr<std::unique_ptr<MediaTransportInterface>>
461 CreateMediaTransport(rtc::PacketTransportInternal* packet_transport,
462 rtc::Thread* network_thread,
Piotr (Peter) Slatalaed7b8b12018-10-29 10:43:16 -0700463 const MediaTransportSettings& settings);
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400464};
465
466} // namespace webrtc
Anton Sukhanovf60bd4b2018-09-05 13:41:46 -0400467#endif // API_MEDIA_TRANSPORT_INTERFACE_H_