From 09f4481173c9bf7a96e8e7a190cf685d7fea0178 Mon Sep 17 00:00:00 2001 From: danilchap Date: Tue, 12 Sep 2017 09:23:24 -0700 Subject: [PATCH] Break rtp_rtcp_format out of rtp_rtcp, to resolve circular dependencies BUG=webrtc:8111 patch from issue 3011233002 at patchset 1 (http://crrev.com/3011233002#ps1) Review-Url: https://codereview.webrtc.org/3014463002 Cr-Commit-Position: refs/heads/master@{#19801} --- webrtc/modules/rtp_rtcp/BUILD.gn | 47 ++++++++++++++----- .../source/rtp_header_extension_map.cc | 8 ++-- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/webrtc/modules/rtp_rtcp/BUILD.gn b/webrtc/modules/rtp_rtcp/BUILD.gn index a5b0d300b6..261446c450 100644 --- a/webrtc/modules/rtp_rtcp/BUILD.gn +++ b/webrtc/modules/rtp_rtcp/BUILD.gn @@ -8,21 +8,48 @@ import("../../webrtc.gni") +rtc_source_set("rtp_rtcp_format") { + sources = [ + "include/rtp_cvo.h", + "include/rtp_header_extension_map.h", + "include/rtp_rtcp_defines.h", + "source/byte_io.h", + "source/rtp_header_extension_map.cc", + "source/rtp_header_extensions.cc", + "source/rtp_header_extensions.h", + "source/rtp_packet.cc", + "source/rtp_packet.h", + "source/rtp_packet_received.cc", + "source/rtp_packet_received.h", + "source/rtp_packet_to_send.h", + ] + + deps = [ + "..:module_api", + "../..:webrtc_common", + "../../api:array_view", + "../../api:libjingle_peerconnection_api", + "../../api:optional", + "../../common_video", + "../../rtc_base:rtc_base_approved", + "../../system_wrappers", + ] + + # TODO(crbug.com/webrtc/1348): Fix this warning. + configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] +} + rtc_static_library("rtp_rtcp") { sources = [ "include/flexfec_receiver.h", "include/flexfec_sender.h", "include/receive_statistics.h", "include/remote_ntp_time_estimator.h", - "include/rtp_cvo.h", - "include/rtp_header_extension_map.h", "include/rtp_header_parser.h", "include/rtp_payload_registry.h", "include/rtp_receiver.h", "include/rtp_rtcp.h", - "include/rtp_rtcp_defines.h", "include/ulpfec_receiver.h", - "source/byte_io.h", "source/dtmf_queue.cc", "source/dtmf_queue.h", "source/fec_private_tables_bursty.h", @@ -110,17 +137,9 @@ rtc_static_library("rtp_rtcp") { "source/rtp_format_vp8.h", "source/rtp_format_vp9.cc", "source/rtp_format_vp9.h", - "source/rtp_header_extension_map.cc", - "source/rtp_header_extensions.cc", - "source/rtp_header_extensions.h", "source/rtp_header_parser.cc", - "source/rtp_packet.cc", - "source/rtp_packet.h", "source/rtp_packet_history.cc", "source/rtp_packet_history.h", - "source/rtp_packet_received.cc", - "source/rtp_packet_received.h", - "source/rtp_packet_to_send.h", "source/rtp_payload_registry.cc", "source/rtp_receiver_audio.cc", "source/rtp_receiver_audio.h", @@ -183,6 +202,10 @@ rtc_static_library("rtp_rtcp") { "../remote_bitrate_estimator", ] + public_deps = [ + ":rtp_rtcp_format", + ] + # TODO(jschuh): Bug 1348: fix this warning. configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc b/webrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc index d65b11d5cf..3d48ef08ba 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc @@ -11,7 +11,6 @@ #include "webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" -#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" #include "webrtc/rtc_base/arraysize.h" #include "webrtc/rtc_base/checks.h" #include "webrtc/rtc_base/logging.h" @@ -19,8 +18,6 @@ namespace webrtc { namespace { -using RtpUtility::Word32Align; - struct ExtensionInfo { RTPExtensionType type; const char* uri; @@ -102,7 +99,10 @@ size_t RtpHeaderExtensionMap::GetTotalLengthInBytes( } if (values_size == 0) return 0; - return Word32Align(kRtpOneByteHeaderLength + values_size); + size_t size = kRtpOneByteHeaderLength + values_size; + // Round up to the nearest size that is a multiple of 4. + // Which is same as round down (size + 3). + return size + 3 - (size + 3) % 4; } int32_t RtpHeaderExtensionMap::Deregister(RTPExtensionType type) {