Create and use RtcEventLogOutput for output
We need to support two modes of writing to the output: 1. Current way - the application lets lets WebRTC know which file to write to, and WebRTC is then in charge of the writing. 2. New way - the application would receive indications from WebRTC about (encoded) RTC events, and would itself be in charge of processing them (be it writing it to a file, uploading it somewhere, etc.). We achieve this by creating an interface for output - RtcEventLogOutput. By providing an instance of the subclass, RtcEventLogOutputFile, the old behavior is achieved. The subclass of the new behavior is to be added by a later CL. TBR=stefan@webrtc.org Bug: webrtc:8111 Change-Id: I9c50521a7f7144d86d8353a65995795862e19c44 Reviewed-on: https://webrtc-review.googlesource.com/2686 Commit-Queue: Elad Alon <eladalon@webrtc.org> Reviewed-by: Elad Alon <eladalon@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20135}
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
|
||||
#include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_parser.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log_unittest_helper.h"
|
||||
@ -430,7 +431,8 @@ void RtcEventLogSessionDescription::WriteSession() {
|
||||
for (size_t i = 0; i < event_types.size(); i++) {
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
if (i == event_types.size() / 2)
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
switch (event_types[i]) {
|
||||
case EventType::kIncomingRtp:
|
||||
RTC_CHECK(incoming_rtp_written < incoming_rtp_packets.size());
|
||||
@ -739,7 +741,8 @@ TEST(RtcEventLogTest, LogEventAndReadBack) {
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventRtpPacketIncoming>(rtp_packet));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventRtcpPacketOutgoing>(rtcp_packet));
|
||||
@ -787,7 +790,8 @@ TEST(RtcEventLogTest, LogLossBasedBweUpdateAndReadBack) {
|
||||
fake_clock.SetTimeMicros(prng.Rand<uint32_t>());
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventBweUpdateLossBased>(
|
||||
bitrate, fraction_lost, total_packets));
|
||||
@ -829,7 +833,8 @@ TEST(RtcEventLogTest, LogDelayBasedBweUpdateAndReadBack) {
|
||||
fake_clock.SetTimeMicros(prng.Rand<uint32_t>());
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventBweUpdateDelayBased>(
|
||||
bitrate1, BandwidthUsage::kBwNormal));
|
||||
@ -886,7 +891,8 @@ TEST(RtcEventLogTest, LogProbeClusterCreatedAndReadBack) {
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventProbeClusterCreated>(
|
||||
0, bitrate_bps0, min_probes0, min_bytes0));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
@ -936,7 +942,8 @@ TEST(RtcEventLogTest, LogProbeResultSuccessAndReadBack) {
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventProbeResultSuccess>(0, bitrate_bps0));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventProbeResultSuccess>(1, bitrate_bps1));
|
||||
@ -979,7 +986,8 @@ TEST(RtcEventLogTest, LogProbeResultFailureAndReadBack) {
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
log_dumper->Log(rtc::MakeUnique<RtcEventProbeResultFailure>(
|
||||
0, ProbeFailureReason::kInvalidSendReceiveInterval));
|
||||
fake_clock.AdvanceTimeMicros(prng.Rand(1, 1000));
|
||||
@ -1040,7 +1048,8 @@ class ConfigReadWriteTest {
|
||||
std::unique_ptr<RtcEventLog> log_dumper(
|
||||
RtcEventLog::Create(RtcEventLog::EncodingType::Legacy));
|
||||
|
||||
log_dumper->StartLogging(temp_filename, 10000000);
|
||||
log_dumper->StartLogging(
|
||||
rtc::MakeUnique<RtcEventLogOutputFile>(temp_filename, 10000000));
|
||||
LogConfig(log_dumper.get());
|
||||
log_dumper->StopLogging();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user