Fix circular dependencies in webrtc_common.

One reason for the circular deps is that common_types.h is a
historical dumping ground for various structs and defines that
are believed to be generally useful. I tried moving things out
that did not appear to be used downstream (StreamCounters,
RtpCounters etc) and moved the things that seemed used
(RtpHeader + supporting structs) to a new file api/rtp_headers.h.
This makes their place in the api more clear while moving out
the things that don't belong in the API in the first place.

I had to extract out typedefs.h from webrtc_common to resolve
another circular dependency. I believe checks includes typedefs,
but common depends on checks.

Bug: webrtc:7745
Change-Id: I725d49616b1ec0cdc8b74be7c078f7a4d46f084b
Reviewed-on: https://webrtc-review.googlesource.com/33001
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21295}
This commit is contained in:
Patrik Höglund 2017-12-15 14:40:10 +01:00 committed by Commit Bot
parent d5d0540b86
commit 3e113438b1
57 changed files with 559 additions and 316 deletions

1
.gn
View file

@ -21,6 +21,7 @@ secondary_source = "//build/secondary/"
# their includes checked for proper dependencies when you run either # their includes checked for proper dependencies when you run either
# "gn check" or "gn gen --check". # "gn check" or "gn gen --check".
check_targets = [ check_targets = [
":webrtc_common",
"//api/*", "//api/*",
"//audio/*", "//audio/*",
"//backup/*", "//backup/*",

View file

@ -350,11 +350,24 @@ if (!build_with_chromium) {
} }
} }
rtc_source_set("typedefs") {
sources = [
"typedefs.h",
]
}
rtc_static_library("webrtc_common") { rtc_static_library("webrtc_common") {
sources = [ sources = [
"common_types.cc", "common_types.cc",
"common_types.h", "common_types.h",
"typedefs.h", ]
deps = [
":typedefs",
"api:array_view",
"api:optional",
"rtc_base:checks",
"rtc_base:deprecation",
"rtc_base:stringutils",
] ]
if (!build_with_chromium && is_clang) { if (!build_with_chromium && is_clang) {

View file

@ -59,6 +59,8 @@ rtc_static_library("libjingle_peerconnection_api") {
"proxy.h", "proxy.h",
"rtcerror.cc", "rtcerror.cc",
"rtcerror.h", "rtcerror.h",
"rtp_headers.cc",
"rtp_headers.h",
"rtpparameters.cc", "rtpparameters.cc",
"rtpparameters.h", "rtpparameters.h",
"rtpreceiverinterface.h", "rtpreceiverinterface.h",
@ -84,6 +86,7 @@ rtc_static_library("libjingle_peerconnection_api") {
] ]
deps = [ deps = [
":array_view",
":optional", ":optional",
":rtc_stats_api", ":rtc_stats_api",
":video_frame_api", ":video_frame_api",
@ -93,10 +96,14 @@ rtc_static_library("libjingle_peerconnection_api") {
# Basically, don't add stuff here. You might break sensitive downstream # Basically, don't add stuff here. You might break sensitive downstream
# targets like pnacl. API should not depend on anything outside of this # targets like pnacl. API should not depend on anything outside of this
# file, really. All these should arguably go away in time. # file, really. All these should arguably go away in time.
"..:typedefs",
"..:webrtc_common", "..:webrtc_common",
"../modules/audio_processing:audio_processing_statistics", "../modules/audio_processing:audio_processing_statistics",
"../rtc_base:checks",
"../rtc_base:deprecation",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
] ]
# This is needed until bugs.webrtc.org/7504 is removed so this target can # This is needed until bugs.webrtc.org/7504 is removed so this target can

View file

@ -29,7 +29,9 @@ rtc_source_set("audio_codecs_api") {
"..:array_view", "..:array_view",
"..:optional", "..:optional",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:sanitizer", "../../rtc_base:sanitizer",
] ]

View file

@ -16,6 +16,7 @@
#include "api/optional.h" #include "api/optional.h"
#include "api/ortc/packettransportinterface.h" #include "api/ortc/packettransportinterface.h"
#include "api/rtcerror.h" #include "api/rtcerror.h"
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
namespace webrtc { namespace webrtc {

62
api/rtp_headers.cc Normal file
View file

@ -0,0 +1,62 @@
/*
* 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 "api/rtp_headers.h"
#include <string.h>
#include <algorithm>
#include <limits>
#include <type_traits>
#include "rtc_base/checks.h"
#include "rtc_base/stringutils.h"
namespace webrtc {
RTPHeaderExtension::RTPHeaderExtension()
: hasTransmissionTimeOffset(false),
transmissionTimeOffset(0),
hasAbsoluteSendTime(false),
absoluteSendTime(0),
hasTransportSequenceNumber(false),
transportSequenceNumber(0),
hasAudioLevel(false),
voiceActivity(false),
audioLevel(0),
hasVideoRotation(false),
videoRotation(kVideoRotation_0),
hasVideoContentType(false),
videoContentType(VideoContentType::UNSPECIFIED),
has_video_timing(false) {}
RTPHeaderExtension::RTPHeaderExtension(const RTPHeaderExtension& other) =
default;
RTPHeaderExtension& RTPHeaderExtension::operator=(
const RTPHeaderExtension& other) = default;
RTPHeader::RTPHeader()
: markerBit(false),
payloadType(0),
sequenceNumber(0),
timestamp(0),
ssrc(0),
numCSRCs(0),
arrOfCSRCs(),
paddingLength(0),
headerLength(0),
payload_type_frequency(0),
extension() {}
RTPHeader::RTPHeader(const RTPHeader& other) = default;
RTPHeader& RTPHeader::operator=(const RTPHeader& other) = default;
} // namespace webrtc

178
api/rtp_headers.h Normal file
View file

@ -0,0 +1,178 @@
/*
* 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 API_RTP_HEADERS_H_
#define API_RTP_HEADERS_H_
#include <stddef.h>
#include <string.h>
#include <ostream>
#include <string>
#include <vector>
#include "api/array_view.h"
#include "api/optional.h"
#include "api/video/video_content_type.h"
#include "api/video/video_rotation.h"
#include "api/video/video_timing.h"
#include "rtc_base/checks.h"
#include "rtc_base/deprecation.h"
#include "common_types.h" // NOLINT(build/include)
#include "typedefs.h" // NOLINT(build/include)
namespace webrtc {
// Class to represent the value of RTP header extensions that are
// variable-length strings (e.g., RtpStreamId and RtpMid).
// Unlike std::string, it can be copied with memcpy and cleared with memset.
//
// Empty value represents unset header extension (use empty() to query).
class StringRtpHeaderExtension {
public:
// String RTP header extensions are limited to 16 bytes because it is the
// maximum length that can be encoded with one-byte header extensions.
static constexpr size_t kMaxSize = 16;
static bool IsLegalName(rtc::ArrayView<const char> name);
StringRtpHeaderExtension() { value_[0] = 0; }
explicit StringRtpHeaderExtension(rtc::ArrayView<const char> value) {
Set(value.data(), value.size());
}
StringRtpHeaderExtension(const StringRtpHeaderExtension&) = default;
StringRtpHeaderExtension& operator=(const StringRtpHeaderExtension&) =
default;
bool empty() const { return value_[0] == 0; }
const char* data() const { return value_; }
size_t size() const { return strnlen(value_, kMaxSize); }
void Set(rtc::ArrayView<const uint8_t> value) {
Set(reinterpret_cast<const char*>(value.data()), value.size());
}
void Set(const char* data, size_t size);
friend bool operator==(const StringRtpHeaderExtension& lhs,
const StringRtpHeaderExtension& rhs) {
return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0;
}
friend bool operator!=(const StringRtpHeaderExtension& lhs,
const StringRtpHeaderExtension& rhs) {
return !(lhs == rhs);
}
private:
char value_[kMaxSize];
};
// StreamId represents RtpStreamId which is a string.
typedef StringRtpHeaderExtension StreamId;
// Mid represents RtpMid which is a string.
typedef StringRtpHeaderExtension Mid;
struct RTPHeaderExtension {
RTPHeaderExtension();
RTPHeaderExtension(const RTPHeaderExtension& other);
RTPHeaderExtension& operator=(const RTPHeaderExtension& other);
bool hasTransmissionTimeOffset;
int32_t transmissionTimeOffset;
bool hasAbsoluteSendTime;
uint32_t absoluteSendTime;
bool hasTransportSequenceNumber;
uint16_t transportSequenceNumber;
// Audio Level includes both level in dBov and voiced/unvoiced bit. See:
// https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
bool hasAudioLevel;
bool voiceActivity;
uint8_t audioLevel;
// For Coordination of Video Orientation. See
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
// ts_126114v120700p.pdf
bool hasVideoRotation;
VideoRotation videoRotation;
// TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove
// a corresponding bool flag.
bool hasVideoContentType;
VideoContentType videoContentType;
bool has_video_timing;
VideoSendTiming video_timing;
PlayoutDelay playout_delay = {-1, -1};
// For identification of a stream when ssrc is not signaled. See
// https://tools.ietf.org/html/draft-ietf-avtext-rid-09
// TODO(danilchap): Update url from draft to release version.
StreamId stream_id;
StreamId repaired_stream_id;
// For identifying the media section used to interpret this RTP packet. See
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-38
Mid mid;
};
struct RTPHeader {
RTPHeader();
RTPHeader(const RTPHeader& other);
RTPHeader& operator=(const RTPHeader& other);
bool markerBit;
uint8_t payloadType;
uint16_t sequenceNumber;
uint32_t timestamp;
uint32_t ssrc;
uint8_t numCSRCs;
uint32_t arrOfCSRCs[kRtpCsrcSize];
size_t paddingLength;
size_t headerLength;
int payload_type_frequency;
RTPHeaderExtension extension;
};
// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
// RTCP mode is described by RFC 5506.
enum class RtcpMode { kOff, kCompound, kReducedSize };
enum NetworkState {
kNetworkUp,
kNetworkDown,
};
struct RtpKeepAliveConfig final {
// If no packet has been sent for |timeout_interval_ms|, send a keep-alive
// packet. The keep-alive packet is an empty (no payload) RTP packet with a
// payload type of 20 as long as the other end has not negotiated the use of
// this value. If this value has already been negotiated, then some other
// unused static payload type from table 5 of RFC 3551 shall be used and set
// in |payload_type|.
int64_t timeout_interval_ms = -1;
uint8_t payload_type = 20;
bool operator==(const RtpKeepAliveConfig& o) const {
return timeout_interval_ms == o.timeout_interval_ms &&
payload_type == o.payload_type;
}
bool operator!=(const RtpKeepAliveConfig& o) const { return !(*this == o); }
};
// Currently only VP8/VP9 specific.
struct RtpPayloadState {
int16_t picture_id = -1;
};
} // namespace webrtc
#endif // API_RTP_HEADERS_H_

View file

@ -26,6 +26,7 @@ rtc_source_set("video_codecs_api") {
"..:optional", "..:optional",
"..:video_frame_api", "..:video_frame_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_video", "../../common_video",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",

View file

@ -21,6 +21,7 @@ rtc_static_library("audio_frame_operations") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../modules:module_api", "../../modules:module_api",
"../../modules/audio_coding:audio_format_conversion", "../../modules/audio_coding:audio_format_conversion",
"../../rtc_base:checks", "../../rtc_base:checks",

View file

@ -24,6 +24,7 @@ rtc_source_set("call_interfaces") {
":rtp_interfaces", ":rtp_interfaces",
":video_stream_api", ":video_stream_api",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:audio_mixer_api", "../api:audio_mixer_api",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",
"../api:optional", "../api:optional",
@ -70,6 +71,7 @@ rtc_source_set("rtp_receiver") {
":rtp_interfaces", ":rtp_interfaces",
"..:webrtc_common", "..:webrtc_common",
"../api:array_view", "../api:array_view",
"../api:libjingle_peerconnection_api",
"../api:optional", "../api:optional",
"../modules/rtp_rtcp", "../modules/rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format", "../modules/rtp_rtcp:rtp_rtcp_format",
@ -176,6 +178,7 @@ rtc_source_set("video_stream_api") {
"../api:optional", "../api:optional",
"../api:transport_api", "../api:transport_api",
"../common_video:common_video", "../common_video:common_video",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
] ]
} }
@ -204,6 +207,7 @@ if (rtc_include_tests) {
":rtp_sender", ":rtp_sender",
"..:webrtc_common", "..:webrtc_common",
"../api:array_view", "../api:array_view",
"../api:libjingle_peerconnection_api",
"../api:mock_audio_mixer", "../api:mock_audio_mixer",
"../api/audio_codecs:builtin_audio_decoder_factory", "../api/audio_codecs:builtin_audio_decoder_factory",
"../logging:rtc_event_log_api", "../logging:rtc_event_log_api",

View file

@ -16,6 +16,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "api/rtp_headers.h"
#include "api/call/transport.h" #include "api/call/transport.h"
#include "api/rtpparameters.h" #include "api/rtpparameters.h"
#include "call/rtp_packet_sink_interface.h" #include "call/rtp_packet_sink_interface.h"

View file

@ -10,6 +10,7 @@
#include "call/rtcp_demuxer.h" #include "call/rtcp_demuxer.h"
#include "api/rtp_headers.h"
#include "call/rtcp_packet_sink_interface.h" #include "call/rtcp_packet_sink_interface.h"
#include "call/rtp_rtcp_demuxer_helper.h" #include "call/rtp_rtcp_demuxer_helper.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)

View file

@ -13,6 +13,7 @@
#include <memory> #include <memory>
#include <set> #include <set>
#include "api/rtp_headers.h"
#include "call/rtcp_packet_sink_interface.h" #include "call/rtcp_packet_sink_interface.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/rtp_rtcp/source/rtcp_packet/bye.h" #include "modules/rtp_rtcp/source/rtcp_packet/bye.h"

View file

@ -16,12 +16,16 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "api/rtp_headers.h"
#include "api/call/transport.h" #include "api/call/transport.h"
#include "api/rtpparameters.h" #include "api/rtpparameters.h"
#include "api/video/video_content_type.h"
#include "api/video/video_timing.h"
#include "call/rtp_config.h" #include "call/rtp_config.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "common_video/include/frame_callback.h" #include "common_video/include/frame_callback.h"
#include "media/base/videosinkinterface.h" #include "media/base/videosinkinterface.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/platform_file.h" #include "rtc_base/platform_file.h"
namespace webrtc { namespace webrtc {

View file

@ -18,12 +18,14 @@
#include "api/call/transport.h" #include "api/call/transport.h"
#include "api/rtpparameters.h" #include "api/rtpparameters.h"
#include "api/rtp_headers.h"
#include "call/rtp_config.h" #include "call/rtp_config.h"
#include "call/video_config.h" #include "call/video_config.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "common_video/include/frame_callback.h" #include "common_video/include/frame_callback.h"
#include "media/base/videosinkinterface.h" #include "media/base/videosinkinterface.h"
#include "media/base/videosourceinterface.h" #include "media/base/videosourceinterface.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "rtc_base/platform_file.h" #include "rtc_base/platform_file.h"
namespace webrtc { namespace webrtc {

View file

@ -62,6 +62,7 @@ rtc_static_library("common_audio") {
deps = [ deps = [
":sinc_resampler", ":sinc_resampler",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:gtest_prod", "../rtc_base:gtest_prod",
@ -223,6 +224,7 @@ rtc_source_set("common_audio_c") {
":common_audio_c_arm_asm", ":common_audio_c_arm_asm",
":common_audio_cc", ":common_audio_cc",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:compile_assert_c", "../rtc_base:compile_assert_c",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
@ -241,6 +243,7 @@ rtc_source_set("common_audio_cc") {
public_configs = [ ":common_audio_config" ] public_configs = [ ":common_audio_config" ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../system_wrappers", "../system_wrappers",
] ]
@ -252,6 +255,7 @@ rtc_source_set("sinc_resampler") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:gtest_prod", "../rtc_base:gtest_prod",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../system_wrappers", "../system_wrappers",
@ -447,6 +451,7 @@ if (rtc_include_tests) {
":fir_filter_factory", ":fir_filter_factory",
":sinc_resampler", ":sinc_resampler",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils", "../rtc_base:rtc_base_tests_utils",

View file

@ -20,66 +20,6 @@
namespace webrtc { namespace webrtc {
StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
constexpr size_t StreamId::kMaxSize;
bool StreamId::IsLegalName(rtc::ArrayView<const char> name) {
return (name.size() <= kMaxSize && name.size() > 0 &&
std::all_of(name.data(), name.data() + name.size(), isalnum));
}
void StreamId::Set(const char* data, size_t size) {
// If |data| contains \0, the stream id size might become less than |size|.
RTC_CHECK_LE(size, kMaxSize);
memcpy(value_, data, size);
if (size < kMaxSize)
value_[size] = 0;
}
// StreamId is used as member of RTPHeader that is sometimes copied with memcpy
// and thus assume trivial destructibility.
static_assert(std::is_trivially_destructible<StreamId>::value, "");
RTPHeaderExtension::RTPHeaderExtension()
: hasTransmissionTimeOffset(false),
transmissionTimeOffset(0),
hasAbsoluteSendTime(false),
absoluteSendTime(0),
hasTransportSequenceNumber(false),
transportSequenceNumber(0),
hasAudioLevel(false),
voiceActivity(false),
audioLevel(0),
hasVideoRotation(false),
videoRotation(kVideoRotation_0),
hasVideoContentType(false),
videoContentType(VideoContentType::UNSPECIFIED),
has_video_timing(false) {}
RTPHeaderExtension::RTPHeaderExtension(const RTPHeaderExtension& other) =
default;
RTPHeaderExtension& RTPHeaderExtension::operator=(
const RTPHeaderExtension& other) = default;
RTPHeader::RTPHeader()
: markerBit(false),
payloadType(0),
sequenceNumber(0),
timestamp(0),
ssrc(0),
numCSRCs(0),
arrOfCSRCs(),
paddingLength(0),
headerLength(0),
payload_type_frequency(0),
extension() {}
RTPHeader::RTPHeader(const RTPHeader& other) = default;
RTPHeader& RTPHeader::operator=(const RTPHeader& other) = default;
VideoCodec::VideoCodec() VideoCodec::VideoCodec()
: codecType(kVideoCodecUnknown), : codecType(kVideoCodecUnknown),
plName(), plName(),

View file

@ -19,9 +19,6 @@
#include "api/array_view.h" #include "api/array_view.h"
#include "api/optional.h" #include "api/optional.h"
#include "api/video/video_content_type.h"
#include "api/video/video_rotation.h"
#include "api/video/video_timing.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/deprecation.h" #include "rtc_base/deprecation.h"
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)
@ -685,244 +682,6 @@ struct PlayoutDelay {
int max_ms; int max_ms;
}; };
// Class to represent the value of RTP header extensions that are
// variable-length strings (e.g., RtpStreamId and RtpMid).
// Unlike std::string, it can be copied with memcpy and cleared with memset.
//
// Empty value represents unset header extension (use empty() to query).
class StringRtpHeaderExtension {
public:
// String RTP header extensions are limited to 16 bytes because it is the
// maximum length that can be encoded with one-byte header extensions.
static constexpr size_t kMaxSize = 16;
static bool IsLegalName(rtc::ArrayView<const char> name);
StringRtpHeaderExtension() { value_[0] = 0; }
explicit StringRtpHeaderExtension(rtc::ArrayView<const char> value) {
Set(value.data(), value.size());
}
StringRtpHeaderExtension(const StringRtpHeaderExtension&) = default;
StringRtpHeaderExtension& operator=(const StringRtpHeaderExtension&) =
default;
bool empty() const { return value_[0] == 0; }
const char* data() const { return value_; }
size_t size() const { return strnlen(value_, kMaxSize); }
void Set(rtc::ArrayView<const uint8_t> value) {
Set(reinterpret_cast<const char*>(value.data()), value.size());
}
void Set(const char* data, size_t size);
friend bool operator==(const StringRtpHeaderExtension& lhs,
const StringRtpHeaderExtension& rhs) {
return strncmp(lhs.value_, rhs.value_, kMaxSize) == 0;
}
friend bool operator!=(const StringRtpHeaderExtension& lhs,
const StringRtpHeaderExtension& rhs) {
return !(lhs == rhs);
}
private:
char value_[kMaxSize];
};
// StreamId represents RtpStreamId which is a string.
typedef StringRtpHeaderExtension StreamId;
// Mid represents RtpMid which is a string.
typedef StringRtpHeaderExtension Mid;
struct RTPHeaderExtension {
RTPHeaderExtension();
RTPHeaderExtension(const RTPHeaderExtension& other);
RTPHeaderExtension& operator=(const RTPHeaderExtension& other);
bool hasTransmissionTimeOffset;
int32_t transmissionTimeOffset;
bool hasAbsoluteSendTime;
uint32_t absoluteSendTime;
bool hasTransportSequenceNumber;
uint16_t transportSequenceNumber;
// Audio Level includes both level in dBov and voiced/unvoiced bit. See:
// https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
bool hasAudioLevel;
bool voiceActivity;
uint8_t audioLevel;
// For Coordination of Video Orientation. See
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/
// ts_126114v120700p.pdf
bool hasVideoRotation;
VideoRotation videoRotation;
// TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove
// a corresponding bool flag.
bool hasVideoContentType;
VideoContentType videoContentType;
bool has_video_timing;
VideoSendTiming video_timing;
PlayoutDelay playout_delay = {-1, -1};
// For identification of a stream when ssrc is not signaled. See
// https://tools.ietf.org/html/draft-ietf-avtext-rid-09
// TODO(danilchap): Update url from draft to release version.
StreamId stream_id;
StreamId repaired_stream_id;
// For identifying the media section used to interpret this RTP packet. See
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-bundle-negotiation-38
Mid mid;
};
struct RTPHeader {
RTPHeader();
RTPHeader(const RTPHeader& other);
RTPHeader& operator=(const RTPHeader& other);
bool markerBit;
uint8_t payloadType;
uint16_t sequenceNumber;
uint32_t timestamp;
uint32_t ssrc;
uint8_t numCSRCs;
uint32_t arrOfCSRCs[kRtpCsrcSize];
size_t paddingLength;
size_t headerLength;
int payload_type_frequency;
RTPHeaderExtension extension;
};
struct RtpPacketCounter {
RtpPacketCounter()
: header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {}
void Add(const RtpPacketCounter& other) {
header_bytes += other.header_bytes;
payload_bytes += other.payload_bytes;
padding_bytes += other.padding_bytes;
packets += other.packets;
}
void Subtract(const RtpPacketCounter& other) {
RTC_DCHECK_GE(header_bytes, other.header_bytes);
header_bytes -= other.header_bytes;
RTC_DCHECK_GE(payload_bytes, other.payload_bytes);
payload_bytes -= other.payload_bytes;
RTC_DCHECK_GE(padding_bytes, other.padding_bytes);
padding_bytes -= other.padding_bytes;
RTC_DCHECK_GE(packets, other.packets);
packets -= other.packets;
}
void AddPacket(size_t packet_length, const RTPHeader& header) {
++packets;
header_bytes += header.headerLength;
padding_bytes += header.paddingLength;
payload_bytes +=
packet_length - (header.headerLength + header.paddingLength);
}
size_t TotalBytes() const {
return header_bytes + payload_bytes + padding_bytes;
}
size_t header_bytes; // Number of bytes used by RTP headers.
size_t payload_bytes; // Payload bytes, excluding RTP headers and padding.
size_t padding_bytes; // Number of padding bytes.
uint32_t packets; // Number of packets.
};
// Data usage statistics for a (rtp) stream.
struct StreamDataCounters {
StreamDataCounters();
void Add(const StreamDataCounters& other) {
transmitted.Add(other.transmitted);
retransmitted.Add(other.retransmitted);
fec.Add(other.fec);
if (other.first_packet_time_ms != -1 &&
(other.first_packet_time_ms < first_packet_time_ms ||
first_packet_time_ms == -1)) {
// Use oldest time.
first_packet_time_ms = other.first_packet_time_ms;
}
}
void Subtract(const StreamDataCounters& other) {
transmitted.Subtract(other.transmitted);
retransmitted.Subtract(other.retransmitted);
fec.Subtract(other.fec);
if (other.first_packet_time_ms != -1 &&
(other.first_packet_time_ms > first_packet_time_ms ||
first_packet_time_ms == -1)) {
// Use youngest time.
first_packet_time_ms = other.first_packet_time_ms;
}
}
int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
}
// Returns the number of bytes corresponding to the actual media payload (i.e.
// RTP headers, padding, retransmissions and fec packets are excluded).
// Note this function does not have meaning for an RTX stream.
size_t MediaPayloadBytes() const {
return transmitted.payload_bytes - retransmitted.payload_bytes -
fec.payload_bytes;
}
int64_t first_packet_time_ms; // Time when first packet is sent/received.
RtpPacketCounter transmitted; // Number of transmitted packets/bytes.
RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes.
RtpPacketCounter fec; // Number of redundancy packets/bytes.
};
// Callback, called whenever byte/packet counts have been updated.
class StreamDataCountersCallback {
public:
virtual ~StreamDataCountersCallback() {}
virtual void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) = 0;
};
// RTCP mode to use. Compound mode is described by RFC 4585 and reduced-size
// RTCP mode is described by RFC 5506.
enum class RtcpMode { kOff, kCompound, kReducedSize };
enum NetworkState {
kNetworkUp,
kNetworkDown,
};
struct RtpKeepAliveConfig final {
// If no packet has been sent for |timeout_interval_ms|, send a keep-alive
// packet. The keep-alive packet is an empty (no payload) RTP packet with a
// payload type of 20 as long as the other end has not negotiated the use of
// this value. If this value has already been negotiated, then some other
// unused static payload type from table 5 of RFC 3551 shall be used and set
// in |payload_type|.
int64_t timeout_interval_ms = -1;
uint8_t payload_type = 20;
bool operator==(const RtpKeepAliveConfig& o) const {
return timeout_interval_ms == o.timeout_interval_ms &&
payload_type == o.payload_type;
}
bool operator!=(const RtpKeepAliveConfig& o) const { return !(*this == o); }
};
// Currently only VP8/VP9 specific.
struct RtpPayloadState {
int16_t picture_id = -1;
};
} // namespace webrtc } // namespace webrtc
#endif // COMMON_TYPES_H_ #endif // COMMON_TYPES_H_

View file

@ -16,6 +16,7 @@
// to refactor and clean up related interfaces, at which point it // to refactor and clean up related interfaces, at which point it
// should be moved to somewhere under api/. // should be moved to somewhere under api/.
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)

View file

@ -509,6 +509,7 @@ if (is_linux || is_win) {
deps = [ deps = [
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:stringutils",
] ]
if (is_win) { if (is_win) {
sources += [ sources += [
@ -569,6 +570,7 @@ if (is_linux || is_win) {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
"../rtc_tools:command_line_parser", "../rtc_tools:command_line_parser",
] ]
if (!build_with_chromium && is_clang) { if (!build_with_chromium && is_clang) {
@ -727,6 +729,7 @@ if (!build_with_chromium) {
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
"../system_wrappers:field_trial_default", "../system_wrappers:field_trial_default",
] ]
} }

View file

@ -71,6 +71,7 @@ rtc_source_set("rtc_event_log_api") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:array_view", "../api:array_view",
"../api:libjingle_logging_api", "../api:libjingle_logging_api",
"../api:libjingle_peerconnection_api", "../api:libjingle_peerconnection_api",

View file

@ -14,6 +14,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "api/rtp_headers.h"
#include "api/rtpparameters.h" #include "api/rtpparameters.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)

View file

@ -57,6 +57,7 @@ rtc_static_library("rtc_media_base") {
deps = [ deps = [
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:sanitizer", "../rtc_base:sanitizer",
"../rtc_base:stringutils",
] ]
public_deps = [] public_deps = []
sources = [ sources = [
@ -133,6 +134,7 @@ rtc_static_library("rtc_audio_video") {
"../call:call_interfaces", "../call:call_interfaces",
"../modules/video_coding:video_coding_utility", "../modules/video_coding:video_coding_utility",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:stringutils",
"../system_wrappers:field_trial_api", "../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api", "../system_wrappers:metrics_api",
"//third_party/libyuv", "//third_party/libyuv",
@ -347,6 +349,7 @@ if (rtc_include_tests) {
"../modules/video_coding:video_coding_utility", "../modules/video_coding:video_coding_utility",
"../p2p:rtc_p2p", "../p2p:rtc_p2p",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:stringutils",
] ]
sources = [ sources = [
"base/fakemediaengine.h", "base/fakemediaengine.h",
@ -438,6 +441,7 @@ if (rtc_include_tests) {
"../pc:rtc_pc", "../pc:rtc_pc",
"../pc:rtc_pc_base", "../pc:rtc_pc_base",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:stringutils",
"../test:field_trial", "../test:field_trial",
] ]
sources = [ sources = [

View file

@ -21,6 +21,7 @@
#include "api/optional.h" #include "api/optional.h"
#include "api/rtpparameters.h" #include "api/rtpparameters.h"
#include "api/rtpreceiverinterface.h" #include "api/rtpreceiverinterface.h"
#include "api/video/video_content_type.h"
#include "api/video/video_timing.h" #include "api/video/video_timing.h"
#include "call/video_config.h" #include "call/video_config.h"
#include "media/base/codec.h" #include "media/base/codec.h"

View file

@ -34,6 +34,7 @@ rtc_source_set("module_api_public") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
] ]
} }
@ -46,9 +47,12 @@ rtc_source_set("module_api") {
deps = [ deps = [
":module_api_public", ":module_api_public",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:libjingle_peerconnection_api",
"../api:optional", "../api:optional",
"../api:video_frame_api", "../api:video_frame_api",
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
"../rtc_base:deprecation",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"video_coding:codec_globals_headers", "video_coding:codec_globals_headers",
] ]

View file

@ -65,6 +65,7 @@ rtc_static_library("rent_a_codec") {
"acm2/rent_a_codec.h", "acm2/rent_a_codec.h",
] ]
deps = [ deps = [
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../api:array_view", "../../api:array_view",
"../../api:optional", "../../api:optional",
@ -96,6 +97,7 @@ rtc_source_set("audio_coding_module_typedefs") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
] ]
} }
@ -132,6 +134,8 @@ rtc_static_library("audio_coding") {
} }
deps = audio_coding_deps + [ deps = audio_coding_deps + [
"../../rtc_base:deprecation",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"..:module_api", "..:module_api",
@ -177,6 +181,7 @@ rtc_static_library("cng") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
@ -241,6 +246,7 @@ rtc_source_set("g711_c") {
] ]
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
] ]
} }
@ -282,6 +288,7 @@ rtc_source_set("g722_c") {
] ]
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
] ]
} }
@ -461,6 +468,7 @@ rtc_source_set("ilbc_c") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -569,6 +577,7 @@ rtc_static_library("isac_c") {
deps = [ deps = [
":isac_common", ":isac_common",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:compile_assert_c", "../../rtc_base:compile_assert_c",
@ -675,6 +684,7 @@ rtc_source_set("isac_fix_c") {
deps = [ deps = [
":isac_common", ":isac_common",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -799,6 +809,7 @@ rtc_source_set("pcm16b_c") {
public_configs = [ ":pcm16b_config" ] public_configs = [ ":pcm16b_config" ]
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
] ]
} }
@ -856,6 +867,7 @@ rtc_source_set("webrtc_opus_c") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]
@ -1042,6 +1054,8 @@ rtc_static_library("neteq") {
":neteq_decoder_enum", ":neteq_decoder_enum",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:libjingle_peerconnection_api",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_audio", "../../common_audio",
@ -1084,6 +1098,8 @@ rtc_source_set("neteq_tools_minimal") {
":neteq", ":neteq",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:libjingle_peerconnection_api",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
@ -1121,7 +1137,9 @@ rtc_source_set("neteq_test_tools") {
":pcm16b", ":pcm16b",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1169,6 +1187,7 @@ rtc_source_set("neteq_tools") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
@ -1195,6 +1214,7 @@ rtc_source_set("neteq_input_audio_tools") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1308,6 +1328,7 @@ if (rtc_include_tests) {
":pcm16b_c", ":pcm16b_c",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1339,6 +1360,7 @@ if (rtc_include_tests) {
":neteq_test_support", ":neteq_test_support",
":neteq_test_tools", ":neteq_test_tools",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs/opus:audio_encoder_opus", "../../api/audio_codecs/opus:audio_encoder_opus",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1411,6 +1433,7 @@ if (rtc_include_tests) {
":audio_coding_module_typedefs", ":audio_coding_module_typedefs",
":audio_format_conversion", ":audio_format_conversion",
"..:module_api", "..:module_api",
"../../:typedefs",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional", "../../api:optional",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1441,6 +1464,7 @@ if (rtc_include_tests) {
":audio_coding", ":audio_coding",
":audio_format_conversion", ":audio_format_conversion",
"..:module_api", "..:module_api",
"../../:typedefs",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional", "../../api:optional",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1519,6 +1543,7 @@ if (rtc_include_tests) {
defines = [] defines = []
deps = [ deps = [
"..:module_api", "..:module_api",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
] ]
sources = [ sources = [
@ -1567,7 +1592,9 @@ if (rtc_include_tests) {
rtc_test("audio_codec_speed_tests") { rtc_test("audio_codec_speed_tests") {
testonly = true testonly = true
defines = [] defines = []
deps = [] deps = [
"../../:typedefs",
]
sources = [ sources = [
"codecs/isac/fix/test/isac_speed_test.cc", "codecs/isac/fix/test/isac_speed_test.cc",
"codecs/opus/opus_speed_test.cc", "codecs/opus/opus_speed_test.cc",
@ -1626,6 +1653,7 @@ if (rtc_include_tests) {
":pcm16b", ":pcm16b",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -1653,6 +1681,7 @@ if (rtc_include_tests) {
":neteq_test_tools", ":neteq_test_tools",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -1665,6 +1694,7 @@ if (rtc_include_tests) {
testonly = true testonly = true
deps = audio_coding_deps + [ deps = audio_coding_deps + [
"../../:typedefs",
":audio_coding", ":audio_coding",
":neteq_input_audio_tools", ":neteq_input_audio_tools",
"../../api/audio_codecs/g711:audio_encoder_g711", "../../api/audio_codecs/g711:audio_encoder_g711",
@ -1688,6 +1718,7 @@ if (rtc_include_tests) {
testonly = true testonly = true
deps = audio_coding_deps + [ deps = audio_coding_deps + [
"../../:typedefs",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"../../api:array_view", "../../api:array_view",
@ -1768,6 +1799,7 @@ if (rtc_include_tests) {
":neteq", ":neteq",
":neteq_test_support", ":neteq_test_support",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",
"../../test:test_support", "../../test:test_support",
@ -1915,6 +1947,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":g722", ":g722",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
] ]
} }
@ -2098,6 +2131,7 @@ if (rtc_include_tests) {
":webrtc_opus", ":webrtc_opus",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
"../../api/audio_codecs:builtin_audio_encoder_factory", "../../api/audio_codecs:builtin_audio_encoder_factory",

View file

@ -18,6 +18,7 @@
#include "api/audio_codecs/audio_decoder.h" #include "api/audio_codecs/audio_decoder.h"
#include "api/optional.h" #include "api/optional.h"
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/audio_coding/neteq/neteq_decoder_enum.h" #include "modules/audio_coding/neteq/neteq_decoder_enum.h"
#include "rtc_base/constructormagic.h" #include "rtc_base/constructormagic.h"

View file

@ -14,6 +14,7 @@
#include <list> #include <list>
#include <memory> #include <memory>
#include "api/rtp_headers.h" // NOLINT(build/include)
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "rtc_base/constructormagic.h" #include "rtc_base/constructormagic.h"
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)

View file

@ -11,6 +11,7 @@
#ifndef MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_GENERATOR_H_ #ifndef MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_GENERATOR_H_
#define MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_GENERATOR_H_ #define MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_GENERATOR_H_
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "rtc_base/constructormagic.h" #include "rtc_base/constructormagic.h"
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)

View file

@ -100,6 +100,7 @@ rtc_source_set("audio_device_generic") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",

View file

@ -36,6 +36,7 @@ rtc_static_library("audio_mixer_impl") {
":audio_frame_manipulator", ":audio_frame_manipulator",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:audio_mixer_api", "../../api:audio_mixer_api",
"../../audio/utility:audio_frame_operations", "../../audio/utility:audio_frame_operations",

View file

@ -226,10 +226,12 @@ rtc_static_library("audio_processing") {
":audio_processing_statistics", ":audio_processing_statistics",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:optional", "../../api:optional",
"../../audio/utility:audio_frame_operations", "../../audio/utility:audio_frame_operations",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
"../../rtc_base:sanitizer", "../../rtc_base:sanitizer",
@ -341,6 +343,7 @@ rtc_source_set("audio_processing_c") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -371,6 +374,7 @@ rtc_source_set("apm_logging") {
"../../api:array_view", "../../api:array_view",
"../../common_audio:common_audio", "../../common_audio:common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
] ]
defines = [] defines = []
if (apm_debug_dump) { if (apm_debug_dump) {
@ -404,6 +408,7 @@ rtc_source_set("aec_core") {
":apm_logging", ":apm_logging",
":audio_processing_statistics", ":audio_processing_statistics",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio:common_audio", "../../common_audio:common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
@ -582,6 +587,7 @@ if (rtc_include_tests) {
":audioproc_test_utils", ":audioproc_test_utils",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:optional", "../../api:optional",
"../../common_audio:common_audio", "../../common_audio:common_audio",
@ -768,6 +774,7 @@ if (rtc_include_tests) {
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue", "../../rtc_base:rtc_task_queue",
"../../rtc_base:stringutils",
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:system_wrappers_default", "../../system_wrappers:system_wrappers_default",
"../../test:test_support", "../../test:test_support",
@ -819,6 +826,7 @@ if (rtc_include_tests) {
":audio_processing", ":audio_processing",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio:common_audio", "../../common_audio:common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers", "../../system_wrappers",
@ -838,6 +846,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":audio_processing", ":audio_processing",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:metrics_default", "../../system_wrappers:metrics_default",
] ]
@ -892,6 +901,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":audioproc_debug_proto", ":audioproc_debug_proto",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:protobuf_utils", "../../rtc_base:protobuf_utils",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]

View file

@ -45,6 +45,7 @@ rtc_static_library("lib") {
] ]
deps = [ deps = [
"../../../..:webrtc_common", "../../../..:webrtc_common",
"../../../../:typedefs",
"../../../../api:array_view", "../../../../api:array_view",
"../../../../common_audio", "../../../../common_audio",
"../../../../rtc_base:checks", "../../../../rtc_base:checks",
@ -65,6 +66,7 @@ rtc_source_set("unittest") {
deps = [ deps = [
":lib", ":lib",
"../../../..:webrtc_common", "../../../..:webrtc_common",
"../../../../:typedefs",
"../../../../api:array_view", "../../../../api:array_view",
"../../../../api:optional", "../../../../api:optional",
"../../../../common_audio", "../../../../common_audio",

View file

@ -49,6 +49,7 @@ rtc_static_library("congestion_controller") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",
"../../rtc_base:checks", "../../rtc_base:checks",

View file

@ -28,6 +28,7 @@ rtc_static_library("primitives") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806. "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
] ]
@ -89,6 +90,7 @@ if (rtc_include_tests) {
":desktop_capture_mock", ":desktop_capture_mock",
":primitives", ":primitives",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers:cpu_features_api", "../../system_wrappers:cpu_features_api",
@ -333,6 +335,7 @@ rtc_static_library("desktop_capture_generic") {
deps = [ deps = [
":primitives", ":primitives",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:refcountedbase", "../../api:refcountedbase",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806. "../../rtc_base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.

View file

@ -18,6 +18,7 @@
#include <limits> #include <limits>
#include "api/optional.h" #include "api/optional.h"
#include "api/rtp_headers.h"
#include "api/video/video_rotation.h" #include "api/video/video_rotation.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/include/module_common_types_public.h" #include "modules/include/module_common_types_public.h"

View file

@ -35,6 +35,7 @@ rtc_static_library("media_file") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../common_audio", "../../common_audio",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
] ]

View file

@ -34,6 +34,7 @@ rtc_static_library("pacing") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../../:typedefs",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional", "../../api:optional",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",

View file

@ -46,6 +46,7 @@ rtc_static_library("remote_bitrate_estimator") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../modules:module_api", "../../modules:module_api",
"../../modules/rtp_rtcp:rtp_rtcp_format", "../../modules/rtp_rtcp:rtp_rtcp_format",
@ -140,6 +141,7 @@ if (rtc_include_tests) {
":remote_bitrate_estimator", ":remote_bitrate_estimator",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",

View file

@ -82,12 +82,14 @@ rtc_source_set("rtp_rtcp_format") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../common_video", "../../common_video",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers", "../../system_wrappers",
] ]
@ -192,6 +194,7 @@ rtc_static_library("rtp_rtcp") {
":rtp_rtcp_format", ":rtp_rtcp_format",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional", "../../api:optional",
@ -200,11 +203,13 @@ rtc_static_library("rtp_rtcp") {
"../../common_video", "../../common_video",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:deprecation",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
"../../rtc_base:rate_limiter", "../../rtc_base:rate_limiter",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_numerics", "../../rtc_base:rtc_numerics",
"../../rtc_base:sequenced_task_checker", "../../rtc_base:sequenced_task_checker",
"../../rtc_base:stringutils",
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
@ -398,6 +403,7 @@ if (rtc_include_tests) {
":rtp_rtcp_format", ":rtp_rtcp_format",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional", "../../api:optional",

View file

@ -17,6 +17,7 @@
#include "modules/include/module.h" #include "modules/include/module.h"
#include "modules/include/module_common_types.h" #include "modules/include/module_common_types.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)
namespace webrtc { namespace webrtc {

View file

@ -12,6 +12,27 @@
namespace webrtc { namespace webrtc {
StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {}
constexpr size_t StreamId::kMaxSize;
bool StreamId::IsLegalName(rtc::ArrayView<const char> name) {
return (name.size() <= kMaxSize && name.size() > 0 &&
std::all_of(name.data(), name.data() + name.size(), isalnum));
}
void StreamId::Set(const char* data, size_t size) {
// If |data| contains \0, the stream id size might become less than |size|.
RTC_CHECK_LE(size, kMaxSize);
memcpy(value_, data, size);
if (size < kMaxSize)
value_[size] = 0;
}
// StreamId is used as member of RTPHeader that is sometimes copied with memcpy
// and thus assume trivial destructibility.
static_assert(std::is_trivially_destructible<StreamId>::value, "");
PayloadUnion::PayloadUnion(const AudioPayload& payload) PayloadUnion::PayloadUnion(const AudioPayload& payload)
: audio_payload_(payload) {} : audio_payload_(payload) {}
PayloadUnion::PayloadUnion(const VideoPayload& payload) PayloadUnion::PayloadUnion(const VideoPayload& payload)

View file

@ -16,6 +16,7 @@
#include <vector> #include <vector>
#include "api/audio_codecs/audio_format.h" #include "api/audio_codecs/audio_format.h"
#include "api/rtp_headers.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/include/module_common_types.h" #include "modules/include/module_common_types.h"
#include "rtc_base/deprecation.h" #include "rtc_base/deprecation.h"
@ -496,5 +497,100 @@ class TransportSequenceNumberAllocator {
virtual uint16_t AllocateSequenceNumber() = 0; virtual uint16_t AllocateSequenceNumber() = 0;
}; };
struct RtpPacketCounter {
RtpPacketCounter()
: header_bytes(0), payload_bytes(0), padding_bytes(0), packets(0) {}
void Add(const RtpPacketCounter& other) {
header_bytes += other.header_bytes;
payload_bytes += other.payload_bytes;
padding_bytes += other.padding_bytes;
packets += other.packets;
}
void Subtract(const RtpPacketCounter& other) {
RTC_DCHECK_GE(header_bytes, other.header_bytes);
header_bytes -= other.header_bytes;
RTC_DCHECK_GE(payload_bytes, other.payload_bytes);
payload_bytes -= other.payload_bytes;
RTC_DCHECK_GE(padding_bytes, other.padding_bytes);
padding_bytes -= other.padding_bytes;
RTC_DCHECK_GE(packets, other.packets);
packets -= other.packets;
}
void AddPacket(size_t packet_length, const RTPHeader& header) {
++packets;
header_bytes += header.headerLength;
padding_bytes += header.paddingLength;
payload_bytes +=
packet_length - (header.headerLength + header.paddingLength);
}
size_t TotalBytes() const {
return header_bytes + payload_bytes + padding_bytes;
}
size_t header_bytes; // Number of bytes used by RTP headers.
size_t payload_bytes; // Payload bytes, excluding RTP headers and padding.
size_t padding_bytes; // Number of padding bytes.
uint32_t packets; // Number of packets.
};
// Data usage statistics for a (rtp) stream.
struct StreamDataCounters {
StreamDataCounters();
void Add(const StreamDataCounters& other) {
transmitted.Add(other.transmitted);
retransmitted.Add(other.retransmitted);
fec.Add(other.fec);
if (other.first_packet_time_ms != -1 &&
(other.first_packet_time_ms < first_packet_time_ms ||
first_packet_time_ms == -1)) {
// Use oldest time.
first_packet_time_ms = other.first_packet_time_ms;
}
}
void Subtract(const StreamDataCounters& other) {
transmitted.Subtract(other.transmitted);
retransmitted.Subtract(other.retransmitted);
fec.Subtract(other.fec);
if (other.first_packet_time_ms != -1 &&
(other.first_packet_time_ms > first_packet_time_ms ||
first_packet_time_ms == -1)) {
// Use youngest time.
first_packet_time_ms = other.first_packet_time_ms;
}
}
int64_t TimeSinceFirstPacketInMs(int64_t now_ms) const {
return (first_packet_time_ms == -1) ? -1 : (now_ms - first_packet_time_ms);
}
// Returns the number of bytes corresponding to the actual media payload (i.e.
// RTP headers, padding, retransmissions and fec packets are excluded).
// Note this function does not have meaning for an RTX stream.
size_t MediaPayloadBytes() const {
return transmitted.payload_bytes - retransmitted.payload_bytes -
fec.payload_bytes;
}
int64_t first_packet_time_ms; // Time when first packet is sent/received.
RtpPacketCounter transmitted; // Number of transmitted packets/bytes.
RtpPacketCounter retransmitted; // Number of retransmitted packets/bytes.
RtpPacketCounter fec; // Number of redundancy packets/bytes.
};
// Callback, called whenever byte/packet counts have been updated.
class StreamDataCountersCallback {
public:
virtual ~StreamDataCountersCallback() {}
virtual void DataCountersUpdated(const StreamDataCounters& counters,
uint32_t ssrc) = 0;
};
} // namespace webrtc } // namespace webrtc
#endif // MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_ #endif // MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_

View file

@ -32,6 +32,7 @@ rtc_static_library("utility") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../audio/utility:audio_frame_operations", "../../audio/utility:audio_frame_operations",
"../../common_audio", "../../common_audio",
"../../rtc_base:checks", "../../rtc_base:checks",

View file

@ -28,10 +28,12 @@ rtc_static_library("video_capture_module") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:video_frame_api_i420", "../../api:video_frame_api_i420",
"../../common_video", "../../common_video",
"../../media:rtc_media_base", "../../media:rtc_media_base",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:stringutils",
"../../system_wrappers", "../../system_wrappers",
"//third_party/libyuv", "//third_party/libyuv",
] ]

View file

@ -99,6 +99,7 @@ rtc_static_library("video_coding") {
"..:module_api", "..:module_api",
"..:module_api_public", "..:module_api_public",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../api:video_frame_api_i420", "../../api:video_frame_api_i420",
"../../call:video_stream_api", "../../call:video_stream_api",
@ -127,6 +128,7 @@ rtc_source_set("mock_headers") {
deps = [ deps = [
":video_coding_utility", ":video_coding_utility",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../test:test_support", "../../test:test_support",
] ]
} }
@ -169,6 +171,7 @@ rtc_source_set("video_coding_utility") {
deps = [ deps = [
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video", "../../common_video",
@ -239,6 +242,7 @@ rtc_static_library("webrtc_i420") {
deps = [ deps = [
":video_coding_utility", ":video_coding_utility",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:video_frame_api_i420", "../../api:video_frame_api_i420",
"../../common_video:common_video", "../../common_video:common_video",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -301,6 +305,7 @@ rtc_static_library("webrtc_vp8") {
":video_coding_utility", ":video_coding_utility",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video", "../../common_video",
@ -431,6 +436,7 @@ if (rtc_include_tests) {
":video_coding_utility", ":video_coding_utility",
":webrtc_vp8", ":webrtc_vp8",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:video_frame_api_i420", "../../api:video_frame_api_i420",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video:common_video", "../../common_video:common_video",
@ -599,6 +605,7 @@ if (rtc_include_tests) {
":webrtc_vp9", ":webrtc_vp9",
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:video_frame_api", "../../api:video_frame_api",
"../../api:video_frame_api_i420", "../../api:video_frame_api_i420",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",

View file

@ -96,6 +96,7 @@ rtc_static_library("rtc_p2p") {
"../api:ortc_api", "../api:ortc_api",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:stringutils",
"../system_wrappers:field_trial_api", "../system_wrappers:field_trial_api",
] ]
@ -183,6 +184,7 @@ if (rtc_include_tests) {
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:rtc_base_tests_utils", "../rtc_base:rtc_base_tests_utils",
"../rtc_base:stringutils",
"../test:test_support", "../test:test_support",
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
@ -204,6 +206,7 @@ rtc_static_library("libstunprober") {
deps = [ deps = [
":rtc_p2p", ":rtc_p2p",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
] ]

View file

@ -78,6 +78,7 @@ rtc_static_library("rtc_pc_base") {
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_task_queue", "../rtc_base:rtc_task_queue",
"../rtc_base:stringutils",
] ]
if (rtc_build_libsrtp) { if (rtc_build_libsrtp) {
@ -186,6 +187,7 @@ rtc_static_library("peerconnection") {
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base", "../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../rtc_base:stringutils",
"../stats", "../stats",
"../system_wrappers", "../system_wrappers",
"../system_wrappers:field_trial_api", "../system_wrappers:field_trial_api",
@ -441,6 +443,7 @@ if (rtc_include_tests) {
":peerconnection", ":peerconnection",
":rtc_pc_base", ":rtc_pc_base",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:stringutils",
] ]
if (is_android) { if (is_android) {
deps += [ ":android_black_magic" ] deps += [ ":android_black_magic" ]

View file

@ -96,13 +96,18 @@ rtc_source_set("checks") {
] ]
deps = [ deps = [
":safe_compare", ":safe_compare",
"..:webrtc_common", "..:typedefs",
] ]
} }
rtc_source_set("type_traits") { rtc_source_set("rate_limiter") {
sources = [ sources = [
"type_traits.h", "rate_limiter.cc",
"rate_limiter.h",
]
deps = [
":rtc_base_approved",
"../system_wrappers",
] ]
} }
@ -121,14 +126,25 @@ rtc_source_set("safe_compare") {
] ]
} }
rtc_source_set("rate_limiter") { rtc_source_set("stringutils") {
sources = [ sources = [
"rate_limiter.cc", "stringutils.cc",
"rate_limiter.h", "stringutils.h",
] ]
deps = [ deps = [
":rtc_base_approved", ":checks",
"../system_wrappers", ]
}
rtc_source_set("type_traits") {
sources = [
"type_traits.h",
]
}
rtc_source_set("deprecation") {
sources = [
"deprecation.h",
] ]
} }
@ -146,7 +162,9 @@ rtc_source_set("rtc_base_approved_generic") {
deps = [ deps = [
":checks", ":checks",
":safe_compare", ":safe_compare",
":stringutils",
":type_traits", ":type_traits",
"../:typedefs",
] ]
sources = [ sources = [
@ -171,7 +189,6 @@ rtc_source_set("rtc_base_approved_generic") {
"copyonwritebuffer.h", "copyonwritebuffer.h",
"criticalsection.cc", "criticalsection.cc",
"criticalsection.h", "criticalsection.h",
"deprecation.h",
"event_tracer.cc", "event_tracer.cc",
"event_tracer.h", "event_tracer.h",
"file.cc", "file.cc",
@ -216,8 +233,6 @@ rtc_source_set("rtc_base_approved_generic") {
"stringencode.cc", "stringencode.cc",
"stringencode.h", "stringencode.h",
"stringize_macros.h", "stringize_macros.h",
"stringutils.cc",
"stringutils.h",
"swap_queue.h", "swap_queue.h",
"template_util.h", "template_util.h",
"thread_annotations.h", "thread_annotations.h",
@ -526,6 +541,7 @@ rtc_static_library("rtc_base_generic") {
defines = [] defines = []
deps = [ deps = [
":checks", ":checks",
":stringutils",
"..:webrtc_common", "..:webrtc_common",
"../api:optional", "../api:optional",
] ]
@ -845,6 +861,7 @@ rtc_source_set("rtc_base_tests_utils") {
deps = [ deps = [
":checks", ":checks",
":rtc_base", ":rtc_base",
":stringutils",
"../test:field_trial", "../test:field_trial",
"../test:test_support", "../test:test_support",
] ]
@ -956,6 +973,7 @@ if (rtc_include_tests) {
":rtc_base_tests_utils", ":rtc_base_tests_utils",
":rtc_task_queue", ":rtc_task_queue",
":safe_compare", ":safe_compare",
":stringutils",
"../api:array_view", "../api:array_view",
"../system_wrappers:system_wrappers", "../system_wrappers:system_wrappers",
"../test:test_support", "../test:test_support",
@ -1080,6 +1098,7 @@ if (rtc_include_tests) {
":checks", ":checks",
":rtc_base_tests_main", ":rtc_base_tests_main",
":rtc_base_tests_utils", ":rtc_base_tests_utils",
":stringutils",
"../api:optional", "../api:optional",
"../test:test_support", "../test:test_support",
] ]

View file

@ -157,6 +157,7 @@ if (!build_with_chromium) {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../common_video", "../common_video",
] ]
} }
@ -379,6 +380,7 @@ if (rtc_include_tests) {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../common_audio", "../common_audio",
"../modules/audio_processing", "../modules/audio_processing",
"../modules/audio_processing:audioproc_debug_proto", "../modules/audio_processing:audioproc_debug_proto",

View file

@ -401,6 +401,7 @@ rtc_static_library("peerconnection_jni") {
"../../rtc_base:rtc_base", "../../rtc_base:rtc_base",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../rtc_base:rtc_task_queue", "../../rtc_base:rtc_task_queue",
"../../rtc_base:stringutils",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
] ]
} }

View file

@ -54,6 +54,7 @@ rtc_static_library("system_wrappers") {
":field_trial_api", ":field_trial_api",
":metrics_api", ":metrics_api",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
"../modules:module_api_public", "../modules:module_api_public",
"../rtc_base:checks", "../rtc_base:checks",
@ -112,6 +113,7 @@ rtc_source_set("cpu_features_api") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
] ]
} }
@ -215,6 +217,7 @@ if (rtc_include_tests) {
":metrics_default", ":metrics_default",
":system_wrappers", ":system_wrappers",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
"../test:test_main", "../test:test_main",
"//testing/gtest", "//testing/gtest",

View file

@ -12,6 +12,8 @@
#include <stdint.h> #include <stdint.h>
#include "rtc_base/numerics/safe_conversions.h"
namespace webrtc { namespace webrtc {
class NtpTime { class NtpTime {
@ -40,8 +42,12 @@ class NtpTime {
// NTP standard (RFC1305, section 3.1) explicitly state value 0 is invalid. // NTP standard (RFC1305, section 3.1) explicitly state value 0 is invalid.
bool Valid() const { return value_ != 0; } bool Valid() const { return value_ != 0; }
uint32_t seconds() const { return value_ / kFractionsPerSecond; } uint32_t seconds() const {
uint32_t fractions() const { return value_ % kFractionsPerSecond; } return rtc::dchecked_cast<uint32_t>(value_ / kFractionsPerSecond);
}
uint32_t fractions() const {
return rtc::dchecked_cast<uint32_t>(value_ % kFractionsPerSecond);
}
private: private:
uint64_t value_; uint64_t value_;

View file

@ -60,6 +60,7 @@ rtc_source_set("video_test_common") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
"../api/video_codecs:video_codecs_api", "../api/video_codecs:video_codecs_api",
@ -151,6 +152,7 @@ rtc_source_set("test_support") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:array_view", "../api:array_view",
"../common_video", "../common_video",
"../rtc_base:gtest_prod", "../rtc_base:gtest_prod",
@ -215,6 +217,7 @@ if (rtc_include_tests) {
":test_support", ":test_support",
":video_test_common", ":video_test_common",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:video_frame_api", "../api:video_frame_api",
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
"../common_video", "../common_video",
@ -362,6 +365,7 @@ if (is_ios) {
"testsupport/iosfileutils.mm", "testsupport/iosfileutils.mm",
] ]
deps = [ deps = [
"..:typedefs",
"..:webrtc_common", "..:webrtc_common",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
@ -384,6 +388,7 @@ rtc_source_set("fileutils") {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
"../rtc_base:checks", "../rtc_base:checks",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",
@ -470,6 +475,7 @@ rtc_source_set("direct_transport") {
} }
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:transport_api", "../api:transport_api",
"../call", "../call",
"../call:call_interfaces", "../call:call_interfaces",
@ -507,6 +513,7 @@ rtc_source_set("fake_audio_device") {
} }
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:array_view", "../api:array_view",
"../common_audio:common_audio", "../common_audio:common_audio",
"../modules/audio_device:audio_device", "../modules/audio_device:audio_device",
@ -565,6 +572,7 @@ rtc_source_set("test_common") {
":test_support", ":test_support",
":video_test_common", ":video_test_common",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:transport_api", "../api:transport_api",
"../api:video_frame_api", "../api:video_frame_api",
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
@ -668,6 +676,7 @@ rtc_source_set("test_renderer_generic") {
deps = [ deps = [
":test_support", ":test_support",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../common_video", "../common_video",
"../media:rtc_media_base", "../media:rtc_media_base",
"../modules/media_file", "../modules/media_file",

View file

@ -245,6 +245,7 @@ rtc_static_library("audio_decoder_fuzzer") {
] ]
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs",
"../../api:optional", "../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../modules/rtp_rtcp:rtp_rtcp_format", "../../modules/rtp_rtcp:rtp_rtcp_format",

View file

@ -55,6 +55,7 @@ rtc_static_library("video") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:optional", "../api:optional",
"../api:transport_api", "../api:transport_api",
"../api:video_frame_api_i420", "../api:video_frame_api_i420",
@ -216,6 +217,7 @@ if (rtc_include_tests) {
] ]
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api/video_codecs:video_codecs_api", "../api/video_codecs:video_codecs_api",
"../call:call_interfaces", "../call:call_interfaces",
"../common_video", "../common_video",

View file

@ -52,6 +52,7 @@ rtc_static_library("voice_engine") {
deps = [ deps = [
":audio_level", ":audio_level",
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../api:array_view", "../api:array_view",
"../api:audio_mixer_api", "../api:audio_mixer_api",
"../api:call_api", "../api:call_api",
@ -94,6 +95,7 @@ rtc_static_library("audio_level") {
deps = [ deps = [
"..:webrtc_common", "..:webrtc_common",
"../:typedefs",
"../common_audio", "../common_audio",
"../modules:module_api", "../modules:module_api",
"../rtc_base:rtc_base_approved", "../rtc_base:rtc_base_approved",