Moved transport.h from webrtc/ to webrtc/api, created build target and updated WebRTC dependencies.

transport.h defines an interface for sending rtp and rtcp packets,
which is used by MediaChannel in webrtc/media/engine,
{Audio|Video}{Send|Receive}Stream and in a few other
places. It was part of the build target //webrtc:webrtc, which is a monolithic target with
all webrtc production code. This CL moves the header to its own target in webrtc/api
and deprecates the old location.

Targets in webrtc/api should in general only depend on other
targets in webrtc/api. The target webrtc/api:call_api depends on
transport.h. This change also makes webrtc/voice_engine pass GN's header
include checker and is needed in order for webrtc/api:call_api to pass
it.

transport.h will be completely removed in a follow-up CL in a few weeks
after clients have updated their includes.

NOTRY=True

BUG=webrtc:5589, webrtc:5878, webrtc:6785

Review-Url: https://codereview.webrtc.org/2426563003
Cr-Commit-Position: refs/heads/master@{#15267}
This commit is contained in:
aleloi 2016-11-28 07:02:13 -08:00 committed by Commit bot
parent 9abbf5ae4e
commit a8eb756a34
27 changed files with 81 additions and 42 deletions

2
.gn
View File

@ -21,6 +21,7 @@ secondary_source = "//build/secondary/"
# TODO(kjellander): Keep adding paths to this list as work in webrtc:5589 is done.
check_targets = [
"//webrtc/api:audio_mixer_api",
"//webrtc/api:transport_api",
"//webrtc/api:rtc_stats_api",
"//webrtc/modules/audio_coding:audio_decoder_factory_interface",
"//webrtc/modules/audio_coding:audio_format",
@ -37,6 +38,7 @@ check_targets = [
"//webrtc/modules/audio_device/*",
"//webrtc/modules/audio_mixer/*",
"//webrtc/stats:rtc_stats",
"//webrtc/voice_engine",
"//webrtc/voice_engine:level_indicator",
]

View File

@ -231,6 +231,11 @@ if (!build_with_chromium) {
"build/no_op_function.cc",
"call.h",
"config.h",
# TODO(aleloi): remove transport.h and the transport api
# dependency once clients have updated to the new transport
# location in webrtc/api/call/transport.h See
# http://bugs.webrtc.org/6785.
"transport.h",
]
@ -239,6 +244,7 @@ if (!build_with_chromium) {
deps = [
":webrtc_common",
"api",
"api:transport_api",
"audio",
"base",
"call",

View File

@ -37,6 +37,7 @@ rtc_source_set("call_api") {
deps = [
# TODO(kjellander): Add remaining dependencies when webrtc:4243 is done.
":audio_mixer_api",
":transport_api",
"..:webrtc_common",
"../base:rtc_base_approved",
"../modules/audio_coding:audio_encoder_interface",
@ -362,6 +363,11 @@ rtc_source_set("audio_mixer_api") {
]
}
rtc_source_set("transport_api") {
sources = [
"call/transport.h",
]
}
if (rtc_include_tests) {
config("peerconnection_unittests_config") {
# The warnings below are enabled by default. Since GN orders compiler flags

View File

@ -16,12 +16,12 @@
#include <string>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/optional.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h"
#include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/transport.h"
#include "webrtc/typedefs.h"
namespace webrtc {

View File

@ -15,10 +15,10 @@
#include <string>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/optional.h"
#include "webrtc/config.h"
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
#include "webrtc/transport.h"
#include "webrtc/typedefs.h"
namespace webrtc {

View File

@ -0,0 +1,40 @@
/*
* 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_API_CALL_TRANSPORT_H_
#define WEBRTC_API_CALL_TRANSPORT_H_
#include <stddef.h>
#include <stdint.h>
namespace webrtc {
// TODO(holmer): Look into unifying this with the PacketOptions in
// asyncpacketsocket.h.
struct PacketOptions {
// A 16 bits positive id. Negative ids are invalid and should be interpreted
// as packet_id not being set.
int packet_id = -1;
};
class Transport {
public:
virtual bool SendRtp(const uint8_t* packet,
size_t length,
const PacketOptions& options) = 0;
virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0;
protected:
virtual ~Transport() {}
};
} // namespace webrtc
#endif // WEBRTC_API_CALL_TRANSPORT_H_

View File

@ -27,6 +27,7 @@ rtc_static_library("call") {
deps = [
"..:webrtc_common",
"../api:transport_api",
"../audio",
"../base:rtc_task_queue",
"../logging:rtc_event_log_impl",

View File

@ -226,6 +226,7 @@ rtc_static_library("rtc_media") {
":rtc_media_base",
"..:webrtc_common",
"../api:call_api",
"../api:transport_api",
"../base:rtc_base_approved",
"../call",
"../modules/audio_mixer:audio_mixer_impl",

View File

@ -17,6 +17,7 @@
#include <string>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/asyncinvoker.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/networkroute.h"
@ -28,7 +29,6 @@
#include "webrtc/media/base/mediaengine.h"
#include "webrtc/media/engine/webrtcvideodecoderfactory.h"
#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
#include "webrtc/transport.h"
#include "webrtc/video_frame.h"
#include "webrtc/video_receive_stream.h"
#include "webrtc/video_send_stream.h"

View File

@ -641,6 +641,7 @@ if (rtc_include_tests) {
deps += [
":audio_network_adaptor_unittests",
"..:webrtc_common",
"../api:transport_api",
"../base:rtc_base", # TODO(kjellander): Cleanup in bugs.webrtc.org/3806.
"../common_audio",
"../common_video",

View File

@ -174,6 +174,7 @@ rtc_static_library("rtp_rtcp") {
deps = [
"../..:webrtc_common",
"../../api:transport_api",
"../../common_video",
"../../system_wrappers",
"../remote_bitrate_estimator",

View File

@ -14,6 +14,7 @@
#include <memory>
#include <set>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/rate_limiter.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
@ -23,7 +24,6 @@
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/test/gtest.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -18,6 +18,7 @@
#include <string>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/random.h"
@ -31,7 +32,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h"
#include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
#include "webrtc/transport.h"
#include "webrtc/typedefs.h"
namespace webrtc {

View File

@ -16,6 +16,7 @@
#include <utility>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/deprecation.h"
@ -32,7 +33,6 @@
#include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
#include "webrtc/modules/rtp_rtcp/source/ssrc_database.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -10,6 +10,7 @@
#ifndef WEBRTC_MODULES_RTP_RTCP_TEST_TESTAPI_TEST_API_H_
#define WEBRTC_MODULES_RTP_RTCP_TEST_TESTAPI_TEST_API_H_
#include "webrtc/api/call/transport.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
@ -18,7 +19,6 @@
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/test/gtest.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -340,6 +340,7 @@ rtc_source_set("test_common") {
":rtp_test_utils",
":test_support",
"..:webrtc_common",
"../api:transport_api",
"../audio",
"../base:rtc_base_approved",
"../call",

View File

@ -14,11 +14,11 @@
#include <deque>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/event.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/test/fake_network_pipe.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_TEST_MOCK_TRANSPORT_H_
#define WEBRTC_TEST_MOCK_TRANSPORT_H_
#include "webrtc/api/call/transport.h"
#include "webrtc/test/gmock.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -10,7 +10,7 @@
#ifndef WEBRTC_TEST_NULL_TRANSPORT_H_
#define WEBRTC_TEST_NULL_TRANSPORT_H_
#include "webrtc/transport.h"
#include "webrtc/api/call/transport.h"
namespace webrtc {

View File

@ -7,35 +7,12 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_TRANSPORT_H_
#define WEBRTC_TRANSPORT_H_
#include "webrtc/api/call/transport.h"
// The contents header have moved to webrtc/api/call/transport.h. This
// file is deprecated. See http://bugs.webrtc.org/6785.
#include <stddef.h>
#include "webrtc/typedefs.h"
namespace webrtc {
// TODO(holmer): Look into unifying this with the PacketOptions in
// asyncpacketsocket.h.
struct PacketOptions {
// A 16 bits positive id. Negative ids are invalid and should be interpreted
// as packet_id not being set.
int packet_id = -1;
};
class Transport {
public:
virtual bool SendRtp(const uint8_t* packet,
size_t length,
const PacketOptions& options) = 0;
virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0;
protected:
virtual ~Transport() {}
};
} // namespace webrtc
// TODO(aleloi): delete this file when all dependencies are updated.
#endif // WEBRTC_TRANSPORT_H_

View File

@ -56,6 +56,7 @@ rtc_static_library("video") {
deps = [
"..:webrtc_common",
"../api:transport_api",
"../base:rtc_analytics",
"../base:rtc_base_approved",
"../base:rtc_task_queue",

View File

@ -10,9 +10,9 @@
#ifndef WEBRTC_VIDEO_TRANSPORT_ADAPTER_H_
#define WEBRTC_VIDEO_TRANSPORT_ADAPTER_H_
#include "webrtc/api/call/transport.h"
#include "webrtc/common_types.h"
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/transport.h"
namespace webrtc {
namespace internal {

View File

@ -16,12 +16,12 @@
#include <string>
#include <vector>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/platform_file.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/config.h"
#include "webrtc/media/base/videosinkinterface.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -17,13 +17,13 @@
#include <vector>
#include <utility>
#include "webrtc/api/call/transport.h"
#include "webrtc/base/platform_file.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/include/frame_callback.h"
#include "webrtc/config.h"
#include "webrtc/media/base/videosinkinterface.h"
#include "webrtc/media/base/videosourceinterface.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -89,6 +89,7 @@ rtc_static_library("voice_engine") {
"..:webrtc_common",
"../api:audio_mixer_api",
"../api:call_api",
"../api:transport_api",
"../base:rtc_base_approved",
"../common_audio",
"../logging:rtc_event_log_api",
@ -177,6 +178,7 @@ if (rtc_include_tests) {
deps = [
"..:webrtc_common",
"../api:transport_api",
"../system_wrappers",
"//testing/gtest",
]

View File

@ -34,8 +34,8 @@
#ifndef WEBRTC_VOICE_ENGINE_VOE_NETWORK_H
#define WEBRTC_VOICE_ENGINE_VOE_NETWORK_H
#include "webrtc/api/call/transport.h"
#include "webrtc/common_types.h"
#include "webrtc/transport.h"
namespace webrtc {

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_VOICE_ENGINE_TEST_CHANNEL_TRANSPORT_UDP_TRANSPORT_H_
#define WEBRTC_VOICE_ENGINE_TEST_CHANNEL_TRANSPORT_UDP_TRANSPORT_H_
#include "webrtc/api/call/transport.h"
#include "webrtc/common_types.h"
#include "webrtc/transport.h"
#include "webrtc/typedefs.h"
/*