Remove encoding code from RtcEventLogImpl and use RtcEventLogEncoder instead

RtcEventLogImpl no longer hard-codes the way encoding is done. It now relies on RtcEventEncoder for it. This gives two benefits:
1. We can decide between the current encoding and the new encoding (which is still WIP) without code duplication (no need for RtcEventLogImplNew).
2. Encoding is done only when the event needs to be written to a file. This both avoids unnecessary encoding of events which don't end up getting written to a file, as well as is useful for the new, delta-based encoding, which is stateful.

BUG=webrtc:8111

Change-Id: I9517132e5f96b8059002a66fde8d42d3a678c3bb
Reviewed-on: https://webrtc-review.googlesource.com/1365
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Commit-Queue: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20118}
This commit is contained in:
Elad Alon
2017-10-03 16:11:34 +02:00
parent 45a0b36d3f
commit 4a87e1c211
27 changed files with 511 additions and 592 deletions

View File

@ -11,12 +11,29 @@
#include <algorithm>
#include <vector>
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
#include "logging/rtc_event_log/mock/mock_rtc_event_log.h"
#include "modules/bitrate_controller/send_side_bandwidth_estimation.h"
#include "test/gtest.h"
namespace webrtc {
MATCHER(LossBasedBweUpdateWithBitrateOnly, "") {
if (arg->GetType() != RtcEvent::Type::BweUpdateLossBased) {
return false;
}
auto bwe_event = static_cast<RtcEventBweUpdateLossBased*>(arg);
return bwe_event->bitrate_bps_ > 0 && bwe_event->fraction_loss_ == 0;
}
MATCHER(LossBasedBweUpdateWithBitrateAndLossFraction, "") {
if (arg->GetType() != RtcEvent::Type::BweUpdateLossBased) {
return false;
}
auto bwe_event = static_cast<RtcEventBweUpdateLossBased*>(arg);
return bwe_event->bitrate_bps_ > 0 && bwe_event->fraction_loss_ > 0;
}
void TestProbing(bool use_delay_based) {
MockRtcEventLog event_log;
SendSideBandwidthEstimation bwe(&event_log);
@ -65,9 +82,10 @@ TEST(SendSideBweTest, InitialDelayBasedBweWithProbing) {
TEST(SendSideBweTest, DoesntReapplyBitrateDecreaseWithoutFollowingRemb) {
MockRtcEventLog event_log;
EXPECT_CALL(event_log, LogLossBasedBweUpdate(testing::Gt(0), 0, 0)).Times(1);
EXPECT_CALL(event_log, LogProxy(LossBasedBweUpdateWithBitrateOnly()))
.Times(1);
EXPECT_CALL(event_log,
LogLossBasedBweUpdate(testing::Gt(0), testing::Gt(0), 0))
LogProxy(LossBasedBweUpdateWithBitrateAndLossFraction()))
.Times(2);
SendSideBandwidthEstimation bwe(&event_log);
static const int kMinBitrateBps = 100000;