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

Unified Diff: webrtc/api/rtpreceiverinterface.h

Issue 2770233003: Implemented the GetSources() in native code. (Closed)
Patch Set: Add a direct dependency to the webrtc/voice_engine/BUILD.gn 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/rtpreceiverinterface.h
diff --git a/webrtc/api/rtpreceiverinterface.h b/webrtc/api/rtpreceiverinterface.h
index 8607d935a232be6364327ad0af4d966280ec65c4..fd233abe317609d265ca187f54be4781a1a47b75 100644
--- a/webrtc/api/rtpreceiverinterface.h
+++ b/webrtc/api/rtpreceiverinterface.h
@@ -15,6 +15,7 @@
#define WEBRTC_API_RTPRECEIVERINTERFACE_H_
#include <string>
+#include <vector>
#include "webrtc/api/mediatypes.h"
#include "webrtc/api/mediastreaminterface.h"
@@ -25,6 +26,41 @@
namespace webrtc {
+enum class RtpSourceType {
+ SSRC,
+ CSRC,
+};
+
+class RtpSource {
+ public:
+ RtpSource() = delete;
+ RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type)
+ : timestamp_ms_(timestamp_ms),
+ source_id_(source_id),
+ source_type_(source_type) {}
+
+ int64_t timestamp_ms() const { return timestamp_ms_; }
+ void update_timestamp_ms(int64_t timestamp_ms) {
+ RTC_DCHECK_LE(timestamp_ms_, timestamp_ms);
+ timestamp_ms_ = timestamp_ms;
+ }
+
+ // The identifier of the source can be the CSRC or the SSRC.
+ uint32_t source_id() const { return source_id_; }
+
+ // The source can be either a contributing source or a synchronization source.
+ RtpSourceType source_type() const { return source_type_; }
+
+ // This isn't implemented yet and will always return an empty Optional.
+ // TODO(zhihuang): Implement this to return real audio level.
+ rtc::Optional<int8_t> audio_level() const { return rtc::Optional<int8_t>(); }
+
+ private:
+ int64_t timestamp_ms_;
+ uint32_t source_id_;
+ RtpSourceType source_type_;
+};
+
class RtpReceiverObserverInterface {
public:
// Note: Currently if there are multiple RtpReceivers of the same media type,
@@ -61,6 +97,13 @@ class RtpReceiverInterface : public rtc::RefCountInterface {
// Must call SetObserver(nullptr) before the observer is destroyed.
virtual void SetObserver(RtpReceiverObserverInterface* observer) = 0;
+ // TODO(zhihuang): Remove the default implementation once the subclasses
+ // implement this. Currently, the only relevant subclass is the
+ // content::FakeRtpReceiver in Chromium.
+ virtual std::vector<RtpSource> GetSources() const {
+ return std::vector<RtpSource>();
+ }
+
protected:
virtual ~RtpReceiverInterface() {}
};
@@ -76,7 +119,8 @@ BEGIN_SIGNALING_PROXY_MAP(RtpReceiver)
PROXY_CONSTMETHOD0(RtpParameters, GetParameters);
PROXY_METHOD1(bool, SetParameters, const RtpParameters&)
PROXY_METHOD1(void, SetObserver, RtpReceiverObserverInterface*);
-END_PROXY_MAP()
+ PROXY_CONSTMETHOD0(std::vector<RtpSource>, GetSources);
+ END_PROXY_MAP()
} // namespace webrtc
« no previous file with comments | « no previous file | webrtc/api/test/mock_rtpreceiver.h » ('j') | webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698