Commit 2a597d3d authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Replace uses of WebRTCRtpSource by RTCRtpSource

BUG=787254, 939192
R=guidou@chromium.org, haraken@chromium.org

Change-Id: Ic4d7594070d71ca8ca9153ca197a8d9b4ade053f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1932089
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719103}
parent 646c8991
......@@ -268,7 +268,6 @@ source_set("blink_headers") {
"platform/web_rtc_peer_connection_handler.h",
"platform/web_rtc_peer_connection_handler_client.h",
"platform/web_rtc_rtp_receiver.h",
"platform/web_rtc_rtp_source.h",
"platform/web_rtc_rtp_transceiver.h",
"platform/web_rtc_stats.h",
"platform/web_runtime_features.h",
......
......@@ -18,8 +18,8 @@
namespace blink {
class RTCRtpSource;
class WebMediaStreamTrack;
class WebRTCRtpSource;
// Implementations of this interface keep the corresponding WebRTC-layer
// receiver alive through reference counting. Multiple |WebRTCRtpReceiver|s
......@@ -40,7 +40,7 @@ class BLINK_PLATFORM_EXPORT WebRTCRtpReceiver {
virtual webrtc::DtlsTransportInformation DtlsTransportInformation() = 0;
virtual const WebMediaStreamTrack& Track() const = 0;
virtual WebVector<WebString> StreamIds() const = 0;
virtual WebVector<std::unique_ptr<WebRTCRtpSource>> GetSources() = 0;
virtual WebVector<std::unique_ptr<RTCRtpSource>> GetSources() = 0;
virtual void GetStats(blink::WebRTCStatsReportCallback,
const WebVector<webrtc::NonStandardGroupId>&) = 0;
virtual std::unique_ptr<webrtc::RtpParameters> GetParameters() const = 0;
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_
#include <memory>
#include "base/optional.h"
#include "third_party/blink/public/platform/web_common.h"
namespace base {
class TimeTicks;
}
namespace webrtc {
class RtpSource;
}
namespace blink {
// Represents both SSRCs and CSRCs.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtpsynchronizationsource
// https://w3c.github.io/webrtc-pc/#dom-rtcrtpcontributingsource
class BLINK_PLATFORM_EXPORT WebRTCRtpSource {
public:
enum class Type {
kSSRC,
kCSRC,
};
virtual ~WebRTCRtpSource();
virtual Type SourceType() const = 0;
virtual base::TimeTicks Timestamp() const = 0;
virtual uint32_t Source() const = 0;
virtual base::Optional<double> AudioLevel() const = 0;
virtual uint32_t RtpTimestamp() const = 0;
};
BLINK_PLATFORM_EXPORT std::unique_ptr<WebRTCRtpSource> CreateRTCRtpSource(
const webrtc::RtpSource& source);
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_RTP_SOURCE_H_
......@@ -168,7 +168,7 @@ blink::WebVector<blink::WebString> FakeRTCRtpReceiverImpl::StreamIds() const {
return web_stream_ids;
}
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>>
blink::WebVector<std::unique_ptr<RTCRtpSource>>
FakeRTCRtpReceiverImpl::GetSources() {
NOTIMPLEMENTED();
return {};
......
......@@ -13,11 +13,11 @@
#include "third_party/blink/public/platform/web_media_stream_source.h"
#include "third_party/blink/public/platform/web_media_stream_track.h"
#include "third_party/blink/public/platform/web_rtc_rtp_receiver.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/blink/public/platform/web_rtc_rtp_transceiver.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_source.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_sender_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
namespace blink {
......@@ -76,8 +76,7 @@ class FakeRTCRtpReceiverImpl : public blink::WebRTCRtpReceiver {
webrtc::DtlsTransportInformation DtlsTransportInformation() override;
const blink::WebMediaStreamTrack& Track() const override;
blink::WebVector<blink::WebString> StreamIds() const override;
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>> GetSources()
override;
blink::WebVector<std::unique_ptr<RTCRtpSource>> GetSources() override;
void GetStats(blink::WebRTCStatsReportCallback,
const blink::WebVector<webrtc::NonStandardGroupId>&) override;
std::unique_ptr<webrtc::RtpParameters> GetParameters() const override;
......
......@@ -9,13 +9,13 @@
#include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/public/platform/web_media_stream_source.h"
#include "third_party/blink/public/platform/web_media_stream_track.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/blink/public/platform/web_rtc_rtp_transceiver.h"
#include "third_party/blink/public/platform/web_rtc_stats.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_dtmf_sender_handler.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_ice_candidate_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_sender_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_session_description_platform.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
#include "third_party/webrtc/api/stats/rtc_stats.h"
......@@ -136,8 +136,8 @@ class DummyWebRTCRtpReceiver : public WebRTCRtpReceiver {
WebVector<WebString> StreamIds() const override {
return WebVector<WebString>();
}
WebVector<std::unique_ptr<WebRTCRtpSource>> GetSources() override {
return WebVector<std::unique_ptr<WebRTCRtpSource>>();
WebVector<std::unique_ptr<RTCRtpSource>> GetSources() override {
return WebVector<std::unique_ptr<RTCRtpSource>>();
}
void GetStats(WebRTCStatsReportCallback,
const WebVector<webrtc::NonStandardGroupId>&) override {}
......
......@@ -6,7 +6,6 @@
#include "third_party/blink/public/platform/web_media_stream.h"
#include "third_party/blink/public/platform/web_media_stream_track.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h"
#include "third_party/blink/renderer/modules/peerconnection/rtc_dtls_transport.h"
......@@ -76,7 +75,7 @@ RTCRtpReceiver::getSynchronizationSources() {
HeapVector<Member<RTCRtpSynchronizationSource>> synchronization_sources;
for (const auto& web_source : web_sources_) {
if (web_source->SourceType() != WebRTCRtpSource::Type::kSSRC)
if (web_source->SourceType() != RTCRtpSource::Type::kSSRC)
continue;
RTCRtpSynchronizationSource* synchronization_source =
MakeGarbageCollected<RTCRtpSynchronizationSource>();
......@@ -103,7 +102,7 @@ RTCRtpReceiver::getContributingSources() {
HeapVector<Member<RTCRtpContributingSource>> contributing_sources;
for (const auto& web_source : web_sources_) {
if (web_source->SourceType() != WebRTCRtpSource::Type::kCSRC)
if (web_source->SourceType() != RTCRtpSource::Type::kCSRC)
continue;
RTCRtpContributingSource* contributing_source =
MakeGarbageCollected<RTCRtpContributingSource>();
......
......@@ -8,7 +8,6 @@
#include "base/optional.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_rtc_rtp_receiver.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_track.h"
......@@ -20,6 +19,7 @@
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/heap/visitor.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
namespace blink {
class RTCDtlsTransport;
......@@ -70,7 +70,7 @@ class RTCRtpReceiver final : public ScriptWrappable {
// The current SSRCs and CSRCs. getSynchronizationSources() returns the SSRCs
// and getContributingSources() returns the CSRCs.
WebVector<std::unique_ptr<WebRTCRtpSource>> web_sources_;
WebVector<std::unique_ptr<RTCRtpSource>> web_sources_;
bool web_sources_needs_updating_ = true;
Member<RTCRtpTransceiver> transceiver_;
......
......@@ -6,9 +6,9 @@
#include "base/bind.h"
#include "base/logging.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/blink/public/platform/web_rtc_stats.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_sender_platform.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
#include "third_party/blink/renderer/platform/peerconnection/webrtc_util.h"
#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
#include "third_party/webrtc/api/scoped_refptr.h"
......@@ -159,14 +159,14 @@ class RTCRtpReceiverImpl::RTCRtpReceiverInternal
state_ = std::move(state);
}
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>> GetSources() {
blink::WebVector<std::unique_ptr<RTCRtpSource>> GetSources() {
// The webrtc_recever_ is a proxy, so this is a blocking call to the webrtc
// signalling thread.
auto webrtc_sources = webrtc_receiver_->GetSources();
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>> sources(
blink::WebVector<std::unique_ptr<RTCRtpSource>> sources(
webrtc_sources.size());
for (size_t i = 0; i < webrtc_sources.size(); ++i) {
sources[i] = blink::CreateRTCRtpSource(webrtc_sources[i]);
sources[i] = std::make_unique<RTCRtpSource>(webrtc_sources[i]);
}
return sources;
}
......@@ -296,7 +296,7 @@ blink::WebVector<blink::WebString> RTCRtpReceiverImpl::StreamIds() const {
return web_stream_ids;
}
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>>
blink::WebVector<std::unique_ptr<RTCRtpSource>>
RTCRtpReceiverImpl::GetSources() {
return internal_->GetSources();
}
......
......@@ -130,8 +130,7 @@ class MODULES_EXPORT RTCRtpReceiverImpl : public blink::WebRTCRtpReceiver {
const blink::WebMediaStreamTrack& Track() const override;
blink::WebVector<blink::WebString> StreamIds() const override;
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>> GetSources()
override;
blink::WebVector<std::unique_ptr<RTCRtpSource>> GetSources() override;
void GetStats(blink::WebRTCStatsReportCallback,
const blink::WebVector<webrtc::NonStandardGroupId>&) override;
std::unique_ptr<webrtc::RtpParameters> GetParameters() const override;
......
......@@ -531,7 +531,6 @@ jumbo_component("platform") {
"exported/web_resource_timing_info.cc",
"exported/web_rtc_peer_connection_handler_client.cc",
"exported/web_rtc_rtp_receiver.cc",
"exported/web_rtc_rtp_source.cc",
"exported/web_rtc_rtp_transceiver.cc",
"exported/web_rtc_stats.cc",
"exported/web_runtime_features.cc",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
namespace blink {
WebRTCRtpSource::~WebRTCRtpSource() = default;
} // namespace blink
......@@ -12,24 +12,19 @@
namespace blink {
std::unique_ptr<WebRTCRtpSource> CreateRTCRtpSource(
const webrtc::RtpSource& source) {
return std::make_unique<RTCRtpSource>(source);
}
RTCRtpSource::RTCRtpSource(const webrtc::RtpSource& source) : source_(source) {}
RTCRtpSource::~RTCRtpSource() {}
WebRTCRtpSource::Type RTCRtpSource::SourceType() const {
RTCRtpSource::Type RTCRtpSource::SourceType() const {
switch (source_.source_type()) {
case webrtc::RtpSourceType::SSRC:
return WebRTCRtpSource::Type::kSSRC;
return RTCRtpSource::Type::kSSRC;
case webrtc::RtpSourceType::CSRC:
return WebRTCRtpSource::Type::kCSRC;
return RTCRtpSource::Type::kCSRC;
default:
NOTREACHED();
return WebRTCRtpSource::Type::kSSRC;
return RTCRtpSource::Type::kSSRC;
}
}
......
......@@ -6,22 +6,35 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_SOURCE_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "base/optional.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/webrtc/api/rtp_receiver_interface.h"
namespace base {
class TimeTicks;
}
namespace webrtc {
class RtpSource;
}
namespace blink {
class RTCRtpSource : public WebRTCRtpSource {
class PLATFORM_EXPORT RTCRtpSource {
public:
enum class Type {
kSSRC,
kCSRC,
};
explicit RTCRtpSource(const webrtc::RtpSource& source);
~RTCRtpSource() override;
~RTCRtpSource();
WebRTCRtpSource::Type SourceType() const override;
base::TimeTicks Timestamp() const override;
uint32_t Source() const override;
base::Optional<double> AudioLevel() const override;
uint32_t RtpTimestamp() const override;
Type SourceType() const;
base::TimeTicks Timestamp() const;
uint32_t Source() const;
base::Optional<double> AudioLevel() const;
uint32_t RtpTimestamp() const;
private:
const webrtc::RtpSource source_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment