Pass the RtcEventLog instance to ICE via JsepTransportController.

This CL fixes a bug that the RtcEventLog owned by PeerConnection was not
passed to P2PTransportChannel after JsepTransportController was
introduced to deprecate the legacy TransportController.

Bug: webrtc:9337
Change-Id: I406cd9c0761dfe67f969aa99c6141e1ab38249d5
Reviewed-on: https://webrtc-review.googlesource.com/79964
Commit-Queue: Qingsi Wang <qingsi@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23572}
This commit is contained in:
Qingsi Wang
2018-06-11 20:15:46 -07:00
committed by Commit Bot
parent 6c789e08d5
commit 7685e86fa6
10 changed files with 298 additions and 25 deletions

View File

@ -232,6 +232,23 @@ rtc_static_library("rtc_event_log_impl_base") {
}
}
rtc_source_set("fake_rtc_event_log") {
testonly = true
sources = [
"rtc_event_log/fake_rtc_event_log.cc",
"rtc_event_log/fake_rtc_event_log.h",
"rtc_event_log/fake_rtc_event_log_factory.cc",
"rtc_event_log/fake_rtc_event_log_factory.h",
]
deps = [
":ice_log",
":rtc_event_log_api",
"../rtc_base:checks",
"../rtc_base:rtc_base",
]
}
if (rtc_enable_protobuf) {
proto_library("rtc_event_log_proto") {
sources = [

View File

@ -0,0 +1,41 @@
/*
* 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 "logging/rtc_event_log/fake_rtc_event_log.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
#include "rtc_base/bind.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
namespace webrtc {
FakeRtcEventLog::FakeRtcEventLog(rtc::Thread* thread) : thread_(thread) {
RTC_DCHECK(thread_);
}
FakeRtcEventLog::~FakeRtcEventLog() = default;
bool FakeRtcEventLog::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) {
return true;
}
void FakeRtcEventLog::StopLogging() {
invoker_.Flush(thread_);
}
void FakeRtcEventLog::Log(std::unique_ptr<RtcEvent> event) {
RtcEvent::Type rtc_event_type = event->GetType();
invoker_.AsyncInvoke<void>(
RTC_FROM_HERE, thread_,
rtc::Bind(&FakeRtcEventLog::IncrementEventCount, this, rtc_event_type));
}
} // namespace webrtc

View File

@ -0,0 +1,43 @@
/*
* 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.
*/
#ifndef LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_
#define LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_
#include <map>
#include <memory>
#include "logging/rtc_event_log/events/rtc_event.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "rtc_base/asyncinvoker.h"
#include "rtc_base/thread.h"
namespace webrtc {
class FakeRtcEventLog : public RtcEventLog {
public:
explicit FakeRtcEventLog(rtc::Thread* thread);
~FakeRtcEventLog() override;
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) override;
void StopLogging() override;
void Log(std::unique_ptr<RtcEvent> event) override;
int GetEventCount(RtcEvent::Type event_type) { return count_[event_type]; }
private:
void IncrementEventCount(RtcEvent::Type event_type) { ++count_[event_type]; }
std::map<RtcEvent::Type, int> count_;
rtc::Thread* thread_;
rtc::AsyncInvoker invoker_;
};
} // namespace webrtc
#endif // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_

View File

@ -0,0 +1,34 @@
/*
* Copyright 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 "logging/rtc_event_log/fake_rtc_event_log_factory.h"
#include <utility>
#include "logging/rtc_event_log/rtc_event_log.h"
namespace webrtc {
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) {
std::unique_ptr<RtcEventLog> fake_event_log(new FakeRtcEventLog(thread()));
last_log_created_ = fake_event_log.get();
return fake_event_log;
}
std::unique_ptr<RtcEventLog> FakeRtcEventLogFactory::CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) {
std::unique_ptr<RtcEventLog> fake_event_log(new FakeRtcEventLog(thread()));
last_log_created_ = fake_event_log.get();
return fake_event_log;
}
} // namespace webrtc

View File

@ -0,0 +1,44 @@
/*
* Copyright 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.
*/
#ifndef LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_FACTORY_H_
#define LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_FACTORY_H_
#include <memory>
#include "logging/rtc_event_log/fake_rtc_event_log.h"
#include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
#include "rtc_base/thread.h"
namespace webrtc {
class FakeRtcEventLogFactory : public RtcEventLogFactoryInterface {
public:
explicit FakeRtcEventLogFactory(rtc::Thread* thread) : thread_(thread) {}
~FakeRtcEventLogFactory() override {}
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type) override;
std::unique_ptr<RtcEventLog> CreateRtcEventLog(
RtcEventLog::EncodingType encoding_type,
std::unique_ptr<rtc::TaskQueue> task_queue) override;
webrtc::RtcEventLog* last_log_created() { return last_log_created_; }
rtc::Thread* thread() { return thread_; }
private:
webrtc::RtcEventLog* last_log_created_;
rtc::Thread* thread_;
};
} // namespace webrtc
#endif // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_FACTORY_H_