Chromium Code Reviews| Index: webrtc/api/rtpreceiverinterface.h |
| diff --git a/webrtc/api/rtpreceiverinterface.h b/webrtc/api/rtpreceiverinterface.h |
| index 8607d935a232be6364327ad0af4d966280ec65c4..25738ee72e821bf62f8584a26256a7b83a613d94 100644 |
| --- a/webrtc/api/rtpreceiverinterface.h |
| +++ b/webrtc/api/rtpreceiverinterface.h |
| @@ -14,7 +14,9 @@ |
| #ifndef WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
| #define WEBRTC_API_RTPRECEIVERINTERFACE_H_ |
| +#include <memory> |
| #include <string> |
| +#include <vector> |
| #include "webrtc/api/mediatypes.h" |
| #include "webrtc/api/mediastreaminterface.h" |
| @@ -25,6 +27,30 @@ |
| namespace webrtc { |
| +struct RtpContributingSource { |
|
the sun
2017/04/04 21:09:59
I'd suggest instead:
class RtpContributingSource
Zhi Huang
2017/04/05 04:16:04
The working group had some discussions and achieve
|
| + public: |
| + RtpContributingSource() : timestamp_(0), ssrc_(0) {} |
| + |
| + int64_t timestamp() { return timestamp_; } |
| + void set_timestamp(int64_t timestamp) { timestamp_ = timestamp; } |
| + |
| + uint32_t source() { return csrc_ ? *csrc_ : ssrc_; } |
| + |
| + uint32_t ssrc() { return ssrc_; } |
| + void set_ssrc(uint32_t ssrc) { ssrc_ = ssrc; } |
| + void set_csrc(uint32_t csrc) { csrc_ = rtc::Optional<uint32_t>(csrc); } |
| + |
| + // 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() { return audio_level_; } |
| + |
| + private: |
| + int64_t timestamp_; |
| + uint32_t ssrc_; |
| + rtc::Optional<uint32_t> csrc_; |
| + rtc::Optional<int8_t> audio_level_; |
| +}; |
| + |
| class RtpReceiverObserverInterface { |
| public: |
| // Note: Currently if there are multiple RtpReceivers of the same media type, |
| @@ -61,6 +87,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<RtpContributingSource> GetContributingSources() { |
| + return std::vector<RtpContributingSource>(); |
| + } |
| + |
| protected: |
| virtual ~RtpReceiverInterface() {} |
| }; |
| @@ -76,7 +109,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_METHOD0(std::vector<RtpContributingSource>, GetContributingSources); |
| + END_PROXY_MAP() |
| } // namespace webrtc |