deadbeef | 6979b02 | 2015-09-24 23:47:53 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 15:54:43 | [diff] [blame] | 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
deadbeef | 6979b02 | 2015-09-24 23:47:53 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 15:54:43 | [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 23:47:53 | [diff] [blame] | 9 | */ |
| 10 | |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 11 | // This file contains interfaces for RtpSenders |
| 12 | // http://w3c.github.io/webrtc-pc/#rtcrtpsender-interface |
| 13 | |
Henrik Kjellander | 15583c1 | 2016-02-10 09:53:12 | [diff] [blame] | 14 | #ifndef WEBRTC_API_RTPSENDERINTERFACE_H_ |
| 15 | #define WEBRTC_API_RTPSENDERINTERFACE_H_ |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 16 | |
| 17 | #include <string> |
deadbeef | a601f5c | 2016-06-06 21:27:39 | [diff] [blame] | 18 | #include <vector> |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 19 | |
Henrik Kjellander | 15583c1 | 2016-02-10 09:53:12 | [diff] [blame] | 20 | #include "webrtc/api/mediastreaminterface.h" |
| 21 | #include "webrtc/api/proxy.h" |
skvlad | dc1c62c | 2016-03-17 02:07:43 | [diff] [blame] | 22 | #include "webrtc/api/rtpparameters.h" |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 23 | #include "webrtc/base/refcount.h" |
| 24 | #include "webrtc/base/scoped_ref_ptr.h" |
kjellander@webrtc.org | 9b8df25 | 2016-02-12 05:47:59 | [diff] [blame] | 25 | #include "webrtc/pc/mediasession.h" |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 26 | |
| 27 | namespace webrtc { |
| 28 | |
| 29 | class RtpSenderInterface : public rtc::RefCountInterface { |
| 30 | public: |
| 31 | // Returns true if successful in setting the track. |
| 32 | // Fails if an audio track is set on a video RtpSender, or vice-versa. |
| 33 | virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; |
| 34 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
| 35 | |
deadbeef | a601f5c | 2016-06-06 21:27:39 | [diff] [blame] | 36 | // Returns primary SSRC used by this sender for sending media. |
| 37 | // Returns 0 if not yet determined. |
| 38 | // TODO(deadbeef): Change to rtc::Optional. |
| 39 | // TODO(deadbeef): Remove? With GetParameters this should be redundant. |
deadbeef | fac0655 | 2015-11-25 19:26:01 | [diff] [blame] | 40 | virtual uint32_t ssrc() const = 0; |
| 41 | |
| 42 | // Audio or video sender? |
| 43 | virtual cricket::MediaType media_type() const = 0; |
| 44 | |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 45 | // Not to be confused with "mid", this is a field we can temporarily use |
| 46 | // to uniquely identify a receiver until we implement Unified Plan SDP. |
| 47 | virtual std::string id() const = 0; |
| 48 | |
deadbeef | a601f5c | 2016-06-06 21:27:39 | [diff] [blame] | 49 | virtual std::vector<std::string> stream_ids() const = 0; |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 50 | |
skvlad | dc1c62c | 2016-03-17 02:07:43 | [diff] [blame] | 51 | virtual RtpParameters GetParameters() const = 0; |
| 52 | virtual bool SetParameters(const RtpParameters& parameters) = 0; |
| 53 | |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 54 | protected: |
| 55 | virtual ~RtpSenderInterface() {} |
| 56 | }; |
| 57 | |
| 58 | // Define proxy for RtpSenderInterface. |
nisse | 72c8d2b | 2016-04-15 10:49:07 | [diff] [blame] | 59 | BEGIN_SIGNALING_PROXY_MAP(RtpSender) |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 60 | PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) |
| 61 | PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
deadbeef | fac0655 | 2015-11-25 19:26:01 | [diff] [blame] | 62 | PROXY_CONSTMETHOD0(uint32_t, ssrc) |
| 63 | PROXY_CONSTMETHOD0(cricket::MediaType, media_type) |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 64 | PROXY_CONSTMETHOD0(std::string, id) |
deadbeef | a601f5c | 2016-06-06 21:27:39 | [diff] [blame] | 65 | PROXY_CONSTMETHOD0(std::vector<std::string>, stream_ids) |
skvlad | dc1c62c | 2016-03-17 02:07:43 | [diff] [blame] | 66 | PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
| 67 | PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
nisse | 72c8d2b | 2016-04-15 10:49:07 | [diff] [blame] | 68 | END_SIGNALING_PROXY() |
deadbeef | 70ab1a1 | 2015-09-28 23:53:55 | [diff] [blame] | 69 | |
| 70 | } // namespace webrtc |
| 71 | |
Henrik Kjellander | 15583c1 | 2016-02-10 09:53:12 | [diff] [blame] | 72 | #endif // WEBRTC_API_RTPSENDERINTERFACE_H_ |