Chromium Code Reviews| Index: webrtc/api/rtpreceiverinterface.h |
| diff --git a/webrtc/api/rtpreceiverinterface.h b/webrtc/api/rtpreceiverinterface.h |
| index 8607d935a232be6364327ad0af4d966280ec65c4..fe1b5a9d0bf824dae4f9203f1f325425504ae806 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> |
|
the sun
2017/04/05 14:58:29
Why the need to add this?
Zhi Huang
2017/04/06 03:09:49
Oh, I missed this when removing the unique_ptr.
|
| #include <string> |
| +#include <vector> |
| #include "webrtc/api/mediatypes.h" |
| #include "webrtc/api/mediastreaminterface.h" |
| @@ -25,6 +27,41 @@ |
| namespace webrtc { |
| +enum class RtpSourceType { |
|
hbos
2017/04/05 15:20:16
nit: With enum class you have to qualify the name
Zhi Huang
2017/04/06 03:09:49
Done.
|
| + RTP_SSRC_SOURCE, |
| + RTP_CSRC_SOURCE, |
| +}; |
| + |
| +struct RtpSource { |
|
hbos
2017/04/05 11:15:41
Considering the getters/setters and private member
the sun
2017/04/05 14:58:29
+1, make it a class!
Btw, thanks for not adding a
Zhi Huang
2017/04/06 03:09:49
Done.
|
| + public: |
| + RtpSource() = delete; |
| + RtpSource(int64_t timestamp, uint32_t source_id, RtpSourceType source_type) |
| + : timestamp_(timestamp), |
| + source_id_(source_id), |
| + source_type_(source_type) {} |
| + |
| + int64_t timestamp() const { return timestamp_; } |
|
danilchap
2017/04/05 16:24:21
can you add units, is it timestamp_ms?
Zhi Huang
2017/04/06 03:09:49
Done.
|
| + void update_timestamp(int64_t timestamp) { |
| + RTC_DCHECK_LE(timestamp_, timestamp); |
| + timestamp_ = timestamp; |
| + } |
| + |
| + // 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_; |
| + uint32_t source_id_; |
| + RtpSourceType source_type_; |
| +}; |
| + |
| class RtpReceiverObserverInterface { |
| public: |
| // Note: Currently if there are multiple RtpReceivers of the same media type, |
| @@ -61,6 +98,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() { |
|
the sun
2017/04/05 14:58:29
Make this method const:
virtual std::vector<RtpSou
Zhi Huang
2017/04/06 03:09:49
Done.
|
| + return std::vector<RtpSource>(); |
| + } |
| + |
| protected: |
| virtual ~RtpReceiverInterface() {} |
| }; |
| @@ -76,7 +120,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<RtpSource>, GetSources); |
| + END_PROXY_MAP() |
| } // namespace webrtc |