Repo created
This commit is contained in:
parent
81b91f4139
commit
f8c34fa5ee
22732 changed files with 4815320 additions and 2 deletions
52
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/BUILD.gn
Normal file
52
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/BUILD.gn
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# Copyright (c) 2019 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.
|
||||
|
||||
import("../../webrtc.gni")
|
||||
|
||||
rtc_library("rtc_event_log") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"rtc_event.cc",
|
||||
"rtc_event.h",
|
||||
"rtc_event_log.cc",
|
||||
"rtc_event_log.h",
|
||||
"rtc_event_log_factory_interface.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"..:libjingle_logging_api",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:timeutils",
|
||||
"../environment",
|
||||
"../task_queue",
|
||||
]
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
|
||||
}
|
||||
|
||||
rtc_library("rtc_event_log_factory") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"rtc_event_log_factory.cc",
|
||||
"rtc_event_log_factory.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":rtc_event_log",
|
||||
"..:field_trials_view",
|
||||
"../../rtc_base/system:rtc_export",
|
||||
"../environment",
|
||||
"../task_queue",
|
||||
]
|
||||
|
||||
absl_deps = [ "//third_party/abseil-cpp/absl/base:nullability" ]
|
||||
|
||||
if (rtc_enable_protobuf) {
|
||||
defines = [ "WEBRTC_ENABLE_RTC_EVENT_LOG" ]
|
||||
deps += [ "../../logging:rtc_event_log_impl" ]
|
||||
}
|
||||
}
|
||||
19
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/rtc_event.cc
Normal file
19
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/rtc_event.cc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Copyright (c) 2019 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/rtc_event_log/rtc_event.h"
|
||||
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
RtcEvent::RtcEvent() : timestamp_us_(rtc::TimeMillis() * 1000) {}
|
||||
|
||||
} // namespace webrtc
|
||||
88
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/rtc_event.h
Normal file
88
TMessagesProj/jni/voip/webrtc/api/rtc_event_log/rtc_event.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* 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_RTC_EVENT_LOG_RTC_EVENT_H_
|
||||
#define API_RTC_EVENT_LOG_RTC_EVENT_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// This class allows us to store unencoded RTC events. Subclasses of this class
|
||||
// store the actual information. This allows us to keep all unencoded events,
|
||||
// even when their type and associated information differ, in the same buffer.
|
||||
// Additionally, it prevents dependency leaking - a module that only logs
|
||||
// events of type RtcEvent_A doesn't need to know about anything associated
|
||||
// with events of type RtcEvent_B.
|
||||
class RtcEvent {
|
||||
public:
|
||||
// Subclasses of this class have to associate themselves with a unique value
|
||||
// of Type. This leaks the information of existing subclasses into the
|
||||
// superclass, but the *actual* information - rtclog::StreamConfig, etc. -
|
||||
// is kept separate.
|
||||
enum class Type : uint32_t {
|
||||
AlrStateEvent,
|
||||
RouteChangeEvent,
|
||||
RemoteEstimateEvent,
|
||||
AudioNetworkAdaptation,
|
||||
AudioPlayout,
|
||||
AudioReceiveStreamConfig,
|
||||
AudioSendStreamConfig,
|
||||
BweUpdateDelayBased,
|
||||
BweUpdateLossBased,
|
||||
DtlsTransportState,
|
||||
DtlsWritableState,
|
||||
IceCandidatePairConfig,
|
||||
IceCandidatePairEvent,
|
||||
ProbeClusterCreated,
|
||||
ProbeResultFailure,
|
||||
ProbeResultSuccess,
|
||||
RtcpPacketIncoming,
|
||||
RtcpPacketOutgoing,
|
||||
RtpPacketIncoming,
|
||||
RtpPacketOutgoing,
|
||||
VideoReceiveStreamConfig,
|
||||
VideoSendStreamConfig,
|
||||
GenericPacketSent,
|
||||
GenericPacketReceived,
|
||||
GenericAckReceived,
|
||||
FrameDecoded,
|
||||
NetEqSetMinimumDelay,
|
||||
BeginV3Log = 0x2501580,
|
||||
EndV3Log = 0x2501581,
|
||||
FakeEvent, // For unit testing.
|
||||
};
|
||||
|
||||
RtcEvent();
|
||||
virtual ~RtcEvent() = default;
|
||||
|
||||
virtual Type GetType() const = 0;
|
||||
|
||||
virtual bool IsConfigEvent() const = 0;
|
||||
|
||||
// Events are grouped by Type before being encoded.
|
||||
// Optionally, `GetGroupKey` can be overloaded to group the
|
||||
// events by a secondary key (in addition to the event type.)
|
||||
// This can, in some cases, improve compression efficiency
|
||||
// e.g. by grouping events by SSRC.
|
||||
virtual uint32_t GetGroupKey() const { return 0; }
|
||||
|
||||
int64_t timestamp_ms() const { return timestamp_us_ / 1000; }
|
||||
int64_t timestamp_us() const { return timestamp_us_; }
|
||||
|
||||
protected:
|
||||
explicit RtcEvent(int64_t timestamp_us) : timestamp_us_(timestamp_us) {}
|
||||
|
||||
const int64_t timestamp_us_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_RTC_EVENT_LOG_RTC_EVENT_H_
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2018 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/rtc_event_log/rtc_event_log.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
bool RtcEventLogNull::StartLogging(
|
||||
std::unique_ptr<RtcEventLogOutput> /*output*/,
|
||||
int64_t /*output_period_ms*/) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright (c) 2015 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_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
|
||||
#define API_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include "api/rtc_event_log/rtc_event.h"
|
||||
#include "api/rtc_event_log_output.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RtcEventLog {
|
||||
public:
|
||||
enum : size_t { kUnlimitedOutput = 0 };
|
||||
enum : int64_t { kImmediateOutput = 0 };
|
||||
|
||||
// TODO(eladalon): Get rid of the legacy encoding and this enum once all
|
||||
// clients have migrated to the new format.
|
||||
enum class EncodingType { Legacy, NewFormat, ProtoFree };
|
||||
|
||||
virtual ~RtcEventLog() = default;
|
||||
|
||||
// Starts logging to a given output. The output might be limited in size,
|
||||
// and may close itself once it has reached the maximum size.
|
||||
virtual bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) = 0;
|
||||
|
||||
// Stops logging to file and waits until the file has been closed, after
|
||||
// which it would be permissible to read and/or modify it.
|
||||
virtual void StopLogging() = 0;
|
||||
|
||||
// Stops logging to file and calls `callback` when the file has been closed.
|
||||
// Note that it is not safe to call any other members, including the
|
||||
// destructor, until the callback has been called.
|
||||
// TODO(srte): Remove default implementation when it's safe to do so.
|
||||
virtual void StopLogging(std::function<void()> callback) {
|
||||
StopLogging();
|
||||
callback();
|
||||
}
|
||||
|
||||
// Log an RTC event (the type of event is determined by the subclass).
|
||||
virtual void Log(std::unique_ptr<RtcEvent> event) = 0;
|
||||
};
|
||||
|
||||
// No-op implementation is used if flag is not set, or in tests.
|
||||
class RtcEventLogNull final : public RtcEventLog {
|
||||
public:
|
||||
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
|
||||
int64_t output_period_ms) override;
|
||||
void StopLogging() override {}
|
||||
void Log(std::unique_ptr<RtcEvent> event) override {}
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_RTC_EVENT_LOG_RTC_EVENT_LOG_H_
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright 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/rtc_event_log/rtc_event_log_factory.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/nullability.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/field_trials_view.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
|
||||
#ifdef WEBRTC_ENABLE_RTC_EVENT_LOG
|
||||
#include "logging/rtc_event_log/rtc_event_log_impl.h"
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
absl::Nonnull<std::unique_ptr<RtcEventLog>> RtcEventLogFactory::Create(
|
||||
const Environment& env) const {
|
||||
#ifndef WEBRTC_ENABLE_RTC_EVENT_LOG
|
||||
return std::make_unique<RtcEventLogNull>();
|
||||
#else
|
||||
if (env.field_trials().IsEnabled("WebRTC-RtcEventLogKillSwitch")) {
|
||||
return std::make_unique<RtcEventLogNull>();
|
||||
}
|
||||
return std::make_unique<RtcEventLogImpl>(env);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright 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_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_H_
|
||||
#define API_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/nullability.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "api/rtc_event_log/rtc_event_log_factory_interface.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class RTC_EXPORT RtcEventLogFactory : public RtcEventLogFactoryInterface {
|
||||
public:
|
||||
RtcEventLogFactory() = default;
|
||||
|
||||
[[deprecated("Use default constructor")]] //
|
||||
explicit RtcEventLogFactory(TaskQueueFactory* task_queue_factory) {}
|
||||
|
||||
~RtcEventLogFactory() override = default;
|
||||
|
||||
absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
|
||||
const Environment& env) const override;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_H_
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright 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_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_INTERFACE_H_
|
||||
#define API_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_INTERFACE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/nullability.h"
|
||||
#include "api/environment/environment.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
// This interface exists to allow webrtc to be optionally built without
|
||||
// RtcEventLog support. A PeerConnectionFactory is constructed with an
|
||||
// RtcEventLogFactoryInterface, which may or may not be null.
|
||||
class RtcEventLogFactoryInterface {
|
||||
public:
|
||||
virtual ~RtcEventLogFactoryInterface() = default;
|
||||
|
||||
virtual absl::Nonnull<std::unique_ptr<RtcEventLog>> Create(
|
||||
const Environment& env) const = 0;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // API_RTC_EVENT_LOG_RTC_EVENT_LOG_FACTORY_INTERFACE_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue