OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // This file contains interfaces for RtpReceivers | 11 // This file contains interfaces for RtpReceivers |
12 // http://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface | 12 // http://w3c.github.io/webrtc-pc/#rtcrtpreceiver-interface |
13 | 13 |
14 #ifndef WEBRTC_API_RTPRECEIVERINTERFACE_H_ | 14 #ifndef WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
15 #define WEBRTC_API_RTPRECEIVERINTERFACE_H_ | 15 #define WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
16 | 16 |
17 #include <memory> | |
17 #include <string> | 18 #include <string> |
19 #include <vector> | |
18 | 20 |
19 #include "webrtc/api/mediatypes.h" | 21 #include "webrtc/api/mediatypes.h" |
20 #include "webrtc/api/mediastreaminterface.h" | 22 #include "webrtc/api/mediastreaminterface.h" |
21 #include "webrtc/api/proxy.h" | 23 #include "webrtc/api/proxy.h" |
22 #include "webrtc/api/rtpparameters.h" | 24 #include "webrtc/api/rtpparameters.h" |
23 #include "webrtc/base/refcount.h" | 25 #include "webrtc/base/refcount.h" |
24 #include "webrtc/base/scoped_ref_ptr.h" | 26 #include "webrtc/base/scoped_ref_ptr.h" |
25 | 27 |
26 namespace webrtc { | 28 namespace webrtc { |
27 | 29 |
30 class RtpContributingSourceInterface { | |
31 public: | |
32 virtual ~RtpContributingSourceInterface() {} | |
33 | |
34 virtual int64_t timestamp() const = 0; | |
35 | |
36 // Can be either the SSRC or the CSRC. | |
37 virtual uint32_t source() const = 0; | |
38 | |
39 virtual int8_t audio_level() const = 0; | |
hbos
2017/03/30 09:51:54
This should be rtc::Optional<...>. 0 is a meaningf
Taylor Brandstetter
2017/03/30 22:55:37
It only ranges from 0 to 127. So might as well mak
| |
40 }; | |
41 | |
28 class RtpReceiverObserverInterface { | 42 class RtpReceiverObserverInterface { |
29 public: | 43 public: |
30 // Note: Currently if there are multiple RtpReceivers of the same media type, | 44 // Note: Currently if there are multiple RtpReceivers of the same media type, |
31 // they will all call OnFirstPacketReceived at once. | 45 // they will all call OnFirstPacketReceived at once. |
32 // | 46 // |
33 // In the future, it's likely that an RtpReceiver will only call | 47 // In the future, it's likely that an RtpReceiver will only call |
34 // OnFirstPacketReceived when a packet is received specifically for its | 48 // OnFirstPacketReceived when a packet is received specifically for its |
35 // SSRC/mid. | 49 // SSRC/mid. |
36 virtual void OnFirstPacketReceived(cricket::MediaType media_type) = 0; | 50 virtual void OnFirstPacketReceived(cricket::MediaType media_type) = 0; |
37 | 51 |
(...skipping 16 matching lines...) Expand all Loading... | |
54 // but this API also applies them to receivers, similar to ORTC: | 68 // but this API also applies them to receivers, similar to ORTC: |
55 // http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. | 69 // http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. |
56 virtual RtpParameters GetParameters() const = 0; | 70 virtual RtpParameters GetParameters() const = 0; |
57 // Currently, doesn't support changing any parameters, but may in the future. | 71 // Currently, doesn't support changing any parameters, but may in the future. |
58 virtual bool SetParameters(const RtpParameters& parameters) = 0; | 72 virtual bool SetParameters(const RtpParameters& parameters) = 0; |
59 | 73 |
60 // Does not take ownership of observer. | 74 // Does not take ownership of observer. |
61 // Must call SetObserver(nullptr) before the observer is destroyed. | 75 // Must call SetObserver(nullptr) before the observer is destroyed. |
62 virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0; | 76 virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0; |
63 | 77 |
78 virtual std::vector<std::unique_ptr<RtpContributingSourceInterface>> | |
Taylor Brandstetter
2017/03/30 22:55:37
Since this looks so similar to the JS API, but beh
Zhi Huang
2017/03/31 06:44:04
Yeah, I agree that returning plain structs would b
the sun
2017/03/31 07:03:49
Perhaps that is the guideline we were looking for?
| |
79 GetContributingSources() = 0; | |
80 | |
64 protected: | 81 protected: |
65 virtual ~RtpReceiverInterface() {} | 82 virtual ~RtpReceiverInterface() {} |
66 }; | 83 }; |
67 | 84 |
68 // Define proxy for RtpReceiverInterface. | 85 // Define proxy for RtpReceiverInterface. |
69 // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods | 86 // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods |
70 // are called on is an implementation detail. | 87 // are called on is an implementation detail. |
71 BEGIN_SIGNALING_PROXY_MAP(RtpReceiver) | 88 BEGIN_SIGNALING_PROXY_MAP(RtpReceiver) |
72 PROXY_SIGNALING_THREAD_DESTRUCTOR() | 89 PROXY_SIGNALING_THREAD_DESTRUCTOR() |
73 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) | 90 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) |
74 PROXY_CONSTMETHOD0(cricket::MediaType, media_type) | 91 PROXY_CONSTMETHOD0(cricket::MediaType, media_type) |
75 PROXY_CONSTMETHOD0(std::string, id) | 92 PROXY_CONSTMETHOD0(std::string, id) |
76 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); | 93 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); |
77 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) | 94 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) |
78 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); | 95 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); |
79 END_PROXY_MAP() | 96 PROXY_METHOD0(std::vector<std::unique_ptr<RtpContributingSourceInterface>>, |
97 GetContributingSources); | |
98 END_PROXY_MAP() | |
80 | 99 |
81 } // namespace webrtc | 100 } // namespace webrtc |
82 | 101 |
83 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ | 102 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
OLD | NEW |