Revert of Loosening the coupling between WebRTC and //third_party/protobuf (patchset #16 id:300001 of https://codereview.webrtc.org/2747863003/ )
Reason for revert:
I will try to reland next week because it is causing some problems.
Original issue's description:
> To accommodate some downstream WebRTC users we need to loosen
> the coupling between our code and the //third_party/protobuf.
>
> This includes using typedefs to define strings instead of
> assuming std::string.
>
> After this refactoring it will be possible to link with other
> protobuf implementations than the current one.
>
> We moved the PRESUBMIT check to another CL [1]. The goal of this
> presubmit is to avoid the direct usage of google::protobuf outside
> of the webrtc/base/protobuf_utils.h header file.
>
> [1] - https://codereview.webrtc.org/2753823003/
>
> BUG=webrtc:7340
> NOTRY=True
>
> Review-Url: https://codereview.webrtc.org/2747863003
> Cr-Commit-Position: refs/heads/master@{#17466}
> Committed: 16ab93b952
TBR=kjellander@webrtc.org,henrik.lundin@webrtc.org,kwiberg@webrtc.org,michaelt@webrtc.org,peah@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:7340
Review-Url: https://codereview.webrtc.org/2786363002
Cr-Commit-Position: refs/heads/master@{#17483}
This commit is contained in:
@ -100,12 +100,6 @@ config("common_config") {
|
|||||||
cflags_cc = []
|
cflags_cc = []
|
||||||
defines = []
|
defines = []
|
||||||
|
|
||||||
if (rtc_enable_protobuf) {
|
|
||||||
defines += [ "WEBRTC_ENABLE_PROTOBUF=1" ]
|
|
||||||
} else {
|
|
||||||
defines += [ "WEBRTC_ENABLE_PROTOBUF=0" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rtc_restrict_logging) {
|
if (rtc_restrict_logging) {
|
||||||
defines += [ "WEBRTC_RESTRICT_LOGGING" ]
|
defines += [ "WEBRTC_RESTRICT_LOGGING" ]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,17 +79,6 @@ if (!rtc_build_ssl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
source_set("protobuf_utils") {
|
|
||||||
sources = [
|
|
||||||
"protobuf_utils.h",
|
|
||||||
]
|
|
||||||
if (rtc_enable_protobuf) {
|
|
||||||
public_deps = [
|
|
||||||
"//third_party/protobuf:protobuf_lite",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# The subset of rtc_base approved for use outside of libjingle.
|
# The subset of rtc_base approved for use outside of libjingle.
|
||||||
rtc_static_library("rtc_base_approved") {
|
rtc_static_library("rtc_base_approved") {
|
||||||
defines = []
|
defines = []
|
||||||
|
|||||||
@ -9,7 +9,4 @@ specific_include_rules = {
|
|||||||
"gunit_prod.h": [
|
"gunit_prod.h": [
|
||||||
"+gtest",
|
"+gtest",
|
||||||
],
|
],
|
||||||
"protobuf_utils.h": [
|
|
||||||
"+third_party/protobuf",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 <string>
|
|
||||||
|
|
||||||
#ifndef WEBRTC_BASE_PROTOBUF_UTILS_H_
|
|
||||||
#define WEBRTC_BASE_PROTOBUF_UTILS_H_
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
using ProtoString = std::string;
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#if WEBRTC_ENABLE_PROTOBUF
|
|
||||||
|
|
||||||
#include "third_party/protobuf/src/google/protobuf/message_lite.h"
|
|
||||||
#include "third_party/protobuf/src/google/protobuf/repeated_field.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
using google::protobuf::MessageLite;
|
|
||||||
using google::protobuf::RepeatedPtrField;
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
||||||
|
|
||||||
#endif // WEBRTC_ENABLE_PROTOBUF
|
|
||||||
|
|
||||||
#endif // WEBRTC_BASE_PROTOBUF_UTILS_H_
|
|
||||||
@ -51,7 +51,6 @@ rtc_static_library("rtc_event_log_impl") {
|
|||||||
deps = [
|
deps = [
|
||||||
":rtc_event_log_api",
|
":rtc_event_log_api",
|
||||||
"..:webrtc_common",
|
"..:webrtc_common",
|
||||||
"../base:protobuf_utils",
|
|
||||||
"../base:rtc_base_approved",
|
"../base:rtc_base_approved",
|
||||||
"../call:call_interfaces",
|
"../call:call_interfaces",
|
||||||
"../modules/audio_coding:audio_network_adaptor",
|
"../modules/audio_coding:audio_network_adaptor",
|
||||||
@ -97,7 +96,6 @@ if (rtc_enable_protobuf) {
|
|||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||||
}
|
}
|
||||||
deps = [
|
deps = [
|
||||||
"../base:protobuf_utils",
|
|
||||||
"../base:rtc_base_approved",
|
"../base:rtc_base_approved",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/base/event.h"
|
#include "webrtc/base/event.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/base/swap_queue.h"
|
#include "webrtc/base/swap_queue.h"
|
||||||
#include "webrtc/base/thread_checker.h"
|
#include "webrtc/base/thread_checker.h"
|
||||||
#include "webrtc/base/timeutils.h"
|
#include "webrtc/base/timeutils.h"
|
||||||
@ -38,7 +37,7 @@
|
|||||||
#include "webrtc/system_wrappers/include/logging.h"
|
#include "webrtc/system_wrappers/include/logging.h"
|
||||||
|
|
||||||
#ifdef ENABLE_RTC_EVENT_LOG
|
#ifdef ENABLE_RTC_EVENT_LOG
|
||||||
// *.pb.h files are generated at build-time by the protobuf compiler.
|
// Files generated at build-time by the protobuf compiler.
|
||||||
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
||||||
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
|
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
|
||||||
#else
|
#else
|
||||||
@ -584,7 +583,7 @@ bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
|
|||||||
if (!dump_file->OpenFile(file_name.c_str(), true)) {
|
if (!dump_file->OpenFile(file_name.c_str(), true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ProtoString dump_buffer;
|
std::string dump_buffer;
|
||||||
while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) {
|
while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) {
|
||||||
dump_buffer.append(tmp_buffer, bytes_read);
|
dump_buffer.append(tmp_buffer, bytes_read);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -20,13 +21,12 @@
|
|||||||
#include "webrtc/base/event.h"
|
#include "webrtc/base/event.h"
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/platform_thread.h"
|
#include "webrtc/base/platform_thread.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/base/swap_queue.h"
|
#include "webrtc/base/swap_queue.h"
|
||||||
#include "webrtc/logging/rtc_event_log/ringbuffer.h"
|
#include "webrtc/logging/rtc_event_log/ringbuffer.h"
|
||||||
#include "webrtc/system_wrappers/include/file_wrapper.h"
|
#include "webrtc/system_wrappers/include/file_wrapper.h"
|
||||||
|
|
||||||
#ifdef ENABLE_RTC_EVENT_LOG
|
#ifdef ENABLE_RTC_EVENT_LOG
|
||||||
// *.ph.h files are generated at build-time by the protobuf compiler.
|
// Files generated at build-time by the protobuf compiler.
|
||||||
RTC_PUSH_IGNORING_WUNDEF()
|
RTC_PUSH_IGNORING_WUNDEF()
|
||||||
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
||||||
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
|
#include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h"
|
||||||
@ -112,7 +112,7 @@ class RtcEventLogHelperThread final {
|
|||||||
std::unique_ptr<rtclog::Event> most_recent_event_;
|
std::unique_ptr<rtclog::Event> most_recent_event_;
|
||||||
|
|
||||||
// Temporary space for serializing profobuf data.
|
// Temporary space for serializing profobuf data.
|
||||||
ProtoString output_string_;
|
std::string output_string_;
|
||||||
|
|
||||||
rtc::Event wake_periodically_;
|
rtc::Event wake_periodically_;
|
||||||
rtc::Event wake_from_hibernation_;
|
rtc::Event wake_from_hibernation_;
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/base/logging.h"
|
#include "webrtc/base/logging.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/call/call.h"
|
#include "webrtc/call/call.h"
|
||||||
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
|
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
|
||||||
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
|
||||||
@ -128,8 +127,8 @@ std::pair<uint64_t, bool> ParseVarInt(std::istream& stream) {
|
|||||||
|
|
||||||
void GetHeaderExtensions(
|
void GetHeaderExtensions(
|
||||||
std::vector<RtpExtension>* header_extensions,
|
std::vector<RtpExtension>* header_extensions,
|
||||||
const RepeatedPtrField<rtclog::RtpHeaderExtension>&
|
const google::protobuf::RepeatedPtrField<rtclog::RtpHeaderExtension>&
|
||||||
proto_header_extensions) {
|
proto_header_extensions) {
|
||||||
header_extensions->clear();
|
header_extensions->clear();
|
||||||
for (auto& p : proto_header_extensions) {
|
for (auto& p : proto_header_extensions) {
|
||||||
RTC_CHECK(p.has_name());
|
RTC_CHECK(p.has_name());
|
||||||
|
|||||||
@ -74,7 +74,6 @@ rtc_static_library("rent_a_codec") {
|
|||||||
deps = [
|
deps = [
|
||||||
"../../api/audio_codecs:audio_codecs_api",
|
"../../api/audio_codecs:audio_codecs_api",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
":audio_coding_module_typedefs",
|
":audio_coding_module_typedefs",
|
||||||
@ -83,7 +82,6 @@ rtc_static_library("rent_a_codec") {
|
|||||||
":isac_fix_c",
|
":isac_fix_c",
|
||||||
":neteq_decoder_enum",
|
":neteq_decoder_enum",
|
||||||
] + audio_codec_deps
|
] + audio_codec_deps
|
||||||
|
|
||||||
defines = audio_codec_defines
|
defines = audio_codec_defines
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,7 +828,6 @@ rtc_static_library("webrtc_opus") {
|
|||||||
":audio_network_adaptor",
|
":audio_network_adaptor",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../api/audio_codecs:audio_codecs_api",
|
"../../api/audio_codecs:audio_codecs_api",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../base:rtc_numerics",
|
"../../base:rtc_numerics",
|
||||||
"../../common_audio",
|
"../../common_audio",
|
||||||
@ -924,7 +921,6 @@ rtc_static_library("audio_network_adaptor") {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../common_audio",
|
"../../common_audio",
|
||||||
"../../logging:rtc_event_log_api",
|
"../../logging:rtc_event_log_api",
|
||||||
@ -1192,12 +1188,10 @@ if (rtc_include_tests) {
|
|||||||
":neteq_unittest_tools",
|
":neteq_unittest_tools",
|
||||||
":webrtc_opus",
|
":webrtc_opus",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../system_wrappers:system_wrappers",
|
"../../system_wrappers:system_wrappers",
|
||||||
"../../test:test_support",
|
"../../test:test_support",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||||
@ -1332,7 +1326,6 @@ if (rtc_include_tests) {
|
|||||||
":neteq",
|
":neteq",
|
||||||
":neteq_unittest_tools",
|
":neteq_unittest_tools",
|
||||||
"../../api/audio_codecs:audio_codecs_api",
|
"../../api/audio_codecs:audio_codecs_api",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../common_audio",
|
"../../common_audio",
|
||||||
"../../test:test_main",
|
"../../test:test_main",
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
@ -2089,7 +2082,6 @@ if (rtc_include_tests) {
|
|||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../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",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base",
|
"../../base:rtc_base",
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../base:rtc_base_tests_utils",
|
"../../base:rtc_base_tests_utils",
|
||||||
|
|||||||
@ -195,7 +195,7 @@ ControllerManagerImpl::Config::Config(int min_reordering_time_ms,
|
|||||||
ControllerManagerImpl::Config::~Config() = default;
|
ControllerManagerImpl::Config::~Config() = default;
|
||||||
|
|
||||||
std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
std::unique_ptr<ControllerManager> ControllerManagerImpl::Create(
|
||||||
const ProtoString& config_string,
|
const std::string& config_string,
|
||||||
size_t num_encoder_channels,
|
size_t num_encoder_channels,
|
||||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||||
int min_encoder_bitrate_bps,
|
int min_encoder_bitrate_bps,
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
|
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -50,7 +49,7 @@ class ControllerManagerImpl final : public ControllerManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static std::unique_ptr<ControllerManager> Create(
|
static std::unique_ptr<ControllerManager> Create(
|
||||||
const ProtoString& config_string,
|
const std::string& config_string,
|
||||||
size_t num_encoder_channels,
|
size_t num_encoder_channels,
|
||||||
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
rtc::ArrayView<const int> encoder_frame_lengths_ms,
|
||||||
int min_encoder_bitrate_bps,
|
int min_encoder_bitrate_bps,
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h"
|
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller_manager.h"
|
||||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/mock/mock_controller.h"
|
#include "webrtc/modules/audio_coding/audio_network_adaptor/mock/mock_controller.h"
|
||||||
#include "webrtc/system_wrappers/include/clock.h"
|
#include "webrtc/system_wrappers/include/clock.h"
|
||||||
@ -274,7 +273,7 @@ constexpr int kInitialFrameLengthMs = 60;
|
|||||||
constexpr int kMinBitrateBps = 6000;
|
constexpr int kMinBitrateBps = 6000;
|
||||||
|
|
||||||
ControllerManagerStates CreateControllerManager(
|
ControllerManagerStates CreateControllerManager(
|
||||||
const ProtoString& config_string) {
|
const std::string& config_string) {
|
||||||
ControllerManagerStates states;
|
ControllerManagerStates states;
|
||||||
states.simulated_clock.reset(new SimulatedClock(kClockInitialTime));
|
states.simulated_clock.reset(new SimulatedClock(kClockInitialTime));
|
||||||
constexpr size_t kNumEncoderChannels = 2;
|
constexpr size_t kNumEncoderChannels = 2;
|
||||||
@ -346,7 +345,7 @@ TEST(ControllerManagerTest, CreateFromConfigStringAndCheckDefaultOrder) {
|
|||||||
AddFrameLengthControllerConfig(&config);
|
AddFrameLengthControllerConfig(&config);
|
||||||
AddBitrateControllerConfig(&config);
|
AddBitrateControllerConfig(&config);
|
||||||
|
|
||||||
ProtoString config_string;
|
std::string config_string;
|
||||||
config.SerializeToString(&config_string);
|
config.SerializeToString(&config_string);
|
||||||
|
|
||||||
auto states = CreateControllerManager(config_string);
|
auto states = CreateControllerManager(config_string);
|
||||||
@ -377,7 +376,7 @@ TEST(ControllerManagerTest, CreateFromConfigStringAndCheckReordering) {
|
|||||||
|
|
||||||
AddBitrateControllerConfig(&config);
|
AddBitrateControllerConfig(&config);
|
||||||
|
|
||||||
ProtoString config_string;
|
std::string config_string;
|
||||||
config.SerializeToString(&config_string);
|
config.SerializeToString(&config_string);
|
||||||
|
|
||||||
auto states = CreateControllerManager(config_string);
|
auto states = CreateControllerManager(config_string);
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
|
|
||||||
#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
|
#ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP
|
||||||
RTC_PUSH_IGNORING_WUNDEF()
|
RTC_PUSH_IGNORING_WUNDEF()
|
||||||
@ -35,7 +34,7 @@ using audio_network_adaptor::debug_dump::EncoderRuntimeConfig;
|
|||||||
|
|
||||||
void DumpEventToFile(const Event& event, FileWrapper* dump_file) {
|
void DumpEventToFile(const Event& event, FileWrapper* dump_file) {
|
||||||
RTC_CHECK(dump_file->is_open());
|
RTC_CHECK(dump_file->is_open());
|
||||||
ProtoString dump_data;
|
std::string dump_data;
|
||||||
event.SerializeToString(&dump_data);
|
event.SerializeToString(&dump_data);
|
||||||
int32_t size = event.ByteSize();
|
int32_t size = event.ByteSize();
|
||||||
dump_file->Write(&size, sizeof(size));
|
dump_file->Write(&size, sizeof(size));
|
||||||
|
|||||||
@ -12,6 +12,7 @@
|
|||||||
#define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP_WRITER_H_
|
#define WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP_WRITER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
|
#include "webrtc/modules/audio_coding/audio_network_adaptor/controller.h"
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/base/logging.h"
|
#include "webrtc/base/logging.h"
|
||||||
#include "webrtc/base/numerics/exp_filter.h"
|
#include "webrtc/base/numerics/exp_filter.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/base/safe_conversions.h"
|
#include "webrtc/base/safe_conversions.h"
|
||||||
#include "webrtc/base/timeutils.h"
|
#include "webrtc/base/timeutils.h"
|
||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
@ -193,7 +192,7 @@ AudioEncoderOpus::AudioEncoderOpus(
|
|||||||
audio_network_adaptor_creator_(
|
audio_network_adaptor_creator_(
|
||||||
audio_network_adaptor_creator
|
audio_network_adaptor_creator
|
||||||
? std::move(audio_network_adaptor_creator)
|
? std::move(audio_network_adaptor_creator)
|
||||||
: [this](const ProtoString& config_string,
|
: [this](const std::string& config_string,
|
||||||
RtcEventLog* event_log,
|
RtcEventLog* event_log,
|
||||||
const Clock* clock) {
|
const Clock* clock) {
|
||||||
return DefaultAudioNetworkAdaptorCreator(config_string,
|
return DefaultAudioNetworkAdaptorCreator(config_string,
|
||||||
@ -549,7 +548,7 @@ void AudioEncoderOpus::ApplyAudioNetworkAdaptor() {
|
|||||||
|
|
||||||
std::unique_ptr<AudioNetworkAdaptor>
|
std::unique_ptr<AudioNetworkAdaptor>
|
||||||
AudioEncoderOpus::DefaultAudioNetworkAdaptorCreator(
|
AudioEncoderOpus::DefaultAudioNetworkAdaptorCreator(
|
||||||
const ProtoString& config_string,
|
const std::string& config_string,
|
||||||
RtcEventLog* event_log,
|
RtcEventLog* event_log,
|
||||||
const Clock* clock) const {
|
const Clock* clock) const {
|
||||||
AudioNetworkAdaptorImpl::Config config;
|
AudioNetworkAdaptorImpl::Config config;
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/base/optional.h"
|
#include "webrtc/base/optional.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/common_audio/smoothing_filter.h"
|
#include "webrtc/common_audio/smoothing_filter.h"
|
||||||
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
#include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor.h"
|
||||||
#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
|
#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
|
||||||
@ -157,7 +156,7 @@ class AudioEncoderOpus final : public AudioEncoder {
|
|||||||
|
|
||||||
void ApplyAudioNetworkAdaptor();
|
void ApplyAudioNetworkAdaptor();
|
||||||
std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator(
|
std::unique_ptr<AudioNetworkAdaptor> DefaultAudioNetworkAdaptorCreator(
|
||||||
const ProtoString& config_string,
|
const std::string& config_string,
|
||||||
RtcEventLog* event_log,
|
RtcEventLog* event_log,
|
||||||
const Clock* clock) const;
|
const Clock* clock) const;
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/sha1digest.h"
|
#include "webrtc/base/sha1digest.h"
|
||||||
#include "webrtc/base/stringencode.h"
|
#include "webrtc/base/stringencode.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
|
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
|
#include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
|
#include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
|
||||||
@ -195,7 +194,7 @@ void ResultSink::AddResult(const NetEqNetworkStatistics& stats_raw) {
|
|||||||
neteq_unittest::NetEqNetworkStatistics stats;
|
neteq_unittest::NetEqNetworkStatistics stats;
|
||||||
Convert(stats_raw, &stats);
|
Convert(stats_raw, &stats);
|
||||||
|
|
||||||
ProtoString stats_string;
|
std::string stats_string;
|
||||||
ASSERT_TRUE(stats.SerializeToString(&stats_string));
|
ASSERT_TRUE(stats.SerializeToString(&stats_string));
|
||||||
AddMessage(output_fp_, digest_.get(), stats_string);
|
AddMessage(output_fp_, digest_.get(), stats_string);
|
||||||
#else
|
#else
|
||||||
@ -208,7 +207,7 @@ void ResultSink::AddResult(const RtcpStatistics& stats_raw) {
|
|||||||
neteq_unittest::RtcpStatistics stats;
|
neteq_unittest::RtcpStatistics stats;
|
||||||
Convert(stats_raw, &stats);
|
Convert(stats_raw, &stats);
|
||||||
|
|
||||||
ProtoString stats_string;
|
std::string stats_string;
|
||||||
ASSERT_TRUE(stats.SerializeToString(&stats_string));
|
ASSERT_TRUE(stats.SerializeToString(&stats_string));
|
||||||
AddMessage(output_fp_, digest_.get(), stats_string);
|
AddMessage(output_fp_, digest_.get(), stats_string);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -232,7 +232,6 @@ rtc_static_library("audio_processing") {
|
|||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../audio/utility:audio_frame_operations",
|
"../../audio/utility:audio_frame_operations",
|
||||||
"../../base:gtest_prod",
|
"../../base:gtest_prod",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../audio_coding:isac",
|
"../audio_coding:isac",
|
||||||
]
|
]
|
||||||
public_deps = [
|
public_deps = [
|
||||||
@ -525,7 +524,6 @@ if (rtc_include_tests) {
|
|||||||
":audioproc_test_utils",
|
":audioproc_test_utils",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:gtest_prod",
|
"../../base:gtest_prod",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base",
|
"../../base:rtc_base",
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../common_audio:common_audio",
|
"../../common_audio:common_audio",
|
||||||
@ -658,10 +656,8 @@ if (rtc_include_tests) {
|
|||||||
deps = [
|
deps = [
|
||||||
":audio_processing",
|
":audio_processing",
|
||||||
":audioproc_test_utils",
|
":audioproc_test_utils",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"//testing/gtest",
|
"//testing/gtest",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (rtc_enable_intelligibility_enhancer) {
|
if (rtc_enable_intelligibility_enhancer) {
|
||||||
defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
|
defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
|
||||||
} else {
|
} else {
|
||||||
@ -682,7 +678,6 @@ if (rtc_include_tests) {
|
|||||||
":audioproc_protobuf_utils",
|
":audioproc_protobuf_utils",
|
||||||
":audioproc_test_utils",
|
":audioproc_test_utils",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../common_audio",
|
"../../common_audio",
|
||||||
"../../system_wrappers:system_wrappers_default",
|
"../../system_wrappers:system_wrappers_default",
|
||||||
@ -707,7 +702,6 @@ if (rtc_include_tests) {
|
|||||||
":audioproc_debug_proto",
|
":audioproc_debug_proto",
|
||||||
":audioproc_protobuf_utils",
|
":audioproc_protobuf_utils",
|
||||||
":audioproc_test_utils",
|
":audioproc_test_utils",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
"../../common_audio:common_audio",
|
"../../common_audio:common_audio",
|
||||||
"../../system_wrappers",
|
"../../system_wrappers",
|
||||||
@ -823,7 +817,6 @@ if (rtc_include_tests) {
|
|||||||
deps = [
|
deps = [
|
||||||
":audioproc_debug_proto",
|
":audioproc_debug_proto",
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../base:protobuf_utils",
|
|
||||||
"../../base:rtc_base_approved",
|
"../../base:rtc_base_approved",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1879,11 +1879,11 @@ int AudioProcessingImpl::WriteInitMessage() {
|
|||||||
audioproc::Init* msg = debug_dump_.capture.event_msg->mutable_init();
|
audioproc::Init* msg = debug_dump_.capture.event_msg->mutable_init();
|
||||||
msg->set_sample_rate(formats_.api_format.input_stream().sample_rate_hz());
|
msg->set_sample_rate(formats_.api_format.input_stream().sample_rate_hz());
|
||||||
|
|
||||||
msg->set_num_input_channels(static_cast<int32_t>(
|
msg->set_num_input_channels(static_cast<google::protobuf::int32>(
|
||||||
formats_.api_format.input_stream().num_channels()));
|
formats_.api_format.input_stream().num_channels()));
|
||||||
msg->set_num_output_channels(static_cast<int32_t>(
|
msg->set_num_output_channels(static_cast<google::protobuf::int32>(
|
||||||
formats_.api_format.output_stream().num_channels()));
|
formats_.api_format.output_stream().num_channels()));
|
||||||
msg->set_num_reverse_channels(static_cast<int32_t>(
|
msg->set_num_reverse_channels(static_cast<google::protobuf::int32>(
|
||||||
formats_.api_format.reverse_input_stream().num_channels()));
|
formats_.api_format.reverse_input_stream().num_channels()));
|
||||||
msg->set_reverse_sample_rate(
|
msg->set_reverse_sample_rate(
|
||||||
formats_.api_format.reverse_input_stream().sample_rate_hz());
|
formats_.api_format.reverse_input_stream().sample_rate_hz());
|
||||||
@ -1953,7 +1953,7 @@ int AudioProcessingImpl::WriteConfigMessage(bool forced) {
|
|||||||
}
|
}
|
||||||
config.set_experiments_description(experiments_description);
|
config.set_experiments_description(experiments_description);
|
||||||
|
|
||||||
ProtoString serialized_config = config.SerializeAsString();
|
std::string serialized_config = config.SerializeAsString();
|
||||||
if (!forced &&
|
if (!forced &&
|
||||||
debug_dump_.capture.last_serialized_config == serialized_config) {
|
debug_dump_.capture.last_serialized_config == serialized_config) {
|
||||||
return kNoError;
|
return kNoError;
|
||||||
|
|||||||
@ -13,13 +13,13 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "webrtc/base/criticalsection.h"
|
#include "webrtc/base/criticalsection.h"
|
||||||
#include "webrtc/base/function_view.h"
|
#include "webrtc/base/function_view.h"
|
||||||
#include "webrtc/base/gtest_prod_util.h"
|
#include "webrtc/base/gtest_prod_util.h"
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/base/swap_queue.h"
|
#include "webrtc/base/swap_queue.h"
|
||||||
#include "webrtc/base/thread_annotations.h"
|
#include "webrtc/base/thread_annotations.h"
|
||||||
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
#include "webrtc/modules/audio_processing/audio_buffer.h"
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#include "webrtc/system_wrappers/include/file_wrapper.h"
|
#include "webrtc/system_wrappers/include/file_wrapper.h"
|
||||||
|
|
||||||
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
||||||
// *.pb.h files are generated at build-time by the protobuf compiler.
|
// Files generated at build-time by the protobuf compiler.
|
||||||
RTC_PUSH_IGNORING_WUNDEF()
|
RTC_PUSH_IGNORING_WUNDEF()
|
||||||
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
#ifdef WEBRTC_ANDROID_PLATFORM_BUILD
|
||||||
#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
|
#include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h"
|
||||||
@ -200,10 +200,10 @@ class AudioProcessingImpl : public AudioProcessing {
|
|||||||
ApmDebugDumpThreadState();
|
ApmDebugDumpThreadState();
|
||||||
~ApmDebugDumpThreadState();
|
~ApmDebugDumpThreadState();
|
||||||
std::unique_ptr<audioproc::Event> event_msg; // Protobuf message.
|
std::unique_ptr<audioproc::Event> event_msg; // Protobuf message.
|
||||||
ProtoString event_str; // Memory for protobuf serialization.
|
std::string event_str; // Memory for protobuf serialization.
|
||||||
|
|
||||||
// Serialized string of last saved APM configuration.
|
// Serialized string of last saved APM configuration.
|
||||||
ProtoString last_serialized_config;
|
std::string last_serialized_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ApmDebugDumpState {
|
struct ApmDebugDumpState {
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
#include "webrtc/base/checks.h"
|
#include "webrtc/base/checks.h"
|
||||||
#include "webrtc/base/gtest_prod_util.h"
|
#include "webrtc/base/gtest_prod_util.h"
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
#include "webrtc/common_audio/include/audio_util.h"
|
#include "webrtc/common_audio/include/audio_util.h"
|
||||||
#include "webrtc/common_audio/resampler/include/push_resampler.h"
|
#include "webrtc/common_audio/resampler/include/push_resampler.h"
|
||||||
#include "webrtc/common_audio/resampler/push_sinc_resampler.h"
|
#include "webrtc/common_audio/resampler/push_sinc_resampler.h"
|
||||||
@ -59,7 +58,7 @@ namespace {
|
|||||||
// file. This is the typical case. When the file should be updated, it can
|
// file. This is the typical case. When the file should be updated, it can
|
||||||
// be set to true with the command-line switch --write_ref_data.
|
// be set to true with the command-line switch --write_ref_data.
|
||||||
bool write_ref_data = false;
|
bool write_ref_data = false;
|
||||||
const int32_t kChannels[] = {1, 2};
|
const google::protobuf::int32 kChannels[] = {1, 2};
|
||||||
const int kSampleRates[] = {8000, 16000, 32000, 48000};
|
const int kSampleRates[] = {8000, 16000, 32000, 48000};
|
||||||
|
|
||||||
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
|
#if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
|
||||||
@ -231,7 +230,7 @@ void WriteStatsMessage(const AudioProcessing::Statistic& output,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OpenFileAndWriteMessage(const std::string filename,
|
void OpenFileAndWriteMessage(const std::string filename,
|
||||||
const MessageLite& msg) {
|
const ::google::protobuf::MessageLite& msg) {
|
||||||
FILE* file = fopen(filename.c_str(), "wb");
|
FILE* file = fopen(filename.c_str(), "wb");
|
||||||
ASSERT_TRUE(file != NULL);
|
ASSERT_TRUE(file != NULL);
|
||||||
|
|
||||||
@ -300,7 +299,8 @@ void ClearTempFiles() {
|
|||||||
remove(kv.second.c_str());
|
remove(kv.second.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenFileAndReadMessage(std::string filename, MessageLite* msg) {
|
void OpenFileAndReadMessage(std::string filename,
|
||||||
|
::google::protobuf::MessageLite* msg) {
|
||||||
FILE* file = fopen(filename.c_str(), "rb");
|
FILE* file = fopen(filename.c_str(), "rb");
|
||||||
ASSERT_TRUE(file != NULL);
|
ASSERT_TRUE(file != NULL);
|
||||||
ReadMessageFromFile(file, msg);
|
ReadMessageFromFile(file, msg);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ size_t ReadMessageBytesFromFile(FILE* file, std::unique_ptr<uint8_t[]>* bytes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true on success, false on error or end-of-file.
|
// Returns true on success, false on error or end-of-file.
|
||||||
bool ReadMessageFromFile(FILE* file, MessageLite* msg) {
|
bool ReadMessageFromFile(FILE* file, ::google::protobuf::MessageLite* msg) {
|
||||||
std::unique_ptr<uint8_t[]> bytes;
|
std::unique_ptr<uint8_t[]> bytes;
|
||||||
size_t size = ReadMessageBytesFromFile(file, &bytes);
|
size_t size = ReadMessageBytesFromFile(file, &bytes);
|
||||||
if (!size)
|
if (!size)
|
||||||
|
|||||||
@ -14,7 +14,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "webrtc/base/ignore_wundef.h"
|
#include "webrtc/base/ignore_wundef.h"
|
||||||
#include "webrtc/base/protobuf_utils.h"
|
|
||||||
|
|
||||||
RTC_PUSH_IGNORING_WUNDEF()
|
RTC_PUSH_IGNORING_WUNDEF()
|
||||||
#include "webrtc/modules/audio_processing/debug.pb.h"
|
#include "webrtc/modules/audio_processing/debug.pb.h"
|
||||||
@ -27,7 +26,7 @@ namespace webrtc {
|
|||||||
size_t ReadMessageBytesFromFile(FILE* file, std::unique_ptr<uint8_t[]>* bytes);
|
size_t ReadMessageBytesFromFile(FILE* file, std::unique_ptr<uint8_t[]>* bytes);
|
||||||
|
|
||||||
// Returns true on success, false on error or end-of-file.
|
// Returns true on success, false on error or end-of-file.
|
||||||
bool ReadMessageFromFile(FILE* file, MessageLite* msg);
|
bool ReadMessageFromFile(FILE* file, ::google::protobuf::MessageLite* msg);
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
|||||||
@ -202,7 +202,6 @@ if (rtc_enable_protobuf) {
|
|||||||
}
|
}
|
||||||
defines = [ "ENABLE_RTC_EVENT_LOG" ]
|
defines = [ "ENABLE_RTC_EVENT_LOG" ]
|
||||||
deps = [
|
deps = [
|
||||||
"../base:protobuf_utils",
|
|
||||||
"../call:call_interfaces",
|
"../call:call_interfaces",
|
||||||
"../logging:rtc_event_log_impl",
|
"../logging:rtc_event_log_impl",
|
||||||
"../logging:rtc_event_log_parser",
|
"../logging:rtc_event_log_parser",
|
||||||
@ -239,7 +238,6 @@ if (rtc_include_tests) {
|
|||||||
defines = [ "ENABLE_RTC_EVENT_LOG" ]
|
defines = [ "ENABLE_RTC_EVENT_LOG" ]
|
||||||
deps = [
|
deps = [
|
||||||
":event_log_visualizer_utils",
|
":event_log_visualizer_utils",
|
||||||
"../base:protobuf_utils",
|
|
||||||
"../test:field_trial",
|
"../test:field_trial",
|
||||||
"//third_party/gflags",
|
"//third_party/gflags",
|
||||||
]
|
]
|
||||||
@ -331,7 +329,6 @@ if (rtc_include_tests) {
|
|||||||
"$root_build_dir/{{source_file_part}}",
|
"$root_build_dir/{{source_file_part}}",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../base:protobuf_utils",
|
|
||||||
"../logging:rtc_event_log_proto",
|
"../logging:rtc_event_log_proto",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user