blob: fd4dfaa7907ffc28c7716c6bed0726eeb4d8fec4 [file] [log] [blame]
deadbeefe814a0d2017-02-25 18:15:09 -08001/*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11// This file contains interfaces for RtpSenders:
12// http://publications.ortc.org/2016/20161202/#rtcrtpsender*
13//
14// However, underneath the RtpSender is an RtpTransport, rather than a
15// DtlsTransport. This is to allow different types of RTP transports (besides
16// DTLS-SRTP) to be used.
17
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#ifndef API_ORTC_ORTCRTPSENDERINTERFACE_H_
19#define API_ORTC_ORTCRTPSENDERINTERFACE_H_
deadbeefe814a0d2017-02-25 18:15:09 -080020
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020021#include "api/mediastreaminterface.h"
22#include "api/mediatypes.h"
23#include "api/ortc/rtptransportinterface.h"
24#include "api/rtcerror.h"
25#include "api/rtpparameters.h"
deadbeefe814a0d2017-02-25 18:15:09 -080026
27namespace webrtc {
28
29// Note: Since sender capabilities may depend on how the OrtcFactory was
30// created, instead of a static "GetCapabilities" method on this interface,
31// there is a "GetRtpSenderCapabilities" method on the OrtcFactory.
32class OrtcRtpSenderInterface {
33 public:
34 virtual ~OrtcRtpSenderInterface() {}
35
36 // Sets the source of media that will be sent by this sender.
37 //
38 // If Send has already been called, will immediately switch to sending this
39 // track. If |track| is null, will stop sending media.
40 //
41 // Returns INVALID_PARAMETER error if an audio track is set on a video
42 // RtpSender, or vice-versa.
43 virtual RTCError SetTrack(MediaStreamTrackInterface* track) = 0;
44 // Returns previously set (or constructed-with) track.
45 virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0;
46
47 // Once supported, will switch to sending media on a new transport. However,
48 // this is not currently supported and will always return an error.
49 virtual RTCError SetTransport(RtpTransportInterface* transport) = 0;
50 // Returns previously set (or constructed-with) transport.
51 virtual RtpTransportInterface* GetTransport() const = 0;
52
53 // Start sending media with |parameters| (if |parameters| contains an active
54 // encoding).
55 //
56 // There are no limitations to how the parameters can be changed after the
57 // initial call to Send, as long as they're valid (for example, they can't
58 // use the same payload type for two codecs).
59 virtual RTCError Send(const RtpParameters& parameters) = 0;
60 // Returns parameters that were last successfully passed into Send, or empty
61 // parameters if that hasn't yet occurred.
62 //
63 // Note that for parameters that are described as having an "implementation
64 // default" value chosen, GetParameters() will return those chosen defaults,
65 // with the exception of SSRCs which have special behavior. See
66 // rtpparameters.h for more details.
67 virtual RtpParameters GetParameters() const = 0;
68
69 // Audio or video sender?
70 virtual cricket::MediaType GetKind() const = 0;
71
72 // TODO(deadbeef): SSRC conflict signal.
73};
74
75} // namespace webrtc
76
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020077#endif // API_ORTC_ORTCRTPSENDERINTERFACE_H_