Move RtpExtension to api/ directory and config.h/.cc to call/.

BUG=webrtc:5876
R=deadbeef@webrtc.org, solenberg@webrtc.org

Review-Url: https://codereview.webrtc.org/3004723002 .
Cr-Commit-Position: refs/heads/master@{#19639}
This commit is contained in:
Stefan Holmer
2017-09-01 15:29:28 +02:00
parent 801f722377
commit 1acbd68718
41 changed files with 602 additions and 450 deletions

View File

@ -347,7 +347,6 @@ rtc_static_library("webrtc_common") {
sources = [ sources = [
"common_types.cc", "common_types.cc",
"common_types.h", "common_types.h",
"config.cc",
"config.h", "config.h",
"typedefs.h", "typedefs.h",
] ]
@ -384,9 +383,6 @@ if (rtc_include_tests) {
rtc_test("rtc_unittests") { rtc_test("rtc_unittests") {
testonly = true testonly = true
sources = [
"config_unittest.cc",
]
deps = [ deps = [
":webrtc_common", ":webrtc_common",

View File

@ -9,8 +9,8 @@ include_rules = [
"+libyuv", "+libyuv",
"-webrtc", # Has to be disabled; otherwise all dirs below will be allowed. "-webrtc", # Has to be disabled; otherwise all dirs below will be allowed.
# Individual headers that will be moved out of here, see webrtc:4243. # Individual headers that will be moved out of here, see webrtc:4243.
"+webrtc/call/rtp_config.h",
"+webrtc/common_types.h", "+webrtc/common_types.h",
"+webrtc/config.h",
"+webrtc/transport.h", "+webrtc/transport.h",
"+webrtc/typedefs.h", "+webrtc/typedefs.h",
"+webrtc/voice_engine_configurations.h", "+webrtc/voice_engine_configurations.h",

View File

@ -62,6 +62,7 @@ rtc_static_library("libjingle_peerconnection_api") {
"proxy.h", "proxy.h",
"rtcerror.cc", "rtcerror.cc",
"rtcerror.h", "rtcerror.h",
"rtpparameters.cc",
"rtpparameters.h", "rtpparameters.h",
"rtpreceiverinterface.h", "rtpreceiverinterface.h",
"rtpsender.h", "rtpsender.h",
@ -258,6 +259,7 @@ if (rtc_include_tests) {
"ortc/mediadescription_unittest.cc", "ortc/mediadescription_unittest.cc",
"ortc/sessiondescription_unittest.cc", "ortc/sessiondescription_unittest.cc",
"rtcerror_unittest.cc", "rtcerror_unittest.cc",
"rtpparameters_unittest.cc",
] ]
if (!build_with_chromium && is_clang) { if (!build_with_chromium && is_clang) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -7,7 +7,7 @@
* in the file PATENTS. All contributing project authors may * in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
@ -16,27 +16,55 @@
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
namespace webrtc { namespace webrtc {
std::string NackConfig::ToString() const {
std::stringstream ss;
ss << "{rtp_history_ms: " << rtp_history_ms;
ss << '}';
return ss.str();
}
std::string UlpfecConfig::ToString() const { RtcpFeedback::RtcpFeedback() {}
std::stringstream ss; RtcpFeedback::RtcpFeedback(RtcpFeedbackType type) : type(type) {}
ss << "{ulpfec_payload_type: " << ulpfec_payload_type; RtcpFeedback::RtcpFeedback(RtcpFeedbackType type,
ss << ", red_payload_type: " << red_payload_type; RtcpFeedbackMessageType message_type)
ss << ", red_rtx_payload_type: " << red_rtx_payload_type; : type(type), message_type(message_type) {}
ss << '}'; RtcpFeedback::~RtcpFeedback() {}
return ss.str();
}
bool UlpfecConfig::operator==(const UlpfecConfig& other) const { RtpCodecCapability::RtpCodecCapability() {}
return ulpfec_payload_type == other.ulpfec_payload_type && RtpCodecCapability::~RtpCodecCapability() {}
red_payload_type == other.red_payload_type &&
red_rtx_payload_type == other.red_rtx_payload_type; RtpHeaderExtensionCapability::RtpHeaderExtensionCapability() {}
} RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
const std::string& uri)
: uri(uri) {}
RtpHeaderExtensionCapability::RtpHeaderExtensionCapability(
const std::string& uri,
int preferred_id)
: uri(uri), preferred_id(preferred_id) {}
RtpHeaderExtensionCapability::~RtpHeaderExtensionCapability() {}
RtpExtension::RtpExtension() {}
RtpExtension::RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
RtpExtension::RtpExtension(const std::string& uri, int id, bool encrypt)
: uri(uri), id(id), encrypt(encrypt) {}
RtpExtension::~RtpExtension() {}
RtpFecParameters::RtpFecParameters() {}
RtpFecParameters::RtpFecParameters(FecMechanism mechanism)
: mechanism(mechanism) {}
RtpFecParameters::RtpFecParameters(FecMechanism mechanism, uint32_t ssrc)
: ssrc(ssrc), mechanism(mechanism) {}
RtpFecParameters::~RtpFecParameters() {}
RtpRtxParameters::RtpRtxParameters() {}
RtpRtxParameters::RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {}
RtpRtxParameters::~RtpRtxParameters() {}
RtpEncodingParameters::RtpEncodingParameters() {}
RtpEncodingParameters::~RtpEncodingParameters() {}
RtpCodecParameters::RtpCodecParameters() {}
RtpCodecParameters::~RtpCodecParameters() {}
RtpCapabilities::RtpCapabilities() {}
RtpCapabilities::~RtpCapabilities() {}
RtpParameters::RtpParameters() {}
RtpParameters::~RtpParameters() {}
std::string RtpExtension::ToString() const { std::string RtpExtension::ToString() const {
std::stringstream ss; std::stringstream ss;
@ -159,125 +187,4 @@ std::vector<RtpExtension> RtpExtension::FilterDuplicateNonEncrypted(
} }
return filtered; return filtered;
} }
VideoStream::VideoStream()
: width(0),
height(0),
max_framerate(-1),
min_bitrate_bps(-1),
target_bitrate_bps(-1),
max_bitrate_bps(-1),
max_qp(-1) {}
VideoStream::~VideoStream() = default;
std::string VideoStream::ToString() const {
std::stringstream ss;
ss << "{width: " << width;
ss << ", height: " << height;
ss << ", max_framerate: " << max_framerate;
ss << ", min_bitrate_bps:" << min_bitrate_bps;
ss << ", target_bitrate_bps:" << target_bitrate_bps;
ss << ", max_bitrate_bps:" << max_bitrate_bps;
ss << ", max_qp: " << max_qp;
ss << ", temporal_layer_thresholds_bps: [";
for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) {
ss << temporal_layer_thresholds_bps[i];
if (i != temporal_layer_thresholds_bps.size() - 1)
ss << ", ";
}
ss << ']';
ss << '}';
return ss.str();
}
VideoEncoderConfig::VideoEncoderConfig()
: content_type(ContentType::kRealtimeVideo),
encoder_specific_settings(nullptr),
min_transmit_bitrate_bps(0),
max_bitrate_bps(0),
number_of_streams(0) {}
VideoEncoderConfig::VideoEncoderConfig(VideoEncoderConfig&&) = default;
VideoEncoderConfig::~VideoEncoderConfig() = default;
std::string VideoEncoderConfig::ToString() const {
std::stringstream ss;
ss << "{content_type: ";
switch (content_type) {
case ContentType::kRealtimeVideo:
ss << "kRealtimeVideo";
break;
case ContentType::kScreen:
ss << "kScreenshare";
break;
}
ss << ", encoder_specific_settings: ";
ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
ss << '}';
return ss.str();
}
VideoEncoderConfig::VideoEncoderConfig(const VideoEncoderConfig&) = default;
void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
VideoCodec* codec) const {
if (codec->codecType == kVideoCodecH264) {
FillVideoCodecH264(codec->H264());
} else if (codec->codecType == kVideoCodecVP8) {
FillVideoCodecVp8(codec->VP8());
} else if (codec->codecType == kVideoCodecVP9) {
FillVideoCodecVp9(codec->VP9());
} else {
RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
}
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
VideoCodecH264* h264_settings) const {
RTC_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
VideoCodecVP8* vp8_settings) const {
RTC_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
VideoCodecVP9* vp9_settings) const {
RTC_NOTREACHED();
}
VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(
const VideoCodecH264& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::H264EncoderSpecificSettings::FillVideoCodecH264(
VideoCodecH264* h264_settings) const {
*h264_settings = specifics_;
}
VideoEncoderConfig::Vp8EncoderSpecificSettings::Vp8EncoderSpecificSettings(
const VideoCodecVP8& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::Vp8EncoderSpecificSettings::FillVideoCodecVp8(
VideoCodecVP8* vp8_settings) const {
*vp8_settings = specifics_;
}
VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
const VideoCodecVP9& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
VideoCodecVP9* vp9_settings) const {
*vp9_settings = specifics_;
}
} // namespace webrtc } // namespace webrtc

View File

@ -16,7 +16,6 @@
#include <vector> #include <vector>
#include "webrtc/api/mediatypes.h" #include "webrtc/api/mediatypes.h"
#include "webrtc/config.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/rtc_base/optional.h"
namespace webrtc { namespace webrtc {
@ -85,10 +84,10 @@ struct RtcpFeedback {
rtc::Optional<RtcpFeedbackMessageType> message_type; rtc::Optional<RtcpFeedbackMessageType> message_type;
// Constructors for convenience. // Constructors for convenience.
RtcpFeedback() {} RtcpFeedback();
explicit RtcpFeedback(RtcpFeedbackType type) : type(type) {} explicit RtcpFeedback(RtcpFeedbackType type);
RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type) RtcpFeedback(RtcpFeedbackType type, RtcpFeedbackMessageType message_type);
: type(type), message_type(message_type) {} ~RtcpFeedback();
bool operator==(const RtcpFeedback& o) const { bool operator==(const RtcpFeedback& o) const {
return type == o.type && message_type == o.message_type; return type == o.type && message_type == o.message_type;
@ -100,6 +99,9 @@ struct RtcpFeedback {
// RtpParameters. This represents the static capabilities of an endpoint's // RtpParameters. This represents the static capabilities of an endpoint's
// implementation of a codec. // implementation of a codec.
struct RtpCodecCapability { struct RtpCodecCapability {
RtpCodecCapability();
~RtpCodecCapability();
// Build MIME "type/subtype" string from |name| and |kind|. // Build MIME "type/subtype" string from |name| and |kind|.
std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; } std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
@ -196,10 +198,10 @@ struct RtpHeaderExtensionCapability {
bool preferred_encrypt = false; bool preferred_encrypt = false;
// Constructors for convenience. // Constructors for convenience.
RtpHeaderExtensionCapability() = default; RtpHeaderExtensionCapability();
explicit RtpHeaderExtensionCapability(const std::string& uri) : uri(uri) {} explicit RtpHeaderExtensionCapability(const std::string& uri);
RtpHeaderExtensionCapability(const std::string& uri, int preferred_id) RtpHeaderExtensionCapability(const std::string& uri, int preferred_id);
: uri(uri), preferred_id(preferred_id) {} ~RtpHeaderExtensionCapability();
bool operator==(const RtpHeaderExtensionCapability& o) const { bool operator==(const RtpHeaderExtensionCapability& o) const {
return uri == o.uri && preferred_id == o.preferred_id && return uri == o.uri && preferred_id == o.preferred_id &&
@ -210,6 +212,83 @@ struct RtpHeaderExtensionCapability {
} }
}; };
// RTP header extension, see RFC 5285.
struct RtpExtension {
RtpExtension();
RtpExtension(const std::string& uri, int id);
RtpExtension(const std::string& uri, int id, bool encrypt);
~RtpExtension();
std::string ToString() const;
bool operator==(const RtpExtension& rhs) const {
return uri == rhs.uri && id == rhs.id && encrypt == rhs.encrypt;
}
static bool IsSupportedForAudio(const std::string& uri);
static bool IsSupportedForVideo(const std::string& uri);
// Return "true" if the given RTP header extension URI may be encrypted.
static bool IsEncryptionSupported(const std::string& uri);
// Returns the named header extension if found among all extensions,
// nullptr otherwise.
static const RtpExtension* FindHeaderExtensionByUri(
const std::vector<RtpExtension>& extensions,
const std::string& uri);
// Return a list of RTP header extensions with the non-encrypted extensions
// removed if both the encrypted and non-encrypted extension is present for
// the same URI.
static std::vector<RtpExtension> FilterDuplicateNonEncrypted(
const std::vector<RtpExtension>& extensions);
// Header extension for audio levels, as defined in:
// http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03
static const char kAudioLevelUri[];
static const int kAudioLevelDefaultId;
// Header extension for RTP timestamp offset, see RFC 5450 for details:
// http://tools.ietf.org/html/rfc5450
static const char kTimestampOffsetUri[];
static const int kTimestampOffsetDefaultId;
// Header extension for absolute send time, see url for details:
// http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
static const char kAbsSendTimeUri[];
static const int kAbsSendTimeDefaultId;
// Header extension for coordination of video orientation, see url for
// details:
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf
static const char kVideoRotationUri[];
static const int kVideoRotationDefaultId;
// Header extension for video content type. E.g. default or screenshare.
static const char kVideoContentTypeUri[];
static const int kVideoContentTypeDefaultId;
// Header extension for video timing.
static const char kVideoTimingUri[];
static const int kVideoTimingDefaultId;
// Header extension for transport sequence number, see url for details:
// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
static const char kTransportSequenceNumberUri[];
static const int kTransportSequenceNumberDefaultId;
static const char kPlayoutDelayUri[];
static const int kPlayoutDelayDefaultId;
// Encryption of Header Extensions, see RFC 6904 for details:
// https://tools.ietf.org/html/rfc6904
static const char kEncryptHeaderExtensionsUri[];
// Inclusive min and max IDs for one-byte header extensions, per RFC5285.
static const int kMinId;
static const int kMaxId;
std::string uri;
int id = 0;
bool encrypt = false;
};
// See webrtc/config.h. Has "uri" and "id" fields. // See webrtc/config.h. Has "uri" and "id" fields.
// TODO(deadbeef): This is missing the "encrypt" flag, which is unimplemented. // TODO(deadbeef): This is missing the "encrypt" flag, which is unimplemented.
typedef RtpExtension RtpHeaderExtensionParameters; typedef RtpExtension RtpHeaderExtensionParameters;
@ -222,10 +301,10 @@ struct RtpFecParameters {
FecMechanism mechanism = FecMechanism::RED; FecMechanism mechanism = FecMechanism::RED;
// Constructors for convenience. // Constructors for convenience.
RtpFecParameters() = default; RtpFecParameters();
explicit RtpFecParameters(FecMechanism mechanism) : mechanism(mechanism) {} explicit RtpFecParameters(FecMechanism mechanism);
RtpFecParameters(FecMechanism mechanism, uint32_t ssrc) RtpFecParameters(FecMechanism mechanism, uint32_t ssrc);
: ssrc(ssrc), mechanism(mechanism) {} ~RtpFecParameters();
bool operator==(const RtpFecParameters& o) const { bool operator==(const RtpFecParameters& o) const {
return ssrc == o.ssrc && mechanism == o.mechanism; return ssrc == o.ssrc && mechanism == o.mechanism;
@ -239,14 +318,18 @@ struct RtpRtxParameters {
rtc::Optional<uint32_t> ssrc; rtc::Optional<uint32_t> ssrc;
// Constructors for convenience. // Constructors for convenience.
RtpRtxParameters() = default; RtpRtxParameters();
explicit RtpRtxParameters(uint32_t ssrc) : ssrc(ssrc) {} explicit RtpRtxParameters(uint32_t ssrc);
~RtpRtxParameters();
bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; } bool operator==(const RtpRtxParameters& o) const { return ssrc == o.ssrc; }
bool operator!=(const RtpRtxParameters& o) const { return !(*this == o); } bool operator!=(const RtpRtxParameters& o) const { return !(*this == o); }
}; };
struct RtpEncodingParameters { struct RtpEncodingParameters {
RtpEncodingParameters();
~RtpEncodingParameters();
// If unset, a value is chosen by the implementation. // If unset, a value is chosen by the implementation.
// //
// Note that the chosen value is NOT returned by GetParameters, because it // Note that the chosen value is NOT returned by GetParameters, because it
@ -338,6 +421,9 @@ struct RtpEncodingParameters {
}; };
struct RtpCodecParameters { struct RtpCodecParameters {
RtpCodecParameters();
~RtpCodecParameters();
// Build MIME "type/subtype" string from |name| and |kind|. // Build MIME "type/subtype" string from |name| and |kind|.
std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; } std::string mime_type() const { return MediaTypeToString(kind) + "/" + name; }
@ -400,6 +486,9 @@ struct RtpCodecParameters {
// endpoint. An application can use these capabilities to construct an // endpoint. An application can use these capabilities to construct an
// RtpParameters. // RtpParameters.
struct RtpCapabilities { struct RtpCapabilities {
RtpCapabilities();
~RtpCapabilities();
// Supported codecs. // Supported codecs.
std::vector<RtpCodecCapability> codecs; std::vector<RtpCodecCapability> codecs;
@ -422,6 +511,9 @@ struct RtpCapabilities {
// RtpParameters, because our API includes an additional "RtpTransport" // RtpParameters, because our API includes an additional "RtpTransport"
// abstraction on which RTCP parameters are set. // abstraction on which RTCP parameters are set.
struct RtpParameters { struct RtpParameters {
RtpParameters();
~RtpParameters();
// Used when calling getParameters/setParameters with a PeerConnection // Used when calling getParameters/setParameters with a PeerConnection
// RtpSender, to ensure that outdated parameters are not unintentionally // RtpSender, to ensure that outdated parameters are not unintentionally
// applied successfully. // applied successfully.

View File

@ -8,11 +8,12 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "webrtc/config.h" #include <utility>
#include <vector> #include "webrtc/api/rtpparameters.h"
#include "webrtc/test/gtest.h"
#include "webrtc/rtc_base/gunit.h" namespace webrtc {
using webrtc::RtpExtension; using webrtc::RtpExtension;
@ -47,3 +48,4 @@ TEST(RtpExtensionTest, FilterDuplicateNonEncrypted) {
EXPECT_EQ(2u, filtered.size()); EXPECT_EQ(2u, filtered.size());
EXPECT_EQ(extensions, filtered); EXPECT_EQ(extensions, filtered);
} }
} // namespace webrtc

View File

@ -38,6 +38,8 @@ rtc_source_set("call_interfaces") {
rtc_source_set("rtp_interfaces") { rtc_source_set("rtp_interfaces") {
sources = [ sources = [
"rtcp_packet_sink_interface.h", "rtcp_packet_sink_interface.h",
"rtp_config.cc",
"rtp_config.h",
"rtp_packet_sink_interface.h", "rtp_packet_sink_interface.h",
"rtp_stream_receiver_controller_interface.h", "rtp_stream_receiver_controller_interface.h",
"rtp_transport_controller_send_interface.h", "rtp_transport_controller_send_interface.h",
@ -100,6 +102,7 @@ rtc_static_library("call") {
public_deps = [ public_deps = [
":call_interfaces", ":call_interfaces",
"../api:call_api", "../api:call_api",
"../api:libjingle_peerconnection_api",
] ]
deps = [ deps = [
@ -107,6 +110,7 @@ rtc_static_library("call") {
":rtp_interfaces", ":rtp_interfaces",
":rtp_receiver", ":rtp_receiver",
":rtp_sender", ":rtp_sender",
":video_stream_api",
"..:webrtc_common", "..:webrtc_common",
"../api:transport_api", "../api:transport_api",
"../audio", "../audio",
@ -127,13 +131,17 @@ rtc_static_library("call") {
rtc_source_set("video_stream_api") { rtc_source_set("video_stream_api") {
sources = [ sources = [
"video_config.cc",
"video_config.h",
"video_receive_stream.cc", "video_receive_stream.cc",
"video_receive_stream.h", "video_receive_stream.h",
"video_send_stream.cc", "video_send_stream.cc",
"video_send_stream.h", "video_send_stream.h",
] ]
deps = [ deps = [
":rtp_interfaces",
"../:webrtc_common", "../:webrtc_common",
"../api:libjingle_peerconnection_api",
"../api:transport_api", "../api:transport_api",
"../common_video:common_video", "../common_video:common_video",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
@ -209,6 +217,7 @@ if (rtc_include_tests) {
] ]
deps = [ deps = [
":call_interfaces", ":call_interfaces",
":video_stream_api",
"..:webrtc_common", "..:webrtc_common",
"../api/audio_codecs:builtin_audio_encoder_factory", "../api/audio_codecs:builtin_audio_encoder_factory",
"../logging:rtc_event_log_api", "../logging:rtc_event_log_api",

View File

@ -18,9 +18,10 @@
#include "webrtc/api/audio_codecs/audio_decoder_factory.h" #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/api/rtpreceiverinterface.h" #include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/call/rtp_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h" #include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"

View File

@ -18,8 +18,10 @@
#include "webrtc/api/audio_codecs/audio_encoder_factory.h" #include "webrtc/api/audio_codecs/audio_encoder_factory.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/call/rtp_config.h"
#include "webrtc/rtc_base/optional.h" #include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -26,7 +26,6 @@
#include "webrtc/call/flexfec_receive_stream_impl.h" #include "webrtc/call/flexfec_receive_stream_impl.h"
#include "webrtc/call/rtp_stream_receiver_controller.h" #include "webrtc/call/rtp_stream_receiver_controller.h"
#include "webrtc/call/rtp_transport_controller_send.h" #include "webrtc/call/rtp_transport_controller_send.h"
#include "webrtc/config.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/congestion_controller/include/receive_side_congestion_controller.h" #include "webrtc/modules/congestion_controller/include/receive_side_congestion_controller.h"

View File

@ -15,7 +15,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h"
#include "webrtc/call/call.h" #include "webrtc/call/call.h"
#include "webrtc/config.h" #include "webrtc/call/video_config.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"

View File

@ -17,8 +17,9 @@
#include <vector> #include <vector>
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/call/rtp_packet_sink_interface.h" #include "webrtc/call/rtp_packet_sink_interface.h"
#include "webrtc/config.h" #include "webrtc/common_types.h"
namespace webrtc { namespace webrtc {

38
webrtc/call/rtp_config.cc Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/call/rtp_config.h"
#include <sstream>
namespace webrtc {
std::string NackConfig::ToString() const {
std::stringstream ss;
ss << "{rtp_history_ms: " << rtp_history_ms;
ss << '}';
return ss.str();
}
std::string UlpfecConfig::ToString() const {
std::stringstream ss;
ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
ss << ", red_payload_type: " << red_payload_type;
ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
ss << '}';
return ss.str();
}
bool UlpfecConfig::operator==(const UlpfecConfig& other) const {
return ulpfec_payload_type == other.ulpfec_payload_type &&
red_payload_type == other.red_payload_type &&
red_rtx_payload_type == other.red_rtx_payload_type;
}
} // namespace webrtc

48
webrtc/call/rtp_config.h Normal file
View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_CALL_RTP_CONFIG_H_
#define WEBRTC_CALL_RTP_CONFIG_H_
#include <string>
namespace webrtc {
// Settings for NACK, see RFC 4585 for details.
struct NackConfig {
NackConfig() : rtp_history_ms(0) {}
std::string ToString() const;
// Send side: the time RTP packets are stored for retransmissions.
// Receive side: the time the receiver is prepared to wait for
// retransmissions.
// Set to '0' to disable.
int rtp_history_ms;
};
// Settings for ULPFEC forward error correction.
// Set the payload types to '-1' to disable.
struct UlpfecConfig {
UlpfecConfig()
: ulpfec_payload_type(-1),
red_payload_type(-1),
red_rtx_payload_type(-1) {}
std::string ToString() const;
bool operator==(const UlpfecConfig& other) const;
// Payload type used for ULPFEC packets.
int ulpfec_payload_type;
// Payload type used for RED packets.
int red_payload_type;
// RTX payload type for RED payload.
int red_rtx_payload_type;
};
} // namespace webrtc
#endif // WEBRTC_CALL_RTP_CONFIG_H_

139
webrtc/call/video_config.cc Normal file
View File

@ -0,0 +1,139 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/call/video_config.h"
#include <algorithm>
#include <sstream>
#include <string>
#include "webrtc/rtc_base/checks.h"
namespace webrtc {
VideoStream::VideoStream()
: width(0),
height(0),
max_framerate(-1),
min_bitrate_bps(-1),
target_bitrate_bps(-1),
max_bitrate_bps(-1),
max_qp(-1) {}
VideoStream::~VideoStream() = default;
std::string VideoStream::ToString() const {
std::stringstream ss;
ss << "{width: " << width;
ss << ", height: " << height;
ss << ", max_framerate: " << max_framerate;
ss << ", min_bitrate_bps:" << min_bitrate_bps;
ss << ", target_bitrate_bps:" << target_bitrate_bps;
ss << ", max_bitrate_bps:" << max_bitrate_bps;
ss << ", max_qp: " << max_qp;
ss << ", temporal_layer_thresholds_bps: [";
for (size_t i = 0; i < temporal_layer_thresholds_bps.size(); ++i) {
ss << temporal_layer_thresholds_bps[i];
if (i != temporal_layer_thresholds_bps.size() - 1)
ss << ", ";
}
ss << ']';
ss << '}';
return ss.str();
}
VideoEncoderConfig::VideoEncoderConfig()
: content_type(ContentType::kRealtimeVideo),
encoder_specific_settings(nullptr),
min_transmit_bitrate_bps(0),
max_bitrate_bps(0),
number_of_streams(0) {}
VideoEncoderConfig::VideoEncoderConfig(VideoEncoderConfig&&) = default;
VideoEncoderConfig::~VideoEncoderConfig() = default;
std::string VideoEncoderConfig::ToString() const {
std::stringstream ss;
ss << "{content_type: ";
switch (content_type) {
case ContentType::kRealtimeVideo:
ss << "kRealtimeVideo";
break;
case ContentType::kScreen:
ss << "kScreenshare";
break;
}
ss << ", encoder_specific_settings: ";
ss << (encoder_specific_settings != NULL ? "(ptr)" : "NULL");
ss << ", min_transmit_bitrate_bps: " << min_transmit_bitrate_bps;
ss << '}';
return ss.str();
}
VideoEncoderConfig::VideoEncoderConfig(const VideoEncoderConfig&) = default;
void VideoEncoderConfig::EncoderSpecificSettings::FillEncoderSpecificSettings(
VideoCodec* codec) const {
if (codec->codecType == kVideoCodecH264) {
FillVideoCodecH264(codec->H264());
} else if (codec->codecType == kVideoCodecVP8) {
FillVideoCodecVp8(codec->VP8());
} else if (codec->codecType == kVideoCodecVP9) {
FillVideoCodecVp9(codec->VP9());
} else {
RTC_NOTREACHED() << "Encoder specifics set/used for unknown codec type.";
}
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecH264(
VideoCodecH264* h264_settings) const {
RTC_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp8(
VideoCodecVP8* vp8_settings) const {
RTC_NOTREACHED();
}
void VideoEncoderConfig::EncoderSpecificSettings::FillVideoCodecVp9(
VideoCodecVP9* vp9_settings) const {
RTC_NOTREACHED();
}
VideoEncoderConfig::H264EncoderSpecificSettings::H264EncoderSpecificSettings(
const VideoCodecH264& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::H264EncoderSpecificSettings::FillVideoCodecH264(
VideoCodecH264* h264_settings) const {
*h264_settings = specifics_;
}
VideoEncoderConfig::Vp8EncoderSpecificSettings::Vp8EncoderSpecificSettings(
const VideoCodecVP8& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::Vp8EncoderSpecificSettings::FillVideoCodecVp8(
VideoCodecVP8* vp8_settings) const {
*vp8_settings = specifics_;
}
VideoEncoderConfig::Vp9EncoderSpecificSettings::Vp9EncoderSpecificSettings(
const VideoCodecVP9& specifics)
: specifics_(specifics) {}
void VideoEncoderConfig::Vp9EncoderSpecificSettings::FillVideoCodecVp9(
VideoCodecVP9* vp9_settings) const {
*vp9_settings = specifics_;
}
} // namespace webrtc

157
webrtc/call/video_config.h Normal file
View File

@ -0,0 +1,157 @@
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_CALL_VIDEO_CONFIG_H_
#define WEBRTC_CALL_VIDEO_CONFIG_H_
#include <string>
#include <vector>
#include "webrtc/common_types.h"
#include "webrtc/rtc_base/basictypes.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/refcount.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
struct VideoStream {
VideoStream();
~VideoStream();
std::string ToString() const;
size_t width;
size_t height;
int max_framerate;
int min_bitrate_bps;
int target_bitrate_bps;
int max_bitrate_bps;
int max_qp;
// Bitrate thresholds for enabling additional temporal layers. Since these are
// thresholds in between layers, we have one additional layer. One threshold
// gives two temporal layers, one below the threshold and one above, two give
// three, and so on.
// The VideoEncoder may redistribute bitrates over the temporal layers so a
// bitrate threshold of 100k and an estimate of 105k does not imply that we
// get 100k in one temporal layer and 5k in the other, just that the bitrate
// in the first temporal layer should not exceed 100k.
// TODO(kthelgason): Apart from a special case for two-layer screencast these
// thresholds are not propagated to the VideoEncoder. To be implemented.
std::vector<int> temporal_layer_thresholds_bps;
};
class VideoEncoderConfig {
public:
// These are reference counted to permit copying VideoEncoderConfig and be
// kept alive until all encoder_specific_settings go out of scope.
// TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig
// and use rtc::Optional for encoder_specific_settings instead.
class EncoderSpecificSettings : public rtc::RefCountInterface {
public:
// TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
// not in use and encoder implementations ask for codec-specific structs
// directly.
void FillEncoderSpecificSettings(VideoCodec* codec_struct) const;
virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const;
virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const;
virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const;
private:
~EncoderSpecificSettings() override {}
friend class VideoEncoderConfig;
};
class H264EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics);
void FillVideoCodecH264(VideoCodecH264* h264_settings) const override;
private:
VideoCodecH264 specifics_;
};
class Vp8EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics);
void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override;
private:
VideoCodecVP8 specifics_;
};
class Vp9EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics);
void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override;
private:
VideoCodecVP9 specifics_;
};
enum class ContentType {
kRealtimeVideo,
kScreen,
};
class VideoStreamFactoryInterface : public rtc::RefCountInterface {
public:
// An implementation should return a std::vector<VideoStream> with the
// wanted VideoStream settings for the given video resolution.
// The size of the vector may not be larger than
// |encoder_config.number_of_streams|.
virtual std::vector<VideoStream> CreateEncoderStreams(
int width,
int height,
const VideoEncoderConfig& encoder_config) = 0;
protected:
~VideoStreamFactoryInterface() override {}
};
VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default;
VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete;
// Mostly used by tests. Avoid creating copies if you can.
VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); }
VideoEncoderConfig();
VideoEncoderConfig(VideoEncoderConfig&&);
~VideoEncoderConfig();
std::string ToString() const;
rtc::scoped_refptr<VideoStreamFactoryInterface> video_stream_factory;
std::vector<SpatialLayer> spatial_layers;
ContentType content_type;
rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings;
// Padding will be used up to this bitrate regardless of the bitrate produced
// by the encoder. Padding above what's actually produced by the encoder helps
// maintaining a higher bitrate estimate. Padding will however not be sent
// unless the estimated bandwidth indicates that the link can handle it.
int min_transmit_bitrate_bps;
int max_bitrate_bps;
// Max number of encoded VideoStreams to produce.
size_t number_of_streams;
private:
// Access to the copy constructor is private to force use of the Copy()
// method for those exceptional cases where we do use it.
VideoEncoderConfig(const VideoEncoderConfig&);
};
} // namespace webrtc
#endif // WEBRTC_CALL_VIDEO_CONFIG_H_

View File

@ -17,9 +17,10 @@
#include <vector> #include <vector>
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/call/rtp_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/common_video/include/frame_callback.h" #include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/config.h"
#include "webrtc/media/base/videosinkinterface.h" #include "webrtc/media/base/videosinkinterface.h"
#include "webrtc/rtc_base/platform_file.h" #include "webrtc/rtc_base/platform_file.h"

View File

@ -17,9 +17,11 @@
#include <vector> #include <vector>
#include "webrtc/api/call/transport.h" #include "webrtc/api/call/transport.h"
#include "webrtc/api/rtpparameters.h"
#include "webrtc/call/rtp_config.h"
#include "webrtc/call/video_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/common_video/include/frame_callback.h" #include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/config.h"
#include "webrtc/media/base/videosinkinterface.h" #include "webrtc/media/base/videosinkinterface.h"
#include "webrtc/media/base/videosourceinterface.h" #include "webrtc/media/base/videosourceinterface.h"
#include "webrtc/rtc_base/platform_file.h" #include "webrtc/rtc_base/platform_file.h"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
* *
* Use of this source code is governed by a BSD-style license * Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source * that can be found in the LICENSE file in the root of the source
@ -8,259 +8,12 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
// TODO(pbos): Move Config from common.h to here.
#ifndef WEBRTC_CONFIG_H_ #ifndef WEBRTC_CONFIG_H_
#define WEBRTC_CONFIG_H_ #define WEBRTC_CONFIG_H_
#include <string> // TODO(holmer): Delete this file once downstream projects have been updated.
#include <vector>
#include "webrtc/common_types.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/rtc_base/basictypes.h" #include "webrtc/call/rtp_config.h"
#include "webrtc/rtc_base/optional.h"
#include "webrtc/rtc_base/refcount.h"
#include "webrtc/rtc_base/scoped_ref_ptr.h"
#include "webrtc/typedefs.h"
namespace webrtc {
// Settings for NACK, see RFC 4585 for details.
struct NackConfig {
NackConfig() : rtp_history_ms(0) {}
std::string ToString() const;
// Send side: the time RTP packets are stored for retransmissions.
// Receive side: the time the receiver is prepared to wait for
// retransmissions.
// Set to '0' to disable.
int rtp_history_ms;
};
// Settings for ULPFEC forward error correction.
// Set the payload types to '-1' to disable.
struct UlpfecConfig {
UlpfecConfig()
: ulpfec_payload_type(-1),
red_payload_type(-1),
red_rtx_payload_type(-1) {}
std::string ToString() const;
bool operator==(const UlpfecConfig& other) const;
// Payload type used for ULPFEC packets.
int ulpfec_payload_type;
// Payload type used for RED packets.
int red_payload_type;
// RTX payload type for RED payload.
int red_rtx_payload_type;
};
// RTP header extension, see RFC 5285.
struct RtpExtension {
RtpExtension() {}
RtpExtension(const std::string& uri, int id) : uri(uri), id(id) {}
RtpExtension(const std::string& uri, int id, bool encrypt) : uri(uri),
id(id), encrypt(encrypt) {}
std::string ToString() const;
bool operator==(const RtpExtension& rhs) const {
return uri == rhs.uri && id == rhs.id && encrypt == rhs.encrypt;
}
static bool IsSupportedForAudio(const std::string& uri);
static bool IsSupportedForVideo(const std::string& uri);
// Return "true" if the given RTP header extension URI may be encrypted.
static bool IsEncryptionSupported(const std::string& uri);
// Returns the named header extension if found among all extensions,
// nullptr otherwise.
static const RtpExtension* FindHeaderExtensionByUri(
const std::vector<RtpExtension>& extensions,
const std::string& uri);
// Return a list of RTP header extensions with the non-encrypted extensions
// removed if both the encrypted and non-encrypted extension is present for
// the same URI.
static std::vector<RtpExtension> FilterDuplicateNonEncrypted(
const std::vector<RtpExtension>& extensions);
// Header extension for audio levels, as defined in:
// http://tools.ietf.org/html/draft-ietf-avtext-client-to-mixer-audio-level-03
static const char kAudioLevelUri[];
static const int kAudioLevelDefaultId;
// Header extension for RTP timestamp offset, see RFC 5450 for details:
// http://tools.ietf.org/html/rfc5450
static const char kTimestampOffsetUri[];
static const int kTimestampOffsetDefaultId;
// Header extension for absolute send time, see url for details:
// http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
static const char kAbsSendTimeUri[];
static const int kAbsSendTimeDefaultId;
// Header extension for coordination of video orientation, see url for
// details:
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf
static const char kVideoRotationUri[];
static const int kVideoRotationDefaultId;
// Header extension for video content type. E.g. default or screenshare.
static const char kVideoContentTypeUri[];
static const int kVideoContentTypeDefaultId;
// Header extension for video timing.
static const char kVideoTimingUri[];
static const int kVideoTimingDefaultId;
// Header extension for transport sequence number, see url for details:
// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
static const char kTransportSequenceNumberUri[];
static const int kTransportSequenceNumberDefaultId;
static const char kPlayoutDelayUri[];
static const int kPlayoutDelayDefaultId;
// Encryption of Header Extensions, see RFC 6904 for details:
// https://tools.ietf.org/html/rfc6904
static const char kEncryptHeaderExtensionsUri[];
// Inclusive min and max IDs for one-byte header extensions, per RFC5285.
static const int kMinId;
static const int kMaxId;
std::string uri;
int id = 0;
bool encrypt = false;
};
struct VideoStream {
VideoStream();
~VideoStream();
std::string ToString() const;
size_t width;
size_t height;
int max_framerate;
int min_bitrate_bps;
int target_bitrate_bps;
int max_bitrate_bps;
int max_qp;
// Bitrate thresholds for enabling additional temporal layers. Since these are
// thresholds in between layers, we have one additional layer. One threshold
// gives two temporal layers, one below the threshold and one above, two give
// three, and so on.
// The VideoEncoder may redistribute bitrates over the temporal layers so a
// bitrate threshold of 100k and an estimate of 105k does not imply that we
// get 100k in one temporal layer and 5k in the other, just that the bitrate
// in the first temporal layer should not exceed 100k.
// TODO(kthelgason): Apart from a special case for two-layer screencast these
// thresholds are not propagated to the VideoEncoder. To be implemented.
std::vector<int> temporal_layer_thresholds_bps;
};
class VideoEncoderConfig {
public:
// These are reference counted to permit copying VideoEncoderConfig and be
// kept alive until all encoder_specific_settings go out of scope.
// TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig
// and use rtc::Optional for encoder_specific_settings instead.
class EncoderSpecificSettings : public rtc::RefCountInterface {
public:
// TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
// not in use and encoder implementations ask for codec-specific structs
// directly.
void FillEncoderSpecificSettings(VideoCodec* codec_struct) const;
virtual void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const;
virtual void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const;
virtual void FillVideoCodecH264(VideoCodecH264* h264_settings) const;
private:
~EncoderSpecificSettings() override {}
friend class VideoEncoderConfig;
};
class H264EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit H264EncoderSpecificSettings(const VideoCodecH264& specifics);
void FillVideoCodecH264(VideoCodecH264* h264_settings) const override;
private:
VideoCodecH264 specifics_;
};
class Vp8EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit Vp8EncoderSpecificSettings(const VideoCodecVP8& specifics);
void FillVideoCodecVp8(VideoCodecVP8* vp8_settings) const override;
private:
VideoCodecVP8 specifics_;
};
class Vp9EncoderSpecificSettings : public EncoderSpecificSettings {
public:
explicit Vp9EncoderSpecificSettings(const VideoCodecVP9& specifics);
void FillVideoCodecVp9(VideoCodecVP9* vp9_settings) const override;
private:
VideoCodecVP9 specifics_;
};
enum class ContentType {
kRealtimeVideo,
kScreen,
};
class VideoStreamFactoryInterface : public rtc::RefCountInterface {
public:
// An implementation should return a std::vector<VideoStream> with the
// wanted VideoStream settings for the given video resolution.
// The size of the vector may not be larger than
// |encoder_config.number_of_streams|.
virtual std::vector<VideoStream> CreateEncoderStreams(
int width,
int height,
const VideoEncoderConfig& encoder_config) = 0;
protected:
~VideoStreamFactoryInterface() override {}
};
VideoEncoderConfig& operator=(VideoEncoderConfig&&) = default;
VideoEncoderConfig& operator=(const VideoEncoderConfig&) = delete;
// Mostly used by tests. Avoid creating copies if you can.
VideoEncoderConfig Copy() const { return VideoEncoderConfig(*this); }
VideoEncoderConfig();
VideoEncoderConfig(VideoEncoderConfig&&);
~VideoEncoderConfig();
std::string ToString() const;
rtc::scoped_refptr<VideoStreamFactoryInterface> video_stream_factory;
std::vector<SpatialLayer> spatial_layers;
ContentType content_type;
rtc::scoped_refptr<const EncoderSpecificSettings> encoder_specific_settings;
// Padding will be used up to this bitrate regardless of the bitrate produced
// by the encoder. Padding above what's actually produced by the encoder helps
// maintaining a higher bitrate estimate. Padding will however not be sent
// unless the estimated bandwidth indicates that the link can handle it.
int min_transmit_bitrate_bps;
int max_bitrate_bps;
// Max number of encoded VideoStreams to produce.
size_t number_of_streams;
private:
// Access to the copy constructor is private to force use of the Copy()
// method for those exceptional cases where we do use it.
VideoEncoderConfig(const VideoEncoderConfig&);
};
} // namespace webrtc
#endif // WEBRTC_CONFIG_H_ #endif // WEBRTC_CONFIG_H_

View File

@ -29,6 +29,7 @@ rtc_source_set("rtc_event_log_api") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../api:libjingle_peerconnection_api",
"../call:video_stream_api", "../call:video_stream_api",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
] ]
@ -159,6 +160,7 @@ if (rtc_enable_protobuf) {
":rtc_event_log_api", ":rtc_event_log_api",
":rtc_event_log_impl", ":rtc_event_log_impl",
":rtc_event_log_parser", ":rtc_event_log_parser",
"../call:video_stream_api",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
# TODO(kwiberg): Remove this dependency. # TODO(kwiberg): Remove this dependency.

View File

@ -15,7 +15,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/common_types.h"
#include "webrtc/rtc_base/platform_file.h" #include "webrtc/rtc_base/platform_file.h"
namespace webrtc { namespace webrtc {

View File

@ -16,8 +16,8 @@
#include <string> #include <string>
#include <utility> // pair #include <utility> // pair
#include "webrtc/call/video_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"

View File

@ -18,7 +18,7 @@
#include "webrtc/api/rtpparameters.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/api/rtpreceiverinterface.h" #include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/api/video/video_timing.h" #include "webrtc/api/video/video_timing.h"
#include "webrtc/config.h" #include "webrtc/call/video_config.h"
#include "webrtc/media/base/codec.h" #include "webrtc/media/base/codec.h"
#include "webrtc/media/base/mediaconstants.h" #include "webrtc/media/base/mediaconstants.h"
#include "webrtc/media/base/streamparams.h" #include "webrtc/media/base/streamparams.h"

View File

@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include "webrtc/config.h" #include "webrtc/call/video_config.h"
#include "webrtc/rtc_base/basictypes.h" #include "webrtc/rtc_base/basictypes.h"
namespace cricket { namespace cricket {

View File

@ -15,7 +15,6 @@
#include <vector> #include <vector>
#include "webrtc/call/call.h" #include "webrtc/call/call.h"
#include "webrtc/config.h"
#include "webrtc/media/base/mediaengine.h" #include "webrtc/media/base/mediaengine.h"
namespace webrtc { namespace webrtc {

View File

@ -20,7 +20,6 @@
#include "webrtc/api/rtpreceiverinterface.h" #include "webrtc/api/rtpreceiverinterface.h"
#include "webrtc/call/audio_state.h" #include "webrtc/call/audio_state.h"
#include "webrtc/call/call.h" #include "webrtc/call/call.h"
#include "webrtc/config.h"
#include "webrtc/media/base/rtputils.h" #include "webrtc/media/base/rtputils.h"
#include "webrtc/media/engine/apm_helpers.h" #include "webrtc/media/engine/apm_helpers.h"
#include "webrtc/media/engine/webrtccommon.h" #include "webrtc/media/engine/webrtccommon.h"

View File

@ -1569,8 +1569,11 @@ if (rtc_include_tests) {
":isac_fix", ":isac_fix",
":webrtc_opus", ":webrtc_opus",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:libjingle_peerconnection_api",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:metrics_default",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",
"../../test:field_trial",
"../../test:test_main", "../../test:test_main",
"../audio_processing", "../audio_processing",
"//testing/gtest", "//testing/gtest",
@ -1702,6 +1705,8 @@ if (rtc_include_tests) {
"../..:webrtc_common", "../..:webrtc_common",
"../../common_audio", "../../common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:metrics_default",
"../../test:field_trial",
] ]
configs += [ ":RTPencode_config" ] configs += [ ":RTPencode_config" ]

View File

@ -14,7 +14,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "webrtc/config.h"
#include "webrtc/modules/audio_processing/test/test_utils.h" #include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/array_view.h" #include "webrtc/rtc_base/array_view.h"

View File

@ -10,7 +10,6 @@
#include "webrtc/modules/audio_processing/audio_processing_impl.h" #include "webrtc/modules/audio_processing/audio_processing_impl.h"
#include "webrtc/config.h"
#include "webrtc/modules/audio_processing/test/test_utils.h" #include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/test/gmock.h" #include "webrtc/test/gmock.h"

View File

@ -15,7 +15,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "webrtc/config.h"
#include "webrtc/modules/audio_processing/test/test_utils.h" #include "webrtc/modules/audio_processing/test/test_utils.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/rtc_base/array_view.h" #include "webrtc/rtc_base/array_view.h"

View File

@ -341,6 +341,7 @@ if (rtc_include_tests) {
":rtp_rtcp", ":rtp_rtcp",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../api:libjingle_peerconnection_api",
"../../api:transport_api", "../../api:transport_api",
"../../common_video:common_video", "../../common_video:common_video",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",

View File

@ -14,7 +14,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h"

View File

@ -13,7 +13,7 @@
#include <string> #include <string>
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/rtc_base/array_view.h" #include "webrtc/rtc_base/array_view.h"
#include "webrtc/rtc_base/basictypes.h" #include "webrtc/rtc_base/basictypes.h"

View File

@ -10,7 +10,7 @@
#include <vector> #include <vector>
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h" #include "webrtc/modules/rtp_rtcp/include/flexfec_sender.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h" #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h"

View File

@ -16,8 +16,8 @@
#include <set> #include <set>
#include <string> #include <string>
#include "webrtc/api/rtpparameters.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h" #include "webrtc/rtc_base/logging.h"

View File

@ -22,13 +22,8 @@
#include "webrtc/api/jsepicecandidate.h" #include "webrtc/api/jsepicecandidate.h"
#include "webrtc/api/jsepsessiondescription.h" #include "webrtc/api/jsepsessiondescription.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/messagedigest.h"
#include "webrtc/rtc_base/stringutils.h"
// for RtpExtension // for RtpExtension
#include "webrtc/config.h" #include "webrtc/api/rtpparameters.h"
#include "webrtc/media/base/codec.h" #include "webrtc/media/base/codec.h"
#include "webrtc/media/base/cryptoparams.h" #include "webrtc/media/base/cryptoparams.h"
#include "webrtc/media/base/mediaconstants.h" #include "webrtc/media/base/mediaconstants.h"
@ -38,6 +33,11 @@
#include "webrtc/p2p/base/p2pconstants.h" #include "webrtc/p2p/base/p2pconstants.h"
#include "webrtc/p2p/base/port.h" #include "webrtc/p2p/base/port.h"
#include "webrtc/pc/mediasession.h" #include "webrtc/pc/mediasession.h"
#include "webrtc/rtc_base/arraysize.h"
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/logging.h"
#include "webrtc/rtc_base/messagedigest.h"
#include "webrtc/rtc_base/stringutils.h"
using cricket::AudioContentDescription; using cricket::AudioContentDescription;
using cricket::Candidate; using cricket::Candidate;

View File

@ -15,7 +15,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_encoder_factory.h"
#include "webrtc/call/rtp_transport_controller_send.h" #include "webrtc/call/rtp_transport_controller_send.h"
#include "webrtc/config.h" #include "webrtc/call/video_config.h"
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h" #include "webrtc/modules/audio_mixer/audio_mixer_impl.h"
#include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/event.h" #include "webrtc/rtc_base/event.h"

View File

@ -15,7 +15,6 @@
#include "webrtc/api/video_codecs/video_encoder.h" #include "webrtc/api/video_codecs/video_encoder.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/rtc_base/constructormagic.h" #include "webrtc/rtc_base/constructormagic.h"
#include "webrtc/rtc_base/criticalsection.h" #include "webrtc/rtc_base/criticalsection.h"
#include "webrtc/rtc_base/thread_annotations.h" #include "webrtc/rtc_base/thread_annotations.h"

View File

@ -10,6 +10,7 @@
#include <memory> #include <memory>
#include "webrtc/call/video_config.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h" #include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h" #include "webrtc/modules/video_coding/include/video_codec_interface.h"

View File

@ -14,8 +14,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "webrtc/call/video_config.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/media/base/mediaconstants.h" #include "webrtc/media/base/mediaconstants.h"
#include "webrtc/modules/pacing/packet_router.h" #include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"

View File

@ -15,7 +15,6 @@
#include "webrtc/audio/utility/audio_frame_operations.h" #include "webrtc/audio/utility/audio_frame_operations.h"
#include "webrtc/call/rtp_transport_controller_send_interface.h" #include "webrtc/call/rtp_transport_controller_send_interface.h"
#include "webrtc/config.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h" #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_device/include/audio_device.h" #include "webrtc/modules/audio_device/include/audio_device.h"