deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 1 | /* |
| 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 RtpReceivers: |
| 12 | // http://publications.ortc.org/2016/20161202/#rtcrtpreceiver* |
| 13 | // |
| 14 | // However, underneath the RtpReceiver 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 Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #ifndef API_ORTC_ORTCRTPRECEIVERINTERFACE_H_ |
| 19 | #define API_ORTC_ORTCRTPRECEIVERINTERFACE_H_ |
deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 20 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #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" |
deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 26 | |
| 27 | namespace webrtc { |
| 28 | |
| 29 | // Note: Since receiver capabilities may depend on how the OrtcFactory was |
| 30 | // created, instead of a static "GetCapabilities" method on this interface, |
| 31 | // there is a "GetRtpReceiverCapabilities" method on the OrtcFactory. |
| 32 | class OrtcRtpReceiverInterface { |
| 33 | public: |
| 34 | virtual ~OrtcRtpReceiverInterface() {} |
| 35 | |
| 36 | // Returns a track representing the media received by this receiver. |
| 37 | // |
| 38 | // Currently, this will return null until Receive has been successfully |
| 39 | // called. Also, a new track will be created every time the primary SSRC |
| 40 | // changes. |
| 41 | // |
| 42 | // If encodings are removed, GetTrack will return null. Though deactivating |
| 43 | // an encoding (setting |active| to false) will not do this. |
| 44 | // |
| 45 | // In the future, these limitations will be fixed, and GetTrack will return |
| 46 | // the same track for the lifetime of the RtpReceiver. So it's not |
| 47 | // recommended to write code that depends on this non-standard behavior. |
| 48 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> GetTrack() const = 0; |
| 49 | |
| 50 | // Once supported, will switch to receiving media on a new transport. |
| 51 | // However, this is not currently supported and will always return an error. |
| 52 | virtual RTCError SetTransport(RtpTransportInterface* transport) = 0; |
| 53 | // Returns previously set (or constructed-with) transport. |
| 54 | virtual RtpTransportInterface* GetTransport() const = 0; |
| 55 | |
| 56 | // Start receiving media with |parameters| (if |parameters| contains an |
| 57 | // active encoding). |
| 58 | // |
| 59 | // There are no limitations to how the parameters can be changed after the |
| 60 | // initial call to Receive, as long as they're valid (for example, they can't |
| 61 | // use the same payload type for two codecs). |
| 62 | virtual RTCError Receive(const RtpParameters& parameters) = 0; |
| 63 | // Returns parameters that were last successfully passed into Receive, or |
| 64 | // empty parameters if that hasn't yet occurred. |
| 65 | // |
| 66 | // Note that for parameters that are described as having an "implementation |
| 67 | // default" value chosen, GetParameters() will return those chosen defaults, |
| 68 | // with the exception of SSRCs which have special behavior. See |
| 69 | // rtpparameters.h for more details. |
| 70 | virtual RtpParameters GetParameters() const = 0; |
| 71 | |
| 72 | // Audio or video receiver? |
| 73 | // |
| 74 | // Once GetTrack() starts always returning a track, this method will be |
| 75 | // redundant, as one can call "GetTrack()->kind()". However, it's still a |
| 76 | // nice convenience, and is symmetric with OrtcRtpSenderInterface::GetKind. |
| 77 | virtual cricket::MediaType GetKind() const = 0; |
| 78 | |
| 79 | // TODO(deadbeef): GetContributingSources |
| 80 | }; |
| 81 | |
| 82 | } // namespace webrtc |
| 83 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 84 | #endif // API_ORTC_ORTCRTPRECEIVERINTERFACE_H_ |