diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h index f8062de8bd..0c7088e9ba 100644 --- a/api/neteq/neteq.h +++ b/api/neteq/neteq.h @@ -23,6 +23,7 @@ #include "api/audio_codecs/audio_codec_pair_id.h" #include "api/audio_codecs/audio_format.h" #include "api/rtp_headers.h" +#include "api/rtp_packet_info.h" #include "api/units/timestamp.h" namespace webrtc { @@ -186,16 +187,24 @@ class NetEq { virtual int InsertPacket(const RTPHeader& rtp_header, rtc::ArrayView payload) { - // TODO: webrtc:343501093 - removed unused method. return InsertPacket(rtp_header, payload, /*receive_time=*/Timestamp::MinusInfinity()); } - // Inserts a new packet into NetEq. - // Returns 0 on success, -1 on failure. + + // TODO: webrtc:343501093 - removed unused method. virtual int InsertPacket(const RTPHeader& rtp_header, rtc::ArrayView payload, - Timestamp /* receive_time */) { - // TODO: webrtc:343501093 - Make this method pure virtual. + Timestamp receive_time) { + return InsertPacket(rtp_header, payload, + RtpPacketInfo(rtp_header, receive_time)); + } + + // Inserts a new packet into NetEq. + // Returns 0 on success, -1 on failure. + // TODO: webrtc:343501093 - Make this method pure virtual. + virtual int InsertPacket(const RTPHeader& rtp_header, + rtc::ArrayView payload, + const RtpPacketInfo& /* rtp_packet_info */) { return InsertPacket(rtp_header, payload); } diff --git a/audio/BUILD.gn b/audio/BUILD.gn index 437883da54..4330d065ab 100644 --- a/audio/BUILD.gn +++ b/audio/BUILD.gn @@ -43,7 +43,9 @@ rtc_library("audio") { "../api:field_trials_view", "../api:frame_transformer_interface", "../api:function_view", + "../api:make_ref_counted", "../api:rtp_headers", + "../api:rtp_packet_info", "../api:rtp_parameters", "../api:scoped_refptr", "../api:sequence_checker", diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index 43b7d3e4da..db43d94822 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -11,49 +11,75 @@ #include "audio/channel_receive.h" #include +#include +#include #include #include +#include #include #include #include +#include "api/array_view.h" #include "api/audio/audio_device.h" +#include "api/audio/audio_mixer.h" +#include "api/audio_codecs/audio_codec_pair_id.h" +#include "api/audio_codecs/audio_decoder_factory.h" +#include "api/audio_codecs/audio_format.h" +#include "api/call/audio_sink.h" +#include "api/call/transport.h" +#include "api/crypto/crypto_options.h" #include "api/crypto/frame_decryptor_interface.h" +#include "api/environment/environment.h" #include "api/frame_transformer_interface.h" +#include "api/make_ref_counted.h" +#include "api/media_types.h" #include "api/neteq/default_neteq_factory.h" #include "api/neteq/neteq.h" +#include "api/neteq/neteq_factory.h" #include "api/rtc_event_log/rtc_event_log.h" +#include "api/rtp_headers.h" +#include "api/rtp_packet_info.h" +#include "api/rtp_packet_infos.h" +#include "api/scoped_refptr.h" #include "api/sequence_checker.h" #include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/task_queue_base.h" +#include "api/transport/rtp/rtp_source.h" #include "api/units/time_delta.h" #include "api/units/timestamp.h" #include "audio/audio_level.h" #include "audio/channel_receive_frame_transformer_delegate.h" #include "audio/channel_send.h" #include "audio/utility/audio_frame_operations.h" +#include "call/syncable.h" #include "logging/rtc_event_log/events/rtc_event_audio_playout.h" #include "logging/rtc_event_log/events/rtc_event_neteq_set_minimum_delay.h" #include "modules/audio_coding/acm2/acm_resampler.h" #include "modules/audio_coding/acm2/call_statistics.h" -#include "modules/audio_coding/audio_network_adaptor/include/audio_network_adaptor_config.h" +#include "modules/audio_coding/include/audio_coding_module_typedefs.h" #include "modules/pacing/packet_router.h" #include "modules/rtp_rtcp/include/receive_statistics.h" #include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h" +#include "modules/rtp_rtcp/include/rtcp_statistics.h" +#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/source/absolute_capture_time_interpolator.h" #include "modules/rtp_rtcp/source/capture_clock_offset_updater.h" -#include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "modules/rtp_rtcp/source/rtp_rtcp_config.h" #include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h" +#include "modules/rtp_rtcp/source/source_tracker.h" +#include "rtc_base/buffer.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" +#include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/numerics/sequence_number_unwrapper.h" #include "rtc_base/race_checker.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" +#include "rtc_base/thread_annotations.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/metrics.h" @@ -145,7 +171,7 @@ class ChannelReceive : public ChannelReceiveInterface, // Audio+Video Sync. uint32_t GetDelayEstimate() const override; - bool SetMinimumPlayoutDelay(int delayMs) override; + bool SetMinimumPlayoutDelay(int delay_ms) override; bool GetPlayoutRtpTimestamp(uint32_t* rtp_timestamp, int64_t* time_ms) const override; void SetEstimatedPlayoutNtpTimestampMs(int64_t ntp_timestamp_ms, @@ -165,7 +191,7 @@ class ChannelReceive : public ChannelReceiveInterface, void ResetReceiverCongestionControlObjects() override; CallReceiveStatistics GetRTCPStatistics() const override; - void SetNACKStatus(bool enable, int maxNumberOfPackets) override; + void SetNACKStatus(bool enable, int max_packets) override; void SetRtcpMode(webrtc::RtcpMode mode) override; void SetNonSenderRttMeasurement(bool enabled) override; @@ -350,7 +376,8 @@ void ChannelReceive::OnReceivedPayloadData( // Push the incoming payload (parsed and ready for decoding) into NetEq. if (payload.empty()) { neteq_->InsertEmptyPacket(rtpHeader); - } else if (neteq_->InsertPacket(rtpHeader, payload, receive_time) < 0) { + } else if (neteq_->InsertPacket(rtpHeader, payload, + RtpPacketInfo(rtpHeader, receive_time)) < 0) { RTC_DLOG(LS_ERROR) << "ChannelReceive::OnReceivedPayloadData() unable to " "insert packet into NetEq; PT = " << static_cast(rtpHeader.payloadType); @@ -1175,11 +1202,11 @@ int ChannelReceive::GetRtpTimestampRateHz() const { const auto decoder_format = neteq_->GetCurrentDecoderFormat(); // Default to the playout frequency if we've not gotten any packets yet. - // TODO(ossu): Zero clockrate can only happen if we've added an external + // TODO(ossu): Zero clock rate can only happen if we've added an external // decoder for a format we don't support internally. Remove once that way of // adding decoders is gone! // TODO(kwiberg): `decoder_format->sdp_format.clockrate_hz` is an RTP - // clockrate as it should, but `neteq_->last_output_sample_rate_hz()` is a + // clock rate as it should, but `neteq_->last_output_sample_rate_hz()` is a // codec sample rate, which is not always the same thing. return (decoder_format && decoder_format->sdp_format.clockrate_hz != 0) ? decoder_format->sdp_format.clockrate_hz diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index 78bdccfefe..bdc4860716 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -527,6 +527,7 @@ rtc_library("neteq") { "../../api/neteq:neteq_api", "../../api/neteq:neteq_controller_api", "../../api/neteq:tick_timer", + "../../api/units:time_delta", "../../api/units:timestamp", "../../common_audio", "../../common_audio:common_audio_c", diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc index 6a9371c7f7..5b58057463 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc @@ -16,18 +16,28 @@ #include #include #include +#include #include #include +#include "api/array_view.h" #include "api/audio_codecs/audio_decoder.h" +#include "api/audio_codecs/audio_decoder_factory.h" +#include "api/audio_codecs/audio_format.h" +#include "api/environment/environment.h" +#include "api/neteq/neteq.h" #include "api/neteq/neteq_controller.h" +#include "api/neteq/neteq_controller_factory.h" #include "api/neteq/tick_timer.h" -#include "common_audio/signal_processing/include/signal_processing_library.h" +#include "api/rtp_headers.h" +#include "api/rtp_packet_info.h" +#include "api/rtp_packet_infos.h" +#include "api/scoped_refptr.h" +#include "api/units/time_delta.h" #include "modules/audio_coding/codecs/cng/webrtc_cng.h" #include "modules/audio_coding/neteq/accelerate.h" #include "modules/audio_coding/neteq/background_noise.h" #include "modules/audio_coding/neteq/comfort_noise.h" -#include "modules/audio_coding/neteq/decision_logic.h" #include "modules/audio_coding/neteq/decoder_database.h" #include "modules/audio_coding/neteq/dtmf_buffer.h" #include "modules/audio_coding/neteq/dtmf_tone_generator.h" @@ -48,6 +58,7 @@ #include "rtc_base/numerics/safe_conversions.h" #include "rtc_base/sanitizer.h" #include "rtc_base/strings/audio_format_to_string.h" +#include "rtc_base/synchronization/mutex.h" #include "rtc_base/trace_event.h" #include "system_wrappers/include/clock.h" @@ -173,11 +184,11 @@ NetEqImpl::~NetEqImpl() = default; int NetEqImpl::InsertPacket(const RTPHeader& rtp_header, rtc::ArrayView payload, - Timestamp receive_time) { + const RtpPacketInfo& packet_info) { rtc::MsanCheckInitialized(payload); TRACE_EVENT0("webrtc", "NetEqImpl::InsertPacket"); MutexLock lock(&mutex_); - if (InsertPacketInternal(rtp_header, payload, receive_time) != 0) { + if (InsertPacketInternal(rtp_header, payload, packet_info) != 0) { return kFail; } return kOK; @@ -444,7 +455,7 @@ NetEq::Operation NetEqImpl::last_operation_for_test() const { int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header, rtc::ArrayView payload, - Timestamp receive_time) { + const RtpPacketInfo& packet_info) { if (payload.empty()) { RTC_LOG_F(LS_ERROR) << "payload is empty"; return kInvalidPointer; @@ -585,8 +596,8 @@ int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header, new_packet.priority.codec_level = result.priority; new_packet.priority.red_level = original_priority.red_level; // Only associate the header information with the primary packet. - if (new_packet.timestamp == rtp_header.timestamp) { - new_packet.packet_info = RtpPacketInfo(rtp_header, receive_time); + if (new_packet.timestamp == packet_info.rtp_timestamp()) { + new_packet.packet_info = packet_info; } new_packet.frame = std::move(result.frame); return new_packet; diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h index 86519e37a0..1c356e3d55 100644 --- a/modules/audio_coding/neteq/neteq_impl.h +++ b/modules/audio_coding/neteq/neteq_impl.h @@ -11,26 +11,32 @@ #ifndef MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ #define MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ +#include +#include #include #include #include -#include -#include #include +#include "api/array_view.h" #include "api/audio/audio_frame.h" +#include "api/audio_codecs/audio_decoder.h" +#include "api/audio_codecs/audio_decoder_factory.h" +#include "api/audio_codecs/audio_format.h" #include "api/environment/environment.h" #include "api/neteq/neteq.h" #include "api/neteq/neteq_controller.h" #include "api/neteq/neteq_controller_factory.h" #include "api/neteq/tick_timer.h" +#include "api/rtp_headers.h" #include "api/rtp_packet_info.h" -#include "api/units/timestamp.h" +#include "api/scoped_refptr.h" #include "modules/audio_coding/neteq/audio_multi_vector.h" #include "modules/audio_coding/neteq/packet.h" #include "modules/audio_coding/neteq/packet_buffer.h" #include "modules/audio_coding/neteq/random_vector.h" #include "modules/audio_coding/neteq/statistics_calculator.h" +#include "rtc_base/buffer.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/thread_annotations.h" @@ -125,10 +131,17 @@ class NetEqImpl : public webrtc::NetEq { NetEqImpl(const NetEqImpl&) = delete; NetEqImpl& operator=(const NetEqImpl&) = delete; + int InsertPacket(const RTPHeader& rtp_header, + rtc::ArrayView payload) override { + return InsertPacket( + rtp_header, payload, + RtpPacketInfo(rtp_header, /*receive_time=*/Timestamp::MinusInfinity())); + } + // Inserts a new packet into NetEq. Returns 0 on success, -1 on failure. int InsertPacket(const RTPHeader& rtp_header, rtc::ArrayView payload, - Timestamp receive_time) override; + const RtpPacketInfo& packet_info) override; void InsertEmptyPacket(const RTPHeader& rtp_header) override; @@ -205,7 +218,7 @@ class NetEqImpl : public webrtc::NetEq { // TODO(hlundin): Merge this with InsertPacket above? int InsertPacketInternal(const RTPHeader& rtp_header, rtc::ArrayView payload, - Timestamp receive_time) + const RtpPacketInfo& packet_info) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Returns true if the payload type changed (this should be followed by @@ -284,7 +297,7 @@ class NetEqImpl : public webrtc::NetEq { bool fast_accelerate) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Sub-method which calls the PreemptiveExpand class to perform the - // preemtive expand operation. + // preemptive expand operation. int DoPreemptiveExpand(int16_t* decoded_buffer, size_t decoded_length, AudioDecoder::SpeechType speech_type, diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc index 500e18501e..2d39b30adf 100644 --- a/modules/audio_coding/neteq/neteq_impl_unittest.cc +++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc @@ -195,9 +195,7 @@ class NetEqImplTest : public ::testing::Test { kPayloadType, SdpAudioFormat("telephone-event", sample_rate_hz, 1))); // Insert first packet. - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); // Pull audio once. const size_t kMaxOutputSize = @@ -374,14 +372,12 @@ TEST_F(NetEqImplTest, InsertPacket) { } // Insert first packet. - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime()); + neteq_->InsertPacket(rtp_header, payload); // Insert second packet. rtp_header.timestamp += 160; rtp_header.sequenceNumber += 1; - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime()); + neteq_->InsertPacket(rtp_header, payload); } TEST_F(NetEqImplTest, CountStatsAfterFirstDecodedPacket) { @@ -406,7 +402,7 @@ TEST_F(NetEqImplTest, CountStatsAfterFirstDecodedPacket) { EXPECT_EQ(neteq_->GetLifetimeStatistics().concealed_samples, 0u); EXPECT_EQ(neteq_->GetLifetimeStatistics().total_samples_received, 0u); } - neteq_->InsertPacket(rtp_header, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_header, payload); neteq_->GetAudio(&frame); EXPECT_EQ(neteq_->GetLifetimeStatistics().concealed_samples, 0u); EXPECT_EQ(neteq_->GetLifetimeStatistics().total_samples_received, @@ -432,9 +428,7 @@ TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) { // Insert packets. The buffer should not flush. for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) { - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); rtp_header.timestamp += kPayloadLengthSamples; rtp_header.sequenceNumber += 1; EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); @@ -442,9 +436,7 @@ TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) { // Insert one more packet and make sure the buffer got flushed. That is, it // should only hold one single packet. - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer()); const Packet* test_packet = packet_buffer_->PeekNextPacket(); EXPECT_EQ(rtp_header.timestamp, test_packet->timestamp); @@ -529,9 +521,9 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) { // Insert one packet. clock_.AdvanceTimeMilliseconds(123456); - Timestamp expected_receive_time = clock_.CurrentTime(); + RtpPacketInfo expected_packet_info(rtp_header, clock_.CurrentTime()); EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, expected_receive_time)); + neteq_->InsertPacket(rtp_header, payload, expected_packet_info)); // Pull audio once. const size_t kMaxOutputSize = static_cast(10 * kSampleRateHz / 1000); @@ -545,14 +537,7 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) { // 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(), expected_receive_time); - } + EXPECT_EQ(output.packet_infos_[0], expected_packet_info); // Start with a simple check that the fake decoder is behaving as expected. EXPECT_EQ(kPayloadLengthSamples, @@ -624,10 +609,10 @@ TEST_F(NetEqImplTest, ReorderedPacket) { // Insert one packet. clock_.AdvanceTimeMilliseconds(123456); - Timestamp expected_receive_time = clock_.CurrentTime(); + RtpPacketInfo expected_packet_info = + RtpPacketInfo(rtp_header, /*receive_time=*/clock_.CurrentTime()); EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + neteq_->InsertPacket(rtp_header, payload, expected_packet_info)); // Pull audio once. const size_t kMaxOutputSize = static_cast(10 * kSampleRateHz / 1000); @@ -640,15 +625,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) { // 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.audio_level()->level()); - EXPECT_EQ(packet_info.receive_time(), expected_receive_time); - } + EXPECT_EQ(output.packet_infos_[0], expected_packet_info); // Insert two more packets. The first one is out of order, and is already too // old, the second one is the expected next packet. @@ -657,18 +634,16 @@ TEST_F(NetEqImplTest, ReorderedPacket) { rtp_header.extension.set_audio_level(AudioLevel(/*voice_activity=*/false, 1)); payload[0] = 1; clock_.AdvanceTimeMilliseconds(1000); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); rtp_header.sequenceNumber += 2; rtp_header.timestamp += 2 * kPayloadLengthSamples; rtp_header.extension.set_audio_level(AudioLevel(/*voice_activity=*/false, 2)); payload[0] = 2; clock_.AdvanceTimeMilliseconds(2000); - expected_receive_time = clock_.CurrentTime(); + expected_packet_info = + RtpPacketInfo(rtp_header, /*receive_time=*/clock_.CurrentTime()); EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + neteq_->InsertPacket(rtp_header, payload, expected_packet_info)); // Expect only the second packet to be decoded (the one with "2" as the first // payload byte). @@ -694,15 +669,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) { // 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.audio_level()->level()); - EXPECT_EQ(packet_info.receive_time(), expected_receive_time); - } + EXPECT_EQ(output.packet_infos_[0], expected_packet_info); EXPECT_CALL(mock_decoder, Die()); } @@ -727,9 +694,7 @@ TEST_F(NetEqImplTest, FirstPacketUnknown) { // Insert one packet. Note that we have not registered any payload type, so // this packet will be rejected. - EXPECT_EQ(NetEq::kFail, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_header, payload)); // Pull audio once. const size_t kMaxOutputSize = static_cast(10 * kSampleRateHz / 1000); @@ -750,9 +715,7 @@ TEST_F(NetEqImplTest, FirstPacketUnknown) { for (size_t i = 0; i < 10; ++i) { rtp_header.sequenceNumber++; rtp_header.timestamp += kPayloadLengthSamples; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer()); } @@ -824,8 +787,7 @@ TEST_F(NetEqImplTest, InsertRedPayload) { header.extension.set_audio_level(AudioLevel(/*voice_activity=*/false, 12)); header.numCSRCs = 1; header.arrOfCSRCs[0] = 123; - neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()); + neteq_->InsertPacket(header, payload); AudioFrame frame; bool muted; neteq_->GetAudio(&frame, &muted); @@ -923,9 +885,7 @@ TEST_P(NetEqImplTestSampleRateParameter, auto insert_packet = [&]() { rtp_header.sequenceNumber++; rtp_header.timestamp += kPayloadLengthSamples; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); }; // Insert 10 packets. for (size_t i = 0; i < 10; ++i) { @@ -1009,9 +969,7 @@ TEST_P(NetEqImplTestSampleRateParameter, AudioInterruptionLogged) { auto insert_packet = [&]() { rtp_header.sequenceNumber++; rtp_header.timestamp += kPayloadLengthSamples; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); }; // Insert 10 packets. for (size_t i = 0; i < 10; ++i) { @@ -1085,9 +1043,7 @@ TEST_P(NetEqImplTestSdpFormatParameter, GetNackListScaledTimestamp) { rtp_header.sequenceNumber++; rtp_header.timestamp += kPayloadLengthSamples; if (!lost) - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); }; // Insert and decode 10 packets. @@ -1176,9 +1132,7 @@ TEST_F(NetEqImplTest, CodecInternalCng) { rtp_header.sequenceNumber += packets[i].sequence_number_delta; rtp_header.timestamp += packets[i].timestamp_delta; payload[0] = i; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); // Pointee(x) verifies that first byte of the payload equals x, this makes // it possible to verify that the correct payload is fed to Decode(). @@ -1276,9 +1230,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) { // Insert one packet. payload[0] = kFirstPayloadValue; // This will make Decode() fail. - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); // Insert another packet. payload[0] = kSecondPayloadValue; // This will make Decode() successful. @@ -1286,9 +1238,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) { // The second timestamp needs to be at least 30 ms after the first to make // the second packet get decoded. rtp_header.timestamp += 3 * kPayloadLengthSamples; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); AudioFrame output; bool muted; @@ -1341,9 +1291,7 @@ TEST_F(NetEqImplTest, FloodBufferAndGetNetworkStats) { // Insert packets until the buffer flushes. for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) { EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); rtp_header.timestamp += rtc::checked_cast(kPayloadLengthSamples); ++rtp_header.sequenceNumber; } @@ -1395,9 +1343,7 @@ TEST_F(NetEqImplTest, DecodedPayloadTooShort) { SdpAudioFormat("L16", 8000, 1))); // Insert one packet. - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength()); @@ -1489,9 +1435,7 @@ TEST_F(NetEqImplTest, DecodingError) { for (int i = 0; i < 20; ++i) { rtp_header.sequenceNumber += 1; rtp_header.timestamp += kFrameLengthSamples; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); } // Pull audio. @@ -1616,9 +1560,7 @@ TEST_F(NetEqImplTest, NotifyControllerOfReorderedPacket) { EXPECT_TRUE(neteq_->RegisterPayloadType(kPayloadType, SdpAudioFormat("l16", 8000, 1))); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); AudioFrame output; bool muted; EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted)); @@ -1640,9 +1582,7 @@ TEST_F(NetEqImplTest, NotifyControllerOfReorderedPacket) { Field(&NetEqController::PacketArrivedInfo::main_timestamp, rtp_header.timestamp)))); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); } // When using a codec with 1000 channels, there should be no crashes. @@ -1696,8 +1636,7 @@ TEST_F(NetEqImplTest, NoCrashWith1000Channels) { })); // Insert first packet. - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime()); + neteq_->InsertPacket(rtp_header, payload); AudioFrame audio_frame; bool muted; @@ -1726,16 +1665,12 @@ TEST_F(NetEqImplTest, CngFirstThenSpeechWithNewSampleRate) { header.payloadType = kCnPayloadType; uint8_t payload[320] = {0}; - EXPECT_EQ(neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()), - NetEq::kOK); + EXPECT_EQ(neteq_->InsertPacket(header, payload), NetEq::kOK); EXPECT_EQ(neteq_->GetLifetimeStatistics().packets_discarded, 0u); header.payloadType = kSpeechPayloadType; header.timestamp += 160; - EXPECT_EQ(neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()), - NetEq::kOK); + EXPECT_EQ(neteq_->InsertPacket(header, payload), NetEq::kOK); // CN packet should be discarded, since it does not match the // new speech sample rate. EXPECT_EQ(neteq_->GetLifetimeStatistics().packets_discarded, 1u); @@ -1767,9 +1702,7 @@ TEST_F(NetEqImplTest, InsertPacketChangePayloadType) { neteq_->GetCurrentDecoderFormat(); EXPECT_FALSE(decoder.has_value()); - EXPECT_EQ(neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()), - NetEq::kOK); + EXPECT_EQ(neteq_->InsertPacket(header, payload), NetEq::kOK); EXPECT_EQ(neteq_->GetLifetimeStatistics().packets_discarded, 0u); decoder = neteq_->GetCurrentDecoderFormat(); ASSERT_TRUE(decoder.has_value()); @@ -1778,9 +1711,7 @@ TEST_F(NetEqImplTest, InsertPacketChangePayloadType) { header.payloadType = kPcmaPayloadType; header.timestamp += 80; - EXPECT_EQ(neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()), - NetEq::kOK); + EXPECT_EQ(neteq_->InsertPacket(header, payload), NetEq::kOK); decoder = neteq_->GetCurrentDecoderFormat(); ASSERT_TRUE(decoder.has_value()); EXPECT_EQ(decoder->payload_type, kPcmaPayloadType); @@ -1870,9 +1801,7 @@ class NetEqImplTest120ms : public NetEqImplTest { rtp_header.ssrc = 15; const size_t kPayloadLengthBytes = 1; // This can be arbitrary. uint8_t payload[kPayloadLengthBytes] = {0}; - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); sequence_number_++; }