Revert "Reland "Add plumbing of RtpPacketInfos to each AudioFrame as input for SourceTracker.""
This reverts commit 9973933d2e606d64fcdc753acb9ba3afd6e30569.
Reason for revert: breaking downstream projects and not reviewed by direct owners
Original change's description:
> Reland "Add plumbing of RtpPacketInfos to each AudioFrame as input for SourceTracker."
>
> This reverts commit 24192c267a40eb7d6b1850489ccdbf7a84f8ff0f.
>
> Reason for revert: Analyzed the performance regression in more detail.
>
> Most of the regression comes from the extra RtpPacketInfos-related memory allocations in every `NetEq::GetAudio()` call. Commit 1796a820f60cb9429bf4bcf13a40a41794ac8fb0 has removed roughly 2/3rds of the extra allocations from the impacted perf tests. Remaining perf impact is expected to be about "8 microseconds of CPU time per second" on the Linux benchmarking machines and "15 us per second" on Windows/Mac.
>
> There are options to optimize further but they are unlikely worth doing. Note for example that `NetEqPerformanceTest` uses the PCM codec while the real-world use cases would likely use the much heavier Opus codec. The numbers from `OpusSpeedTest` and `NetEqPerformanceTest` suggest that Opus decoding is about 10x as expensive as NetEq overall.
>
> Original change's description:
> > Revert "Add plumbing of RtpPacketInfos to each AudioFrame as input for SourceTracker."
> >
> > This reverts commit 3e8ef940fe86cf6285afb80e68d2a0bedc631b9f.
> >
> > Reason for revert: This CL causes a performance regression in NetEq, see https://bugs.chromium.org/p/chromium/issues/detail?id=982260.
> >
> > Original change's description:
> > > Add plumbing of RtpPacketInfos to each AudioFrame as input for SourceTracker.
> > >
> > > This change adds the plumbing of RtpPacketInfo from ChannelReceive::OnRtpPacket() to ChannelReceive::GetAudioFrameWithInfo() for audio. It is a step towards replacing the non-spec compliant ContributingSources that updates itself at packet-receive time, with the spec-compliant SourceTracker that will update itself at frame-delivery-to-track time.
> > >
> > > Bug: webrtc:10668
> > > Change-Id: I03385d6865bbc7bfbef7634f88de820a934f787a
> > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139890
> > > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > > Reviewed-by: Minyue Li <minyue@webrtc.org>
> > > Commit-Queue: Chen Xing <chxg@google.com>
> > > Cr-Commit-Position: refs/heads/master@{#28434}
> >
> > TBR=kwiberg@webrtc.org,stefan@webrtc.org,minyue@webrtc.org,chxg@google.com
> >
> > Bug: webrtc:10668, chromium:982260
> > Change-Id: I5e2cfde78c59d1123e21869564d76ed3f6193a5c
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/145339
> > Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> > Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#28561}
>
> TBR=kwiberg@webrtc.org,stefan@webrtc.org,ivoc@webrtc.org,minyue@webrtc.org,chxg@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: webrtc:10668, chromium:982260
> Change-Id: Ie375a0b327ee368317bf3a04b2f1415c3a974470
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146707
> Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> Commit-Queue: Chen Xing <chxg@google.com>
> Cr-Commit-Position: refs/heads/master@{#28664}
TBR=kwiberg@webrtc.org,stefan@webrtc.org,ivoc@webrtc.org,minyue@webrtc.org,chxg@google.com
Change-Id: I652cb0814d83b514d3bee34e65ca3bb693099b22
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10668, chromium:982260
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146712
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28671}
diff --git a/api/audio/BUILD.gn b/api/audio/BUILD.gn
index deff5b7..446d8ab 100644
--- a/api/audio/BUILD.gn
+++ b/api/audio/BUILD.gn
@@ -18,7 +18,6 @@
]
deps = [
- "..:rtp_packet_info",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
]
diff --git a/api/audio/audio_frame.cc b/api/audio/audio_frame.cc
index d9212a2..0b3a2b6 100644
--- a/api/audio/audio_frame.cc
+++ b/api/audio/audio_frame.cc
@@ -40,7 +40,6 @@
speech_type_ = kUndefined;
vad_activity_ = kVadUnknown;
profile_timestamp_ms_ = 0;
- packet_infos_ = RtpPacketInfos();
}
void AudioFrame::UpdateFrame(uint32_t timestamp,
@@ -78,7 +77,6 @@
timestamp_ = src.timestamp_;
elapsed_time_ms_ = src.elapsed_time_ms_;
ntp_time_ms_ = src.ntp_time_ms_;
- packet_infos_ = src.packet_infos_;
muted_ = src.muted();
samples_per_channel_ = src.samples_per_channel_;
sample_rate_hz_ = src.sample_rate_hz_;
diff --git a/api/audio/audio_frame.h b/api/audio/audio_frame.h
index 7660e75..a141f6e 100644
--- a/api/audio/audio_frame.h
+++ b/api/audio/audio_frame.h
@@ -15,7 +15,6 @@
#include <stdint.h>
#include "api/audio/channel_layout.h"
-#include "api/rtp_packet_infos.h"
#include "rtc_base/constructor_magic.h"
namespace webrtc {
@@ -124,22 +123,6 @@
// class/struct needs an explicit out-of-line destructor" build error.
int64_t profile_timestamp_ms_ = 0;
- // Information about packets used to assemble this audio frame. This is needed
- // by |SourceTracker| when the frame is delivered to the RTCRtpReceiver's
- // MediaStreamTrack, in order to implement getContributingSources(). See:
- // https://w3c.github.io/webrtc-pc/#dom-rtcrtpreceiver-getcontributingsources
- //
- // TODO(bugs.webrtc.org/10757):
- // Note that this information might not be fully accurate since we currently
- // don't have a proper way to track it across the audio sync buffer. The
- // sync buffer is the small sample-holding buffer located after the audio
- // decoder and before where samples are assembled into output frames.
- //
- // |RtpPacketInfos| may also be empty if the audio samples did not come from
- // RTP packets. E.g. if the audio were locally generated by packet loss
- // concealment, comfort noise generation, etc.
- RtpPacketInfos packet_infos_;
-
private:
// A permanently zeroed out buffer to represent muted frames. This is a
// header-only class, so the only way to avoid creating a separate empty
diff --git a/audio/remix_resample.cc b/audio/remix_resample.cc
index 3694d34..e77c386 100644
--- a/audio/remix_resample.cc
+++ b/audio/remix_resample.cc
@@ -27,7 +27,6 @@
dst_frame->timestamp_ = src_frame.timestamp_;
dst_frame->elapsed_time_ms_ = src_frame.elapsed_time_ms_;
dst_frame->ntp_time_ms_ = src_frame.ntp_time_ms_;
- dst_frame->packet_infos_ = src_frame.packet_infos_;
}
void RemixAndResample(const int16_t* src_data,
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index b796ab0..6cc9dc5 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -1017,7 +1017,6 @@
"..:module_api_public",
"../../api:array_view",
"../../api:rtp_headers",
- "../../api:rtp_packet_info",
"../../api:scoped_refptr",
"../../api/audio:audio_frame_api",
"../../api/audio_codecs:audio_codecs_api",
@@ -1031,7 +1030,6 @@
"../../rtc_base:sanitizer",
"../../rtc_base/experiments:field_trial_parser",
"../../rtc_base/system:fallthrough",
- "../../system_wrappers",
"../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/memory",
@@ -1069,7 +1067,6 @@
"../../api/audio_codecs:audio_codecs_api",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
- "../../system_wrappers",
"../rtp_rtcp",
"../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/types:optional",
@@ -1596,7 +1593,6 @@
":neteq_test_tools",
"../../api/audio_codecs:builtin_audio_decoder_factory",
"../../rtc_base:checks",
- "../../system_wrappers",
"../../test:fileutils",
"../../test:test_support",
"//testing/gtest",
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index 6de45e7..ce480ae 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -35,9 +35,7 @@
AcmReceiver::AcmReceiver(const AudioCodingModule::Config& config)
: last_audio_buffer_(new int16_t[AudioFrame::kMaxDataSizeSamples]),
- neteq_(NetEq::Create(config.neteq_config,
- config.clock,
- config.decoder_factory)),
+ neteq_(NetEq::Create(config.neteq_config, config.decoder_factory)),
clock_(config.clock),
resampled_last_output_frame_(true) {
RTC_DCHECK(clock_);
diff --git a/modules/audio_coding/neteq/include/neteq.h b/modules/audio_coding/neteq/include/neteq.h
index ef144e6..d91850f 100644
--- a/modules/audio_coding/neteq/include/neteq.h
+++ b/modules/audio_coding/neteq/include/neteq.h
@@ -31,7 +31,6 @@
// Forward declarations.
class AudioFrame;
class AudioDecoderFactory;
-class Clock;
struct NetEqNetworkStatistics {
uint16_t current_buffer_size_ms; // Current jitter buffer size in ms.
@@ -150,7 +149,6 @@
// method.
static NetEq* Create(
const NetEq::Config& config,
- Clock* clock,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
virtual ~NetEq() {}
diff --git a/modules/audio_coding/neteq/neteq.cc b/modules/audio_coding/neteq/neteq.cc
index 0a36cb2..a84c942 100644
--- a/modules/audio_coding/neteq/neteq.cc
+++ b/modules/audio_coding/neteq/neteq.cc
@@ -39,10 +39,9 @@
// Return the new object.
NetEq* NetEq::Create(
const NetEq::Config& config,
- Clock* clock,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
return new NetEqImpl(config,
- NetEqImpl::Dependencies(config, clock, decoder_factory));
+ NetEqImpl::Dependencies(config, decoder_factory));
}
} // namespace webrtc
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 8ef08ce..9ad2e9e 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -16,7 +16,6 @@
#include <cstdint>
#include <cstring>
#include <list>
-#include <map>
#include <utility>
#include <vector>
@@ -54,16 +53,13 @@
#include "rtc_base/sanitizer.h"
#include "rtc_base/strings/audio_format_to_string.h"
#include "rtc_base/trace_event.h"
-#include "system_wrappers/include/clock.h"
namespace webrtc {
NetEqImpl::Dependencies::Dependencies(
const NetEq::Config& config,
- Clock* clock,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)
- : clock(clock),
- tick_timer(new TickTimer),
+ : tick_timer(new TickTimer),
stats(new StatisticsCalculator),
buffer_level_filter(new BufferLevelFilter),
decoder_database(
@@ -91,8 +87,7 @@
NetEqImpl::NetEqImpl(const NetEq::Config& config,
Dependencies&& deps,
bool create_components)
- : clock_(deps.clock),
- tick_timer_(std::move(deps.tick_timer)),
+ : tick_timer_(std::move(deps.tick_timer)),
buffer_level_filter_(std::move(deps.buffer_level_filter)),
decoder_database_(std::move(deps.decoder_database)),
delay_manager_(std::move(deps.delay_manager)),
@@ -474,20 +469,17 @@
RTC_LOG_F(LS_ERROR) << "payload is empty";
return kInvalidPointer;
}
-
- int64_t receive_time_ms = clock_->TimeInMilliseconds();
stats_->ReceivedPacket();
PacketList packet_list;
// Insert packet in a packet list.
- packet_list.push_back([&rtp_header, &payload, &receive_time_ms] {
+ packet_list.push_back([&rtp_header, &payload] {
// Convert to Packet.
Packet packet;
packet.payload_type = rtp_header.payloadType;
packet.sequence_number = rtp_header.sequenceNumber;
packet.timestamp = rtp_header.timestamp;
packet.payload.SetData(payload.data(), payload.size());
- packet.packet_info = RtpPacketInfo(rtp_header, receive_time_ms);
// Waiting time will be set upon inserting the packet in the buffer.
RTC_DCHECK(!packet.waiting_time);
return packet;
@@ -620,7 +612,6 @@
const auto sequence_number = packet.sequence_number;
const auto payload_type = packet.payload_type;
const Packet::Priority original_priority = packet.priority;
- const auto& packet_info = packet.packet_info;
auto packet_from_result = [&](AudioDecoder::ParseResult& result) {
Packet new_packet;
new_packet.sequence_number = sequence_number;
@@ -628,7 +619,6 @@
new_packet.timestamp = result.timestamp;
new_packet.priority.codec_level = result.priority;
new_packet.priority.red_level = original_priority.red_level;
- new_packet.packet_info = packet_info;
new_packet.frame = std::move(result.frame);
return new_packet;
};
@@ -765,7 +755,6 @@
bool play_dtmf;
*muted = false;
last_decoded_timestamps_.clear();
- last_decoded_packet_infos_.clear();
tick_timer_->Increment();
stats_->IncreaseCounter(output_size_samples_, fs_hz_);
const auto lifetime_stats = stats_->GetLifetimeStatistics();
@@ -891,16 +880,7 @@
comfort_noise_->Reset();
}
- // We treat it as if all packets referenced to by |last_decoded_packet_infos_|
- // were mashed together when creating the samples in |algorithm_buffer_|.
- RtpPacketInfos packet_infos(std::move(last_decoded_packet_infos_));
- last_decoded_packet_infos_.clear();
-
- // Copy samples from |algorithm_buffer_| to |sync_buffer_|.
- //
- // TODO(bugs.webrtc.org/10757):
- // We would in the future also like to pass |packet_infos| so that we can do
- // sample-perfect tracking of that information across |sync_buffer_|.
+ // Copy from |algorithm_buffer| to |sync_buffer_|.
sync_buffer_->PushBack(*algorithm_buffer_);
// Extract data from |sync_buffer_| to |output|.
@@ -918,13 +898,6 @@
sync_buffer_->GetNextAudioInterleaved(num_output_samples_per_channel,
audio_frame);
audio_frame->sample_rate_hz_ = fs_hz_;
- // TODO(bugs.webrtc.org/10757):
- // We don't have the ability to properly track individual packets once their
- // audio samples have entered |sync_buffer_|. So for now, treat it as if
- // |packet_infos| from packets decoded by the current |GetAudioInternal()|
- // call were all consumed assembling the current audio frame and the current
- // audio frame only.
- audio_frame->packet_infos_ = std::move(packet_infos);
if (sync_buffer_->FutureLength() < expand_->overlap_length()) {
// The sync buffer should always contain |overlap_length| samples, but now
// too many samples have been extracted. Reinstall the |overlap_length|
@@ -1420,7 +1393,6 @@
int* decoded_length,
AudioDecoder::SpeechType* speech_type) {
RTC_DCHECK(last_decoded_timestamps_.empty());
- RTC_DCHECK(last_decoded_packet_infos_.empty());
// Do decoding.
while (!packet_list->empty() && !decoder_database_->IsComfortNoise(
@@ -1438,8 +1410,6 @@
rtc::ArrayView<int16_t>(&decoded_buffer_[*decoded_length],
decoded_buffer_length_ - *decoded_length));
last_decoded_timestamps_.push_back(packet_list->front().timestamp);
- last_decoded_packet_infos_.push_back(
- std::move(packet_list->front().packet_info));
packet_list->pop_front();
if (opt_result) {
const auto& result = *opt_result;
@@ -1455,7 +1425,6 @@
// TODO(ossu): What to put here?
RTC_LOG(LS_WARNING) << "Decode error";
*decoded_length = -1;
- last_decoded_packet_infos_.clear();
packet_list->clear();
break;
}
diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h
index 9e1af10..39a4df6 100644
--- a/modules/audio_coding/neteq/neteq_impl.h
+++ b/modules/audio_coding/neteq/neteq_impl.h
@@ -11,15 +11,11 @@
#ifndef MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_
#define MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_
-#include <map>
#include <memory>
#include <string>
-#include <utility>
-#include <vector>
#include "absl/types/optional.h"
#include "api/audio/audio_frame.h"
-#include "api/rtp_packet_info.h"
#include "modules/audio_coding/neteq/audio_multi_vector.h"
#include "modules/audio_coding/neteq/defines.h" // Modes, Operations
#include "modules/audio_coding/neteq/expand_uma_logger.h"
@@ -38,7 +34,6 @@
class Accelerate;
class BackgroundNoise;
class BufferLevelFilter;
-class Clock;
class ComfortNoise;
class DecisionLogic;
class DecoderDatabase;
@@ -92,13 +87,11 @@
// before sending the struct to the NetEqImpl constructor. However, there
// are dependencies between some of the classes inside the struct, so
// swapping out one may make it necessary to re-create another one.
- Dependencies(
+ explicit Dependencies(
const NetEq::Config& config,
- Clock* clock,
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
~Dependencies();
- Clock* const clock;
std::unique_ptr<TickTimer> tick_timer;
std::unique_ptr<StatisticsCalculator> stats;
std::unique_ptr<BufferLevelFilter> buffer_level_filter;
@@ -339,8 +332,6 @@
// Creates DecisionLogic object with the mode given by |playout_mode_|.
virtual void CreateDecisionLogic() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
- Clock* const clock_;
-
rtc::CriticalSection crit_sect_;
const std::unique_ptr<TickTimer> tick_timer_ RTC_GUARDED_BY(crit_sect_);
const std::unique_ptr<BufferLevelFilter> buffer_level_filter_
@@ -406,8 +397,6 @@
std::unique_ptr<TickTimer::Stopwatch> generated_noise_stopwatch_
RTC_GUARDED_BY(crit_sect_);
std::vector<uint32_t> last_decoded_timestamps_ RTC_GUARDED_BY(crit_sect_);
- std::vector<RtpPacketInfo> last_decoded_packet_infos_
- RTC_GUARDED_BY(crit_sect_);
ExpandUmaLogger expand_uma_logger_ RTC_GUARDED_BY(crit_sect_);
ExpandUmaLogger speech_expand_uma_logger_ RTC_GUARDED_BY(crit_sect_);
bool no_time_stretching_ RTC_GUARDED_BY(crit_sect_); // Only used for test.
diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc
index ded54bf..517f4ac 100644
--- a/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -11,8 +11,6 @@
#include "modules/audio_coding/neteq/neteq_impl.h"
#include <memory>
-#include <utility>
-#include <vector>
#include "absl/memory/memory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
@@ -33,7 +31,6 @@
#include "modules/audio_coding/neteq/sync_buffer.h"
#include "modules/audio_coding/neteq/timestamp_scaler.h"
#include "rtc_base/numerics/safe_conversions.h"
-#include "system_wrappers/include/clock.h"
#include "test/audio_decoder_proxy_factory.h"
#include "test/function_audio_decoder_factory.h"
#include "test/gmock.h"
@@ -44,17 +41,14 @@
using ::testing::_;
using ::testing::AtLeast;
using ::testing::DoAll;
-using ::testing::ElementsAre;
using ::testing::InSequence;
using ::testing::Invoke;
-using ::testing::IsEmpty;
using ::testing::IsNull;
using ::testing::Pointee;
using ::testing::Return;
using ::testing::ReturnNull;
using ::testing::SetArgPointee;
using ::testing::SetArrayArgument;
-using ::testing::SizeIs;
using ::testing::WithArg;
namespace webrtc {
@@ -69,12 +63,12 @@
class NetEqImplTest : public ::testing::Test {
protected:
- NetEqImplTest() : clock_(0) { config_.sample_rate_hz = 8000; }
+ NetEqImplTest() { config_.sample_rate_hz = 8000; }
void CreateInstance(
const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
ASSERT_TRUE(decoder_factory);
- NetEqImpl::Dependencies deps(config_, &clock_, decoder_factory);
+ NetEqImpl::Dependencies deps(config_, decoder_factory);
// Get a local pointer to NetEq's TickTimer object.
tick_timer_ = deps.tick_timer.get();
@@ -224,10 +218,6 @@
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- // DTMF packets are immediately consumed by |InsertPacket()| and won't be
- // returned by |GetAudio()|.
- EXPECT_THAT(output.packet_infos_, IsEmpty());
-
// Verify first 64 samples of actual output.
const std::vector<int16_t> kOutput(
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -243,7 +233,6 @@
std::unique_ptr<NetEqImpl> neteq_;
NetEq::Config config_;
- SimulatedClock clock_;
TickTimer* tick_timer_ = nullptr;
MockBufferLevelFilter* mock_buffer_level_filter_ = nullptr;
BufferLevelFilter* buffer_level_filter_ = nullptr;
@@ -275,9 +264,7 @@
// TODO(hlundin): Move to separate file?
TEST(NetEq, CreateAndDestroy) {
NetEq::Config config;
- SimulatedClock clock(0);
- NetEq* neteq =
- NetEq::Create(config, &clock, CreateBuiltinAudioDecoderFactory());
+ NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory());
delete neteq;
}
@@ -469,10 +456,6 @@
rtp_header.sequenceNumber = 0x1234;
rtp_header.timestamp = 0x12345678;
rtp_header.ssrc = 0x87654321;
- rtp_header.numCSRCs = 3;
- rtp_header.arrOfCSRCs[0] = 43;
- rtp_header.arrOfCSRCs[1] = 65;
- rtp_header.arrOfCSRCs[2] = 17;
// This is a dummy decoder that produces as many output samples as the input
// has bytes. The output is an increasing series, starting at 1 for the first
@@ -516,8 +499,6 @@
SdpAudioFormat("L16", 8000, 1)));
// Insert one packet.
- clock_.AdvanceTimeMilliseconds(123456);
- int64_t expected_receive_time_ms = clock_.TimeInMilliseconds();
EXPECT_EQ(NetEq::kOK,
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
@@ -531,17 +512,6 @@
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- // Verify |output.packet_infos_|.
- ASSERT_THAT(output.packet_infos_, SizeIs(1));
- {
- const auto& packet_info = output.packet_infos_[0];
- EXPECT_EQ(packet_info.ssrc(), rtp_header.ssrc);
- EXPECT_THAT(packet_info.csrcs(), ElementsAre(43, 65, 17));
- EXPECT_EQ(packet_info.rtp_timestamp(), rtp_header.timestamp);
- EXPECT_FALSE(packet_info.audio_level().has_value());
- EXPECT_EQ(packet_info.receive_time_ms(), expected_receive_time_ms);
- }
-
// Start with a simple check that the fake decoder is behaving as expected.
EXPECT_EQ(kPayloadLengthSamples,
static_cast<size_t>(decoder_.next_value() - 1));
@@ -589,8 +559,6 @@
rtp_header.sequenceNumber = 0x1234;
rtp_header.timestamp = 0x12345678;
rtp_header.ssrc = 0x87654321;
- rtp_header.extension.hasAudioLevel = true;
- rtp_header.extension.audioLevel = 42;
EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return());
EXPECT_CALL(mock_decoder, SampleRateHz())
@@ -613,8 +581,6 @@
SdpAudioFormat("L16", 8000, 1)));
// Insert one packet.
- clock_.AdvanceTimeMilliseconds(123456);
- int64_t expected_receive_time_ms = clock_.TimeInMilliseconds();
EXPECT_EQ(NetEq::kOK,
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
@@ -627,32 +593,16 @@
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- // Verify |output.packet_infos_|.
- ASSERT_THAT(output.packet_infos_, SizeIs(1));
- {
- const auto& packet_info = output.packet_infos_[0];
- EXPECT_EQ(packet_info.ssrc(), rtp_header.ssrc);
- EXPECT_THAT(packet_info.csrcs(), IsEmpty());
- EXPECT_EQ(packet_info.rtp_timestamp(), rtp_header.timestamp);
- EXPECT_EQ(packet_info.audio_level(), rtp_header.extension.audioLevel);
- EXPECT_EQ(packet_info.receive_time_ms(), expected_receive_time_ms);
- }
-
// Insert two more packets. The first one is out of order, and is already too
// old, the second one is the expected next packet.
rtp_header.sequenceNumber -= 1;
rtp_header.timestamp -= kPayloadLengthSamples;
- rtp_header.extension.audioLevel = 1;
payload[0] = 1;
- clock_.AdvanceTimeMilliseconds(1000);
EXPECT_EQ(NetEq::kOK,
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
rtp_header.sequenceNumber += 2;
rtp_header.timestamp += 2 * kPayloadLengthSamples;
- rtp_header.extension.audioLevel = 2;
payload[0] = 2;
- clock_.AdvanceTimeMilliseconds(2000);
- expected_receive_time_ms = clock_.TimeInMilliseconds();
EXPECT_EQ(NetEq::kOK,
neteq_->InsertPacket(rtp_header, payload, kReceiveTime));
@@ -675,17 +625,6 @@
// out-of-order packet should have been discarded.
EXPECT_TRUE(packet_buffer_->Empty());
- // Verify |output.packet_infos_|. Expect to only see the second packet.
- ASSERT_THAT(output.packet_infos_, SizeIs(1));
- {
- const auto& packet_info = output.packet_infos_[0];
- EXPECT_EQ(packet_info.ssrc(), rtp_header.ssrc);
- EXPECT_THAT(packet_info.csrcs(), IsEmpty());
- EXPECT_EQ(packet_info.rtp_timestamp(), rtp_header.timestamp);
- EXPECT_EQ(packet_info.audio_level(), rtp_header.extension.audioLevel);
- EXPECT_EQ(packet_info.receive_time_ms(), expected_receive_time_ms);
- }
-
EXPECT_CALL(mock_decoder, Die());
}
@@ -722,7 +661,6 @@
EXPECT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kPLC, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, IsEmpty());
// Register the payload type.
EXPECT_TRUE(neteq_->RegisterPayloadType(kPayloadType,
@@ -745,7 +683,6 @@
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_)
<< "NetEq did not decode the packets as expected.";
- EXPECT_THAT(output.packet_infos_, SizeIs(1));
}
}
@@ -783,7 +720,6 @@
EXPECT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_NE(AudioFrame::kNormalSpeech, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, IsEmpty());
}
// Insert 10 packets.
@@ -803,7 +739,6 @@
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_)
<< "NetEq did not decode the packets as expected.";
- EXPECT_THAT(output.packet_infos_, SizeIs(1));
}
auto lifetime_stats = neteq_->GetLifetimeStatistics();
@@ -1036,14 +971,12 @@
const size_t kExpectedOutputSize = 10 * (kSampleRateHz / 1000) * kChannels;
EXPECT_EQ(kExpectedOutputSize, output.samples_per_channel_ * kChannels);
EXPECT_EQ(kChannels, output.num_channels_);
- EXPECT_THAT(output.packet_infos_, IsEmpty());
// Second call to GetAudio will decode the packet that is ok. No errors are
// expected.
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
EXPECT_EQ(kExpectedOutputSize, output.samples_per_channel_ * kChannels);
EXPECT_EQ(kChannels, output.num_channels_);
- EXPECT_THAT(output.packet_infos_, SizeIs(1));
// Die isn't called through NiceMock (since it's called by the
// MockAudioDecoder constructor), so it needs to be mocked explicitly.
@@ -1145,7 +1078,6 @@
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, SizeIs(1));
EXPECT_CALL(mock_decoder, Die());
}
@@ -1240,7 +1172,6 @@
EXPECT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, SizeIs(2)); // 5 ms packets vs 10 ms output
// Pull audio again. Decoder fails.
EXPECT_EQ(NetEq::kFail, neteq_->GetAudio(&output, &muted));
@@ -1254,14 +1185,12 @@
EXPECT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kPLC, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, IsEmpty());
// Pull audio again, should behave normal.
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
EXPECT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
- EXPECT_THAT(output.packet_infos_, SizeIs(2)); // 5 ms packets vs 10 ms output
EXPECT_CALL(mock_decoder, Die());
}
@@ -1689,4 +1618,4 @@
EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test());
}
-} // namespace webrtc
+}// namespace webrtc
diff --git a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index 20e5a5a..0f3904b 100644
--- a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -16,7 +16,6 @@
#include "modules/audio_coding/neteq/include/neteq.h"
#include "modules/audio_coding/neteq/tools/rtp_generator.h"
#include "rtc_base/ref_counted_object.h"
-#include "system_wrappers/include/clock.h"
#include "test/audio_decoder_proxy_factory.h"
#include "test/gmock.h"
@@ -163,8 +162,7 @@
packet_loss_interval_(0xffffffff) {
NetEq::Config config;
config.sample_rate_hz = format.clockrate_hz;
- neteq_ = absl::WrapUnique(
- NetEq::Create(config, Clock::GetRealTimeClock(), decoder_factory_));
+ neteq_ = absl::WrapUnique(NetEq::Create(config, decoder_factory_));
neteq_->RegisterPayloadType(kPayloadType, format);
}
diff --git a/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
index 2d62f8b..d25e8d6 100644
--- a/modules/audio_coding/neteq/neteq_stereo_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_stereo_unittest.cc
@@ -22,7 +22,6 @@
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
#include "modules/audio_coding/neteq/tools/rtp_generator.h"
#include "rtc_base/strings/string_builder.h"
-#include "system_wrappers/include/clock.h"
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
@@ -58,7 +57,6 @@
frame_size_samples_(
static_cast<size_t>(frame_size_ms_ * samples_per_ms_)),
output_size_samples_(10 * samples_per_ms_),
- clock_(0),
rtp_generator_mono_(samples_per_ms_),
rtp_generator_(samples_per_ms_),
payload_size_bytes_(0),
@@ -69,8 +67,8 @@
config.sample_rate_hz = sample_rate_hz_;
rtc::scoped_refptr<AudioDecoderFactory> factory =
CreateBuiltinAudioDecoderFactory();
- neteq_mono_ = NetEq::Create(config, &clock_, factory);
- neteq_ = NetEq::Create(config, &clock_, factory);
+ neteq_mono_ = NetEq::Create(config, factory);
+ neteq_ = NetEq::Create(config, factory);
input_ = new int16_t[frame_size_samples_];
encoded_ = new uint8_t[2 * frame_size_samples_];
input_multi_channel_ = new int16_t[frame_size_samples_ * num_channels_];
@@ -198,7 +196,6 @@
ASSERT_NO_FATAL_FAILURE(VerifyOutput(output_size_samples_));
time_now += kTimeStepMs;
- clock_.AdvanceTimeMilliseconds(kTimeStepMs);
}
}
@@ -208,7 +205,6 @@
const int frame_size_ms_;
const size_t frame_size_samples_;
const size_t output_size_samples_;
- SimulatedClock clock_;
NetEq* neteq_mono_;
NetEq* neteq_;
test::RtpGenerator rtp_generator_mono_;
diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc
index f520403..7835096 100644
--- a/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_unittest.cc
@@ -37,7 +37,6 @@
#include "rtc_base/string_encode.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/system/arch.h"
-#include "system_wrappers/include/clock.h"
#include "test/field_trial.h"
#include "test/gtest.h"
#include "test/testsupport/file_utils.h"
@@ -287,11 +286,11 @@
void DuplicateCng();
- SimulatedClock clock_;
NetEq* neteq_;
NetEq::Config config_;
std::unique_ptr<test::RtpFileSource> rtp_source_;
std::unique_ptr<test::Packet> packet_;
+ unsigned int sim_clock_;
AudioFrame out_frame_;
int output_sample_rate_;
int algorithmic_delay_ms_;
@@ -305,16 +304,16 @@
const int NetEqDecodingTest::kInitSampleRateHz;
NetEqDecodingTest::NetEqDecodingTest()
- : clock_(0),
- neteq_(NULL),
+ : neteq_(NULL),
config_(),
+ sim_clock_(0),
output_sample_rate_(kInitSampleRateHz),
algorithmic_delay_ms_(0) {
config_.sample_rate_hz = kInitSampleRateHz;
}
void NetEqDecodingTest::SetUp() {
- neteq_ = NetEq::Create(config_, &clock_, CreateBuiltinAudioDecoderFactory());
+ neteq_ = NetEq::Create(config_, CreateBuiltinAudioDecoderFactory());
NetEqNetworkStatistics stat;
ASSERT_EQ(0, neteq_->NetworkStatistics(&stat));
algorithmic_delay_ms_ = stat.current_buffer_size_ms;
@@ -332,7 +331,7 @@
void NetEqDecodingTest::Process() {
// Check if time to receive.
- while (packet_ && clock_.TimeInMilliseconds() >= packet_->time_ms()) {
+ while (packet_ && sim_clock_ >= packet_->time_ms()) {
if (packet_->payload_length_bytes() > 0) {
#ifndef WEBRTC_CODEC_ISAC
// Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
@@ -362,7 +361,7 @@
EXPECT_EQ(output_sample_rate_, neteq_->last_output_sample_rate_hz());
// Increase time.
- clock_.AdvanceTimeMilliseconds(kTimeStepMs);
+ sim_clock_ += kTimeStepMs;
}
void NetEqDecodingTest::DecodeAndCompare(
@@ -393,7 +392,7 @@
output.AddResult(out_frame_.data(), out_frame_.samples_per_channel_));
// Query the network statistics API once per second
- if (clock_.TimeInMilliseconds() % 1000 == 0) {
+ if (sim_clock_ % 1000 == 0) {
// Process NetworkStatistics.
NetEqNetworkStatistics current_network_stats;
ASSERT_EQ(0, neteq_->NetworkStatistics(¤t_network_stats));
@@ -1434,8 +1433,7 @@
}
void CreateSecondInstance() {
- neteq2_.reset(
- NetEq::Create(config2_, &clock_, CreateBuiltinAudioDecoderFactory()));
+ neteq2_.reset(NetEq::Create(config2_, CreateBuiltinAudioDecoderFactory()));
ASSERT_TRUE(neteq2_);
LoadDecoders(neteq2_.get());
}
diff --git a/modules/audio_coding/neteq/packet.cc b/modules/audio_coding/neteq/packet.cc
index 333f161..3cec310 100644
--- a/modules/audio_coding/neteq/packet.cc
+++ b/modules/audio_coding/neteq/packet.cc
@@ -28,7 +28,6 @@
clone.payload_type = payload_type;
clone.payload.SetData(payload.data(), payload.size());
clone.priority = priority;
- clone.packet_info = packet_info;
return clone;
}
diff --git a/modules/audio_coding/neteq/packet.h b/modules/audio_coding/neteq/packet.h
index 238e769..1fdcc57 100644
--- a/modules/audio_coding/neteq/packet.h
+++ b/modules/audio_coding/neteq/packet.h
@@ -17,7 +17,6 @@
#include <memory>
#include "api/audio_codecs/audio_decoder.h"
-#include "api/rtp_packet_info.h"
#include "modules/audio_coding/neteq/tick_timer.h"
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
@@ -74,7 +73,6 @@
// Datagram excluding RTP header and header extension.
rtc::Buffer payload;
Priority priority;
- RtpPacketInfo packet_info;
std::unique_ptr<TickTimer::Stopwatch> waiting_time;
std::unique_ptr<AudioDecoder::EncodedAudioFrame> frame;
diff --git a/modules/audio_coding/neteq/red_payload_splitter.cc b/modules/audio_coding/neteq/red_payload_splitter.cc
index 7ff5679..72932fe 100644
--- a/modules/audio_coding/neteq/red_payload_splitter.cc
+++ b/modules/audio_coding/neteq/red_payload_splitter.cc
@@ -118,12 +118,6 @@
new_packet.priority.red_level =
rtc::dchecked_cast<int>((new_headers.size() - 1) - i);
new_packet.payload.SetData(payload_ptr, payload_length);
- new_packet.packet_info = RtpPacketInfo(
- /*ssrc=*/red_packet.packet_info.ssrc(),
- /*csrcs=*/std::vector<uint32_t>(),
- /*rtp_timestamp=*/new_packet.timestamp,
- /*audio_level=*/absl::nullopt,
- /*receive_time_ms=*/red_packet.packet_info.receive_time_ms());
new_packets.push_front(std::move(new_packet));
payload_ptr += payload_length;
}
diff --git a/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
index 604083b..61f52bb 100644
--- a/modules/audio_coding/neteq/tools/neteq_performance_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
@@ -39,9 +39,7 @@
// Initialize NetEq instance.
NetEq::Config config;
config.sample_rate_hz = kSampRateHz;
- webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock();
- NetEq* neteq =
- NetEq::Create(config, clock, CreateBuiltinAudioDecoderFactory());
+ NetEq* neteq = NetEq::Create(config, CreateBuiltinAudioDecoderFactory());
// Register decoder in |neteq|.
if (!neteq->RegisterPayloadType(kPayloadType,
SdpAudioFormat("l16", kSampRateHz, 1)))
@@ -74,6 +72,7 @@
RTC_CHECK_EQ(sizeof(input_payload), payload_len);
// Main loop.
+ webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock();
int64_t start_time_ms = clock->TimeInMilliseconds();
AudioFrame out_frame;
while (time_now_ms < runtime_ms) {
diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
index cd8754c..0adc21d 100644
--- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
@@ -20,7 +20,6 @@
#include "modules/audio_coding/neteq/tools/output_wav_file.h"
#include "modules/audio_coding/neteq/tools/resample_input_audio_file.h"
#include "rtc_base/checks.h"
-#include "system_wrappers/include/clock.h"
#include "test/testsupport/file_utils.h"
const std::string& DefaultInFilename() {
@@ -228,8 +227,7 @@
NetEq::Config config;
config.sample_rate_hz = out_sampling_khz_ * 1000;
- neteq_.reset(
- NetEq::Create(config, Clock::GetRealTimeClock(), decoder_factory));
+ neteq_.reset(NetEq::Create(config, decoder_factory));
max_payload_bytes_ = in_size_samples_ * channels_ * sizeof(int16_t);
in_data_.reset(new int16_t[in_size_samples_ * channels_]);
}
diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.h b/modules/audio_coding/neteq/tools/neteq_quality_test.h
index 8bf5e5a..a8243c1 100644
--- a/modules/audio_coding/neteq/tools/neteq_quality_test.h
+++ b/modules/audio_coding/neteq/tools/neteq_quality_test.h
@@ -19,7 +19,6 @@
#include "modules/audio_coding/neteq/tools/audio_sink.h"
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
#include "modules/audio_coding/neteq/tools/rtp_generator.h"
-#include "system_wrappers/include/clock.h"
#include "test/gtest.h"
namespace webrtc {
diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc
index 7e22823..be1dd41 100644
--- a/modules/audio_coding/neteq/tools/neteq_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_test.cc
@@ -14,7 +14,6 @@
#include <iostream>
#include "modules/rtp_rtcp/source/byte_io.h"
-#include "system_wrappers/include/clock.h"
namespace webrtc {
namespace test {
@@ -58,8 +57,7 @@
std::unique_ptr<NetEqInput> input,
std::unique_ptr<AudioSink> output,
Callbacks callbacks)
- : clock_(0),
- neteq_(NetEq::Create(config, &clock_, decoder_factory)),
+ : neteq_(NetEq::Create(config, decoder_factory)),
input_(std::move(input)),
output_(std::move(output)),
callbacks_(callbacks),
@@ -94,7 +92,6 @@
while (!input_->ended()) {
// Advance time to next event.
RTC_DCHECK(input_->NextEventTime());
- clock_.AdvanceTimeMilliseconds(*input_->NextEventTime() - time_now_ms);
time_now_ms = *input_->NextEventTime();
// Check if it is time to insert packet.
if (input_->NextPacketTime() && time_now_ms >= *input_->NextPacketTime()) {
diff --git a/modules/audio_coding/neteq/tools/neteq_test.h b/modules/audio_coding/neteq/tools/neteq_test.h
index 3cf105c..5261dd7 100644
--- a/modules/audio_coding/neteq/tools/neteq_test.h
+++ b/modules/audio_coding/neteq/tools/neteq_test.h
@@ -23,7 +23,6 @@
#include "modules/audio_coding/neteq/include/neteq.h"
#include "modules/audio_coding/neteq/tools/audio_sink.h"
#include "modules/audio_coding/neteq/tools/neteq_input.h"
-#include "system_wrappers/include/clock.h"
namespace webrtc {
namespace test {
@@ -107,7 +106,6 @@
private:
void RegisterDecoders(const DecoderMap& codecs);
- SimulatedClock clock_;
absl::optional<Action> next_action_;
absl::optional<int> last_packet_time_ms_;
std::unique_ptr<NetEq> neteq_;
diff --git a/modules/audio_mixer/frame_combiner.cc b/modules/audio_mixer/frame_combiner.cc
index f7ce952..4aa86f7 100644
--- a/modules/audio_mixer/frame_combiner.cc
+++ b/modules/audio_mixer/frame_combiner.cc
@@ -57,7 +57,6 @@
audio_frame_for_mixing->timestamp_ = mix_list[0]->timestamp_;
audio_frame_for_mixing->elapsed_time_ms_ = mix_list[0]->elapsed_time_ms_;
audio_frame_for_mixing->ntp_time_ms_ = mix_list[0]->ntp_time_ms_;
- audio_frame_for_mixing->packet_infos_ = mix_list[0]->packet_infos_;
}
}