Allow injection of task queue factory in RtcEventLog.
Bug: webrtc:10365 Change-Id: I48dcaaa7cecf8a201a30b81f23056a4d3a72c5a4 Reviewed-on: https://webrtc-review.googlesource.com/c/124825 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26906}
This commit is contained in:

committed by
Commit Bot

parent
8ea0238c7b
commit
b8a4d688f9
@ -38,6 +38,7 @@ rtc_source_set("rtc_event_log_api") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"../api/task_queue",
|
||||
"../api:libjingle_logging_api",
|
||||
"../api:scoped_refptr",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
@ -261,6 +262,7 @@ rtc_static_library("rtc_event_log_impl_base") {
|
||||
deps = [
|
||||
":ice_log",
|
||||
":rtc_event_log_api",
|
||||
"../api/task_queue:global_task_queue_factory",
|
||||
"../api:libjingle_logging_api",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/rtc_event_log_output.h"
|
||||
#include "api/task_queue/task_queue_factory.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -36,6 +37,10 @@ class RtcEventLog {
|
||||
// Factory method to create an RtcEventLog object.
|
||||
static std::unique_ptr<RtcEventLog> Create(EncodingType encoding_type);
|
||||
|
||||
static std::unique_ptr<RtcEventLog> Create(
|
||||
EncodingType encoding_type,
|
||||
TaskQueueFactory* task_queue_factory);
|
||||
|
||||
// Create an RtcEventLog object that does nothing.
|
||||
static std::unique_ptr<RtcEventLog> CreateNull();
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/rtc_event_log_output.h"
|
||||
#include "api/task_queue/global_task_queue_factory.h"
|
||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
|
||||
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
|
||||
#include "rtc_base/checks.h"
|
||||
@ -370,10 +371,17 @@ void RtcEventLogImpl::WriteToOutput(const std::string& output_string) {
|
||||
|
||||
// RtcEventLog member functions.
|
||||
std::unique_ptr<RtcEventLog> RtcEventLog::Create(EncodingType encoding_type) {
|
||||
return RtcEventLog::Create(encoding_type, &GlobalTaskQueueFactory());
|
||||
}
|
||||
|
||||
std::unique_ptr<RtcEventLog> RtcEventLog::Create(
|
||||
RtcEventLog::EncodingType encoding_type,
|
||||
TaskQueueFactory* task_queue_factory) {
|
||||
#ifdef ENABLE_RTC_EVENT_LOG
|
||||
return absl::make_unique<RtcEventLogImpl>(
|
||||
CreateEncoder(encoding_type),
|
||||
absl::make_unique<rtc::TaskQueue>("rtc_event_log"));
|
||||
absl::make_unique<rtc::TaskQueue>(task_queue_factory->CreateTaskQueue(
|
||||
"rtc_event_log", TaskQueueFactory::Priority::NORMAL)));
|
||||
#else
|
||||
return CreateNull();
|
||||
#endif // ENABLE_RTC_EVENT_LOG
|
||||
|
Reference in New Issue
Block a user