deadbeef | 6979b02 | 2015-09-24 16:47:53 -0700 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
deadbeef | 6979b02 | 2015-09-24 16:47:53 -0700 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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. |
deadbeef | 6979b02 | 2015-09-24 16:47:53 -0700 | [diff] [blame] | 9 | */ |
| 10 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 11 | // This file contains interfaces for RtpSenders |
| 12 | // http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface |
| 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #ifndef API_RTPSENDERINTERFACE_H_ |
| 15 | #define API_RTPSENDERINTERFACE_H_ |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 16 | |
| 17 | #include <string> |
deadbeef | a601f5c | 2016-06-06 14:27:39 -0700 | [diff] [blame] | 18 | #include <vector> |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 19 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 20 | #include "api/dtmfsenderinterface.h" |
| 21 | #include "api/mediastreaminterface.h" |
| 22 | #include "api/mediatypes.h" |
| 23 | #include "api/proxy.h" |
Zach Stein | ba37b4b | 2018-01-23 15:02:36 -0800 | [diff] [blame] | 24 | #include "api/rtcerror.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 25 | #include "api/rtpparameters.h" |
| 26 | #include "rtc_base/refcount.h" |
| 27 | #include "rtc_base/scoped_ref_ptr.h" |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 28 | |
| 29 | namespace webrtc { |
| 30 | |
| 31 | class RtpSenderInterface : public rtc::RefCountInterface { |
| 32 | public: |
| 33 | // Returns true if successful in setting the track. |
| 34 | // Fails if an audio track is set on a video RtpSender, or vice-versa. |
| 35 | virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; |
| 36 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
| 37 | |
deadbeef | a601f5c | 2016-06-06 14:27:39 -0700 | [diff] [blame] | 38 | // Returns primary SSRC used by this sender for sending media. |
| 39 | // Returns 0 if not yet determined. |
| 40 | // TODO(deadbeef): Change to rtc::Optional. |
| 41 | // TODO(deadbeef): Remove? With GetParameters this should be redundant. |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 42 | virtual uint32_t ssrc() const = 0; |
| 43 | |
| 44 | // Audio or video sender? |
| 45 | virtual cricket::MediaType media_type() const = 0; |
| 46 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 47 | // Not to be confused with "mid", this is a field we can temporarily use |
| 48 | // to uniquely identify a receiver until we implement Unified Plan SDP. |
| 49 | virtual std::string id() const = 0; |
| 50 | |
Seth Hampson | 5b4f075 | 2018-04-02 16:31:36 -0700 | [diff] [blame] | 51 | // Returns a list of media stream ids associated with this sender's track. |
| 52 | // These are signalled in the SDP so that the remote side can associate |
| 53 | // tracks. |
deadbeef | a601f5c | 2016-06-06 14:27:39 -0700 | [diff] [blame] | 54 | virtual std::vector<std::string> stream_ids() const = 0; |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 55 | |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 56 | virtual RtpParameters GetParameters() const = 0; |
deadbeef | b10f32f | 2017-02-08 01:38:21 -0800 | [diff] [blame] | 57 | // Note that only a subset of the parameters can currently be changed. See |
| 58 | // rtpparameters.h |
Zach Stein | ba37b4b | 2018-01-23 15:02:36 -0800 | [diff] [blame] | 59 | virtual RTCError SetParameters(const RtpParameters& parameters) = 0; |
skvlad | dc1c62c | 2016-03-16 19:07:43 -0700 | [diff] [blame] | 60 | |
deadbeef | 20cb0c1 | 2017-02-01 20:27:00 -0800 | [diff] [blame] | 61 | // Returns null for a video sender. |
| 62 | virtual rtc::scoped_refptr<DtmfSenderInterface> GetDtmfSender() const = 0; |
| 63 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 64 | protected: |
| 65 | virtual ~RtpSenderInterface() {} |
| 66 | }; |
| 67 | |
| 68 | // Define proxy for RtpSenderInterface. |
deadbeef | b10f32f | 2017-02-08 01:38:21 -0800 | [diff] [blame] | 69 | // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods |
| 70 | // are called on is an implementation detail. |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 71 | BEGIN_SIGNALING_PROXY_MAP(RtpSender) |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 72 | PROXY_SIGNALING_THREAD_DESTRUCTOR() |
| 73 | PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) |
| 74 | PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
| 75 | PROXY_CONSTMETHOD0(uint32_t, ssrc) |
| 76 | PROXY_CONSTMETHOD0(cricket::MediaType, media_type) |
| 77 | PROXY_CONSTMETHOD0(std::string, id) |
| 78 | PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids) |
| 79 | PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
Zach Stein | ba37b4b | 2018-01-23 15:02:36 -0800 | [diff] [blame] | 80 | PROXY_METHOD1(RTCError, SetParameters, const RtpParameters&) |
deadbeef | 20cb0c1 | 2017-02-01 20:27:00 -0800 | [diff] [blame] | 81 | PROXY_CONSTMETHOD0(rtc::scoped_refptr<DtmfSenderInterface>, GetDtmfSender); |
Harald Alvestrand | c72af93 | 2018-01-11 17:18:19 +0100 | [diff] [blame] | 82 | END_PROXY_MAP() |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 83 | |
| 84 | } // namespace webrtc |
| 85 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 86 | #endif // API_RTPSENDERINTERFACE_H_ |