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 RtpReceivers |
| 12 | // http://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface |
| 13 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 14 | #ifndef WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
| 15 | #define WEBRTC_API_RTPRECEIVERINTERFACE_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" |
zhihuang | 184a3fd | 2016-06-14 11:47:14 -0700 | [diff] [blame] | 23 | #include "webrtc/pc/mediasession.h" |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
zhihuang | 184a3fd | 2016-06-14 11:47:14 -0700 | [diff] [blame] | 27 | class RtpReceiverObserverInterface { |
| 28 | public: |
| 29 | virtual void OnFirstPacketReceived(cricket::MediaType media_type) = 0; |
| 30 | |
| 31 | protected: |
| 32 | virtual ~RtpReceiverObserverInterface() {} |
| 33 | }; |
| 34 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 35 | class RtpReceiverInterface : public rtc::RefCountInterface { |
| 36 | public: |
| 37 | virtual rtc::scoped_refptr<MediaStreamTrackInterface> track() const = 0; |
| 38 | |
| 39 | // Not to be confused with "mid", this is a field we can temporarily use |
| 40 | // to uniquely identify a receiver until we implement Unified Plan SDP. |
| 41 | virtual std::string id() const = 0; |
| 42 | |
Taylor Brandstetter | db0cd9e | 2016-05-16 11:40:30 -0700 | [diff] [blame] | 43 | // The WebRTC specification only defines RTCRtpParameters in terms of senders, |
| 44 | // but this API also applies them to receivers, similar to ORTC: |
| 45 | // http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. |
| 46 | virtual RtpParameters GetParameters() const = 0; |
| 47 | virtual bool SetParameters(const RtpParameters& parameters) = 0; |
| 48 | |
zhihuang | 184a3fd | 2016-06-14 11:47:14 -0700 | [diff] [blame] | 49 | virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0; |
| 50 | |
tkchin | 3784b4a | 2016-06-24 19:31:47 -0700 | [diff] [blame^] | 51 | virtual cricket::MediaType media_type() = 0; |
| 52 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 53 | protected: |
| 54 | virtual ~RtpReceiverInterface() {} |
| 55 | }; |
| 56 | |
| 57 | // Define proxy for RtpReceiverInterface. |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 58 | BEGIN_SIGNALING_PROXY_MAP(RtpReceiver) |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 59 | PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
| 60 | PROXY_CONSTMETHOD0(std::string, id) |
Taylor Brandstetter | db0cd9e | 2016-05-16 11:40:30 -0700 | [diff] [blame] | 61 | PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
| 62 | PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
zhihuang | 184a3fd | 2016-06-14 11:47:14 -0700 | [diff] [blame] | 63 | PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); |
tkchin | 3784b4a | 2016-06-24 19:31:47 -0700 | [diff] [blame^] | 64 | PROXY_METHOD0(cricket::MediaType, media_type); |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 65 | END_SIGNALING_PROXY() |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 66 | |
| 67 | } // namespace webrtc |
| 68 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 69 | #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ |