Commit 515c97b7 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Onion soup RtcRtpSource

This is phase 1.4 on the design document [1].

[1] https://docs.google.com/document/d/1AJKVA5U4nDkyDB9p4ROrggWXadCxyy-grKaE9KS5vOU/

rtc_rtp_receiver.cc|h are moved to renderer/platform/peerconnection,
and web_rtc_rtp_source.h gets a factory method added so
content can still access its functionality.

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

Change-Id: I5591f8aa79eea7f08c5c3460fc79212ab5fb4805
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1770240
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@{#690732}
parent 31d22c06
......@@ -216,8 +216,6 @@ target(link_target_type, "renderer") {
"media/webrtc/rtc_rtp_receiver.h",
"media/webrtc/rtc_rtp_sender.cc",
"media/webrtc/rtc_rtp_sender.h",
"media/webrtc/rtc_rtp_source.cc",
"media/webrtc/rtc_rtp_source.h",
"media/webrtc/rtc_rtp_transceiver.cc",
"media/webrtc/rtc_rtp_transceiver.h",
"media/webrtc/rtc_stats.cc",
......
......@@ -6,9 +6,9 @@
#include "base/bind.h"
#include "base/logging.h"
#include "content/renderer/media/webrtc/rtc_rtp_source.h"
#include "content/renderer/media/webrtc/rtc_stats.h"
#include "content/renderer/media/webrtc/webrtc_util.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/webrtc/api/scoped_refptr.h"
namespace content {
......@@ -163,7 +163,7 @@ class RTCRtpReceiver::RTCRtpReceiverInternal
blink::WebVector<std::unique_ptr<blink::WebRTCRtpSource>> sources(
webrtc_sources.size());
for (size_t i = 0; i < webrtc_sources.size(); ++i) {
sources[i] = std::make_unique<RTCRtpSource>(webrtc_sources[i]);
sources[i] = blink::CreateRTCRtpSource(webrtc_sources[i]);
}
return sources;
}
......
......@@ -12,6 +12,10 @@ namespace base {
class TimeTicks;
}
namespace webrtc {
class RtpSource;
}
namespace blink {
// Represents both SSRCs and CSRCs.
......@@ -33,6 +37,9 @@ class BLINK_PLATFORM_EXPORT WebRTCRtpSource {
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_
......@@ -1231,6 +1231,8 @@ jumbo_component("platform") {
"peerconnection/rtc_dtmf_sender_handler.cc",
"peerconnection/rtc_dtmf_sender_handler.h",
"peerconnection/rtc_offer_options_platform.h",
"peerconnection/rtc_rtp_source.cc",
"peerconnection/rtc_rtp_source.h",
"peerconnection/rtc_session_description_request.h",
"peerconnection/rtc_stats_request.h",
"peerconnection/rtc_stats_response_base.h",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/renderer/media/webrtc/rtc_rtp_source.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_rtp_source.h"
#include <cmath>
......@@ -10,21 +10,26 @@
#include "base/time/time.h"
#include "third_party/webrtc/api/scoped_refptr.h"
namespace content {
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() {}
blink::WebRTCRtpSource::Type RTCRtpSource::SourceType() const {
WebRTCRtpSource::Type RTCRtpSource::SourceType() const {
switch (source_.source_type()) {
case webrtc::RtpSourceType::SSRC:
return blink::WebRTCRtpSource::Type::kSSRC;
return WebRTCRtpSource::Type::kSSRC;
case webrtc::RtpSourceType::CSRC:
return blink::WebRTCRtpSource::Type::kCSRC;
return WebRTCRtpSource::Type::kCSRC;
default:
NOTREACHED();
return blink::WebRTCRtpSource::Type::kSSRC;
return WebRTCRtpSource::Type::kSSRC;
}
}
......@@ -54,4 +59,4 @@ uint32_t RTCRtpSource::RtpTimestamp() const {
return source_.rtp_timestamp();
}
} // namespace content
} // namespace blink
......@@ -2,23 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_SOURCE_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_SOURCE_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_SOURCE_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_SOURCE_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "third_party/blink/public/platform/web_rtc_rtp_source.h"
#include "third_party/webrtc/api/rtp_receiver_interface.h"
namespace content {
namespace blink {
class CONTENT_EXPORT RTCRtpSource : public blink::WebRTCRtpSource {
class RTCRtpSource : public WebRTCRtpSource {
public:
explicit RTCRtpSource(const webrtc::RtpSource& source);
~RTCRtpSource() override;
blink::WebRTCRtpSource::Type SourceType() const override;
WebRTCRtpSource::Type SourceType() const override;
base::TimeTicks Timestamp() const override;
uint32_t Source() const override;
base::Optional<double> AudioLevel() const override;
......@@ -30,6 +29,6 @@ class CONTENT_EXPORT RTCRtpSource : public blink::WebRTCRtpSource {
DISALLOW_COPY_AND_ASSIGN(RTCRtpSource);
};
} // namespace content
} // namespace blink
#endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_RTP_SOURCE_H_
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_PEERCONNECTION_RTC_RTP_SOURCE_H_
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