Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: webrtc/api/rtpreceiverinterface.h

Issue 2809613002: Revert of Implemented the GetSources() in native code. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/test/mock_rtpreceiver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 17 #include <string>
18 #include <vector>
19 18
20 #include "webrtc/api/mediatypes.h" 19 #include "webrtc/api/mediatypes.h"
21 #include "webrtc/api/mediastreaminterface.h" 20 #include "webrtc/api/mediastreaminterface.h"
22 #include "webrtc/api/proxy.h" 21 #include "webrtc/api/proxy.h"
23 #include "webrtc/api/rtpparameters.h" 22 #include "webrtc/api/rtpparameters.h"
24 #include "webrtc/base/refcount.h" 23 #include "webrtc/base/refcount.h"
25 #include "webrtc/base/scoped_ref_ptr.h" 24 #include "webrtc/base/scoped_ref_ptr.h"
26 25
27 namespace webrtc { 26 namespace webrtc {
28 27
29 enum class RtpSourceType {
30 SSRC,
31 CSRC,
32 };
33
34 class RtpSource {
35 public:
36 RtpSource() = delete;
37 RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type)
38 : timestamp_ms_(timestamp_ms),
39 source_id_(source_id),
40 source_type_(source_type) {}
41
42 int64_t timestamp_ms() const { return timestamp_ms_; }
43 void update_timestamp_ms(int64_t timestamp_ms) {
44 RTC_DCHECK_LE(timestamp_ms_, timestamp_ms);
45 timestamp_ms_ = timestamp_ms;
46 }
47
48 // The identifier of the source can be the CSRC or the SSRC.
49 uint32_t source_id() const { return source_id_; }
50
51 // The source can be either a contributing source or a synchronization source.
52 RtpSourceType source_type() const { return source_type_; }
53
54 // This isn't implemented yet and will always return an empty Optional.
55 // TODO(zhihuang): Implement this to return real audio level.
56 rtc::Optional<int8_t> audio_level() const { return rtc::Optional<int8_t>(); }
57
58 private:
59 int64_t timestamp_ms_;
60 uint32_t source_id_;
61 RtpSourceType source_type_;
62 };
63
64 class RtpReceiverObserverInterface { 28 class RtpReceiverObserverInterface {
65 public: 29 public:
66 // Note: Currently if there are multiple RtpReceivers of the same media type, 30 // Note: Currently if there are multiple RtpReceivers of the same media type,
67 // they will all call OnFirstPacketReceived at once. 31 // they will all call OnFirstPacketReceived at once.
68 // 32 //
69 // In the future, it's likely that an RtpReceiver will only call 33 // In the future, it's likely that an RtpReceiver will only call
70 // OnFirstPacketReceived when a packet is received specifically for its 34 // OnFirstPacketReceived when a packet is received specifically for its
71 // SSRC/mid. 35 // SSRC/mid.
72 virtual void OnFirstPacketReceived(cricket::MediaType media_type) = 0; 36 virtual void OnFirstPacketReceived(cricket::MediaType media_type) = 0;
73 37
(...skipping 16 matching lines...) Expand all
90 // but this API also applies them to receivers, similar to ORTC: 54 // but this API also applies them to receivers, similar to ORTC:
91 // http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*. 55 // http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*.
92 virtual RtpParameters GetParameters() const = 0; 56 virtual RtpParameters GetParameters() const = 0;
93 // Currently, doesn't support changing any parameters, but may in the future. 57 // Currently, doesn't support changing any parameters, but may in the future.
94 virtual bool SetParameters(const RtpParameters& parameters) = 0; 58 virtual bool SetParameters(const RtpParameters& parameters) = 0;
95 59
96 // Does not take ownership of observer. 60 // Does not take ownership of observer.
97 // Must call SetObserver(nullptr) before the observer is destroyed. 61 // Must call SetObserver(nullptr) before the observer is destroyed.
98 virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0; 62 virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0;
99 63
100 // TODO(zhihuang): Remove the default implementation once the subclasses
101 // implement this. Currently, the only relevant subclass is the
102 // content::FakeRtpReceiver in Chromium.
103 virtual std::vector<RtpSource> GetSources() const {
104 return std::vector<RtpSource>();
105 }
106
107 protected: 64 protected:
108 virtual ~RtpReceiverInterface() {} 65 virtual ~RtpReceiverInterface() {}
109 }; 66 };
110 67
111 // Define proxy for RtpReceiverInterface. 68 // Define proxy for RtpReceiverInterface.
112 // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods 69 // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
113 // are called on is an implementation detail. 70 // are called on is an implementation detail.
114 BEGIN_SIGNALING_PROXY_MAP(RtpReceiver) 71 BEGIN_SIGNALING_PROXY_MAP(RtpReceiver)
115 PROXY_SIGNALING_THREAD_DESTRUCTOR() 72 PROXY_SIGNALING_THREAD_DESTRUCTOR()
116 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track) 73 PROXY_CONSTMETHOD0(rtc::scoped_refptr<MediaStreamTrackInterface>, track)
117 PROXY_CONSTMETHOD0(cricket::MediaType, media_type) 74 PROXY_CONSTMETHOD0(cricket::MediaType, media_type)
118 PROXY_CONSTMETHOD0(std::string, id) 75 PROXY_CONSTMETHOD0(std::string, id)
119 PROXY_CONSTMETHOD0(RtpParameters, GetParameters); 76 PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
120 PROXY_METHOD1(bool, SetParameters, const RtpParameters&) 77 PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
121 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*); 78 PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*);
122 PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources); 79 END_PROXY_MAP()
123 END_PROXY_MAP()
124 80
125 } // namespace webrtc 81 } // namespace webrtc
126 82
127 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_ 83 #endif // WEBRTC_API_RTPRECEIVERINTERFACE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/test/mock_rtpreceiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698