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 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 14 | #ifndef WEBRTC_API_RTPSENDERINTERFACE_H_ |
| 15 | #define WEBRTC_API_RTPSENDERINTERFACE_H_ |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 16 | |
| 17 | #include <string> |
| 18 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 19 | #include "webrtc/api/mediastreaminterface.h" |
| 20 | #include "webrtc/api/proxy.h" |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 21 | #include "webrtc/base/refcount.h" |
| 22 | #include "webrtc/base/scoped_ref_ptr.h" |
kjellander@webrtc.org | 9b8df25 | 2016-02-12 06:47:59 +0100 | [diff] [blame^] | 23 | #include "webrtc/pc/mediasession.h" |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
| 27 | class RtpSenderInterface : public rtc::RefCountInterface { |
| 28 | public: |
| 29 | // Returns true if successful in setting the track. |
| 30 | // Fails if an audio track is set on a video RtpSender, or vice-versa. |
| 31 | virtual bool SetTrack(MediaStreamTrackInterface* track) = 0; |
| 32 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
| 33 | |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 34 | // Used to set the SSRC of the sender, once a local description has been set. |
| 35 | // If |ssrc| is 0, this indiates that the sender should disconnect from the |
| 36 | // underlying transport (this occurs if the sender isn't seen in a local |
| 37 | // description). |
| 38 | virtual void SetSsrc(uint32_t ssrc) = 0; |
| 39 | virtual uint32_t ssrc() const = 0; |
| 40 | |
| 41 | // Audio or video sender? |
| 42 | virtual cricket::MediaType media_type() const = 0; |
| 43 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 44 | // Not to be confused with "mid", this is a field we can temporarily use |
| 45 | // to uniquely identify a receiver until we implement Unified Plan SDP. |
| 46 | virtual std::string id() const = 0; |
| 47 | |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 48 | // TODO(deadbeef): Support one sender having multiple stream ids. |
| 49 | virtual void set_stream_id(const std::string& stream_id) = 0; |
| 50 | virtual std::string stream_id() const = 0; |
| 51 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 52 | virtual void Stop() = 0; |
| 53 | |
| 54 | protected: |
| 55 | virtual ~RtpSenderInterface() {} |
| 56 | }; |
| 57 | |
| 58 | // Define proxy for RtpSenderInterface. |
| 59 | BEGIN_PROXY_MAP(RtpSender) |
| 60 | PROXY_METHOD1(bool, SetTrack, MediaStreamTrackInterface*) |
| 61 | PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 62 | PROXY_METHOD1(void, SetSsrc, uint32_t) |
| 63 | PROXY_CONSTMETHOD0(uint32_t, ssrc) |
| 64 | PROXY_CONSTMETHOD0(cricket::MediaType, media_type) |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 65 | PROXY_CONSTMETHOD0(std::string, id) |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 66 | PROXY_METHOD1(void, set_stream_id, const std::string&) |
| 67 | PROXY_CONSTMETHOD0(std::string, stream_id) |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 68 | PROXY_METHOD0(void, Stop) |
| 69 | END_PROXY() |
| 70 | |
| 71 | } // namespace webrtc |
| 72 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 73 | #endif // WEBRTC_API_RTPSENDERINTERFACE_H_ |