Create RtcEventLogEncoderLegacy

We're moving to an RtcEventLog interface that accepts std::unique_ptr<EventLog> and stores the event for encoding when encoding becomes necessary, rather than before. This will be useful while we maintain the legacy (current) encoding alongside the new encoding on which we're working.

This CL introduces RtcEventLogEncoderLegacy, which takes provides the encoding currently done by RtcEventLogImpl. After this, we can modify RtcEventLogImpl to use a dynamically chosen encoding, allowing us to easily choose between the current encoding and the new one on which we're working.

BUG=webrtc:8111
TBR=stefan@webrtc.org

Change-Id: I3dde7e222a40a117549a094a59b04219467f490a
Reviewed-on: https://webrtc-review.googlesource.com/1364
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@{#20116}
This commit is contained in:
Elad Alon
2017-10-03 15:01:03 +02:00
parent 729b9109ca
commit 1d87b0e40f
21 changed files with 1323 additions and 38 deletions

View File

@ -14,12 +14,21 @@ namespace webrtc {
AudioEncoderRuntimeConfig::AudioEncoderRuntimeConfig() = default;
AudioEncoderRuntimeConfig::~AudioEncoderRuntimeConfig() = default;
AudioEncoderRuntimeConfig::AudioEncoderRuntimeConfig(
const AudioEncoderRuntimeConfig& other) = default;
AudioEncoderRuntimeConfig::~AudioEncoderRuntimeConfig() = default;
AudioEncoderRuntimeConfig& AudioEncoderRuntimeConfig::operator=(
const AudioEncoderRuntimeConfig& other) = default;
bool AudioEncoderRuntimeConfig::operator==(
const AudioEncoderRuntimeConfig& other) const {
return bitrate_bps == other.bitrate_bps &&
frame_length_ms == other.frame_length_ms &&
uplink_packet_loss_fraction == other.uplink_packet_loss_fraction &&
enable_fec == other.enable_fec && enable_dtx == other.enable_dtx &&
num_channels == other.num_channels;
}
} // namespace webrtc

View File

@ -18,8 +18,12 @@ namespace webrtc {
struct AudioEncoderRuntimeConfig {
AudioEncoderRuntimeConfig();
AudioEncoderRuntimeConfig(const AudioEncoderRuntimeConfig& other);
AudioEncoderRuntimeConfig& operator=(const AudioEncoderRuntimeConfig& other);
~AudioEncoderRuntimeConfig();
AudioEncoderRuntimeConfig& operator=(const AudioEncoderRuntimeConfig& other);
bool operator==(const AudioEncoderRuntimeConfig& other) const;
rtc::Optional<int> bitrate_bps;
rtc::Optional<int> frame_length_ms;
// Note: This is what we tell the encoder. It doesn't have to reflect

View File

@ -47,7 +47,7 @@ std::unique_ptr<Packet> RtcEventLogSource::NextPacket() {
size_t packet_length;
uint64_t timestamp_us = parsed_stream_.GetTimestamp(rtp_packet_index_);
parsed_stream_.GetRtpHeader(rtp_packet_index_, &direction, nullptr,
&header_length, &packet_length);
&header_length, &packet_length, nullptr);
if (direction != kIncomingPacket) {
continue;
@ -55,7 +55,7 @@ std::unique_ptr<Packet> RtcEventLogSource::NextPacket() {
uint8_t* packet_header = new uint8_t[header_length];
parsed_stream_.GetRtpHeader(rtp_packet_index_, nullptr, packet_header,
nullptr, nullptr);
nullptr, nullptr, nullptr);
std::unique_ptr<Packet> packet(
new Packet(packet_header, header_length, packet_length,
static_cast<double>(timestamp_us) / 1000, *parser_.get()));