Reland of Implemented the GetSources() in native code. (patchset #1 id:1 of https://codereview.webrtc.org/2809613002/ )

Reason for revert:
Re-land, reverting did not fix bug.

https://bugs.chromium.org/p/webrtc/issues/detail?id=7465

Original issue's description:
> Revert of Implemented the GetSources() in native code. (patchset #11 id:510001 of https://codereview.webrtc.org/2770233003/ )
>
> Reason for revert:
> Suspected of WebRtcApprtcBrowserTest.MANUAL_WorksOnApprtc breakage, see
>
> https://bugs.chromium.org/p/webrtc/issues/detail?id=7465
>
> Original issue's description:
> > Added the GetSources() to the RtpReceiverInterface and implemented
> > it for the AudioRtpReceiver.
> >
> > This method returns a vector of RtpSource(both CSRC source and SSRC
> > source) which contains the ID of a source, the timestamp, the source
> > type (SSRC or CSRC) and the audio level.
> >
> > The RtpSource objects are buffered and maintained by the
> > RtpReceiver in webrtc/modules/rtp_rtcp/. When the method is called,
> > the info of the contributing source will be pulled along the object
> > chain:
> > AudioRtpReceiver -> VoiceChannel -> WebRtcVoiceMediaChannel ->
> > AudioReceiveStream -> voe::Channel -> RtpRtcp module
> >
> > Spec:https://w3c.github.io/webrtc-pc/archives/20151006/webrtc.html#widl-RTCRtpReceiver-getContributingSources-sequence-RTCRtpContributingSource
> >
> > BUG=chromium:703122
> > TBR=stefan@webrtc.org, danilchap@webrtc.org
> >
> > Review-Url: https://codereview.webrtc.org/2770233003
> > Cr-Commit-Position: refs/heads/master@{#17591}
> > Committed: 292084c376
>
> TBR=deadbeef@webrtc.org,solenberg@webrtc.org,hbos@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=chromium:703122
>
> Review-Url: https://codereview.webrtc.org/2809613002
> Cr-Commit-Position: refs/heads/master@{#17616}
> Committed: fbcc5cb386

TBR=deadbeef@webrtc.org,solenberg@webrtc.org,philipel@webrtc.org,stefan@webrtc.org,danilchap@webrtc.org,zhihuang@webrtc.org,olka@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:703122

Review-Url: https://codereview.webrtc.org/2810623003
Cr-Commit-Position: refs/heads/master@{#17621}
This commit is contained in:
hbos
2017-04-10 07:39:05 -07:00
committed by Commit bot
parent b0f7e39fd4
commit 8d609f6b6d
25 changed files with 563 additions and 44 deletions

View File

@ -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