diff --git a/api/neteq/BUILD.gn b/api/neteq/BUILD.gn index c29660d3a0..f73085affd 100644 --- a/api/neteq/BUILD.gn +++ b/api/neteq/BUILD.gn @@ -23,7 +23,6 @@ rtc_source_set("neteq_api") { "../../rtc_base:stringutils", "../../system_wrappers:system_wrappers", "../audio_codecs:audio_codecs_api", - "../units:timestamp", "//third_party/abseil-cpp/absl/types:optional", ] } diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h index 8bd47cde42..927bd62111 100644 --- a/api/neteq/neteq.h +++ b/api/neteq/neteq.h @@ -23,7 +23,6 @@ #include "api/audio_codecs/audio_format.h" #include "api/rtp_headers.h" #include "api/scoped_refptr.h" -#include "api/units/timestamp.h" namespace webrtc { @@ -184,18 +183,10 @@ class NetEq { virtual ~NetEq() {} - ABSL_DEPRECATED("Use the overload with receive time") - virtual int InsertPacket(const RTPHeader& rtp_header, - rtc::ArrayView payload) { - // TODO: webrtc:xxxxx - 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. virtual int InsertPacket(const RTPHeader& rtp_header, - rtc::ArrayView payload, - Timestamp receive_time) = 0; + rtc::ArrayView payload) = 0; // Lets NetEq know that a packet arrived with an empty payload. This typically // happens when empty packets are used for probing the network channel, and diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index b2fa0bf3cc..1fa396e482 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc @@ -196,8 +196,8 @@ class ChannelReceive : public ChannelReceiveInterface, private: void ReceivePacket(const uint8_t* packet, size_t packet_length, - const RTPHeader& header, - Timestamp receive_time) RTC_RUN_ON(worker_thread_checker_); + const RTPHeader& header) + RTC_RUN_ON(worker_thread_checker_); int ResendPackets(const uint16_t* sequence_numbers, int length); void UpdatePlayoutTimestamp(bool rtcp, int64_t now_ms) RTC_RUN_ON(worker_thread_checker_); @@ -205,8 +205,7 @@ class ChannelReceive : public ChannelReceiveInterface, int GetRtpTimestampRateHz() const; void OnReceivedPayloadData(rtc::ArrayView payload, - const RTPHeader& rtpHeader, - Timestamp receive_time) + const RTPHeader& rtpHeader) RTC_RUN_ON(worker_thread_checker_); void InitFrameTransformerDelegate( @@ -255,6 +254,7 @@ class ChannelReceive : public ChannelReceiveInterface, AudioSinkInterface* audio_sink_ = nullptr; AudioLevel _outputAudioLevel; + Clock* const clock_; RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_); // Timestamp of the audio pulled from NetEq. @@ -320,8 +320,7 @@ class ChannelReceive : public ChannelReceiveInterface, void ChannelReceive::OnReceivedPayloadData( rtc::ArrayView payload, - const RTPHeader& rtpHeader, - Timestamp receive_time) { + const RTPHeader& rtpHeader) { if (!playing_) { // Avoid inserting into NetEQ when we are not playing. Count the // packet as discarded. @@ -336,7 +335,7 @@ void ChannelReceive::OnReceivedPayloadData( // the SourceTracker from updating RtpSource information. if (source_tracker_) { RtpPacketInfos::vector_type packet_vector = { - RtpPacketInfo(rtpHeader, receive_time)}; + RtpPacketInfo(rtpHeader, clock_->CurrentTime())}; source_tracker_->OnFrameDelivered(RtpPacketInfos(packet_vector)); } @@ -344,7 +343,7 @@ void ChannelReceive::OnReceivedPayloadData( } // Push the incoming payload (parsed and ready for decoding) into the ACM - if (acm_receiver_.InsertPacket(rtpHeader, payload, receive_time) != 0) { + if (acm_receiver_.InsertPacket(rtpHeader, payload) != 0) { RTC_DLOG(LS_ERROR) << "ChannelReceive::OnReceivedPayloadData() unable to " "push data to the ACM"; return; @@ -373,9 +372,7 @@ void ChannelReceive::InitFrameTransformerDelegate( receive_audio_callback = [this](rtc::ArrayView packet, const RTPHeader& header) { RTC_DCHECK_RUN_ON(&worker_thread_checker_); - // TODO(lionelk): Get the receive time. - OnReceivedPayloadData(packet, header, - /*receive_time=*/Timestamp::MinusInfinity()); + OnReceivedPayloadData(packet, header); }; frame_transformer_delegate_ = rtc::make_ref_counted( @@ -548,6 +545,7 @@ ChannelReceive::ChannelReceive( jitter_buffer_fast_playout, jitter_buffer_min_delay_ms)), _outputAudioLevel(), + clock_(clock), ntp_estimator_(clock), playout_timestamp_rtp_(0), playout_delay_ms_(0), @@ -665,14 +663,12 @@ void ChannelReceive::OnRtpPacket(const RtpPacketReceived& packet) { rtc::saturated_cast(packet_copy.payload_type_frequency()), header.extension.absolute_capture_time); - ReceivePacket(packet_copy.data(), packet_copy.size(), header, - packet.arrival_time()); + ReceivePacket(packet_copy.data(), packet_copy.size(), header); } void ChannelReceive::ReceivePacket(const uint8_t* packet, size_t packet_length, - const RTPHeader& header, - Timestamp receive_time) { + const RTPHeader& header) { const uint8_t* payload = packet + header.headerLength; RTC_DCHECK_GE(packet_length, header.headerLength); size_t payload_length = packet_length - header.headerLength; @@ -692,8 +688,7 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet, const FrameDecryptorInterface::Result decrypt_result = frame_decryptor_->Decrypt( cricket::MEDIA_TYPE_AUDIO, csrcs, - /*additional_data=*/ - nullptr, + /*additional_data=*/nullptr, rtc::ArrayView(payload, payload_data_length), decrypted_audio_payload); @@ -725,7 +720,7 @@ void ChannelReceive::ReceivePacket(const uint8_t* packet, frame_transformer_delegate_->Transform(payload_data, header, remote_ssrc_, mime_type.str()); } else { - OnReceivedPayloadData(payload_data, header, receive_time); + OnReceivedPayloadData(payload_data, header); } } diff --git a/audio/voip/audio_ingress.cc b/audio/voip/audio_ingress.cc index 29363c1c36..80f21152c0 100644 --- a/audio/voip/audio_ingress.cc +++ b/audio/voip/audio_ingress.cc @@ -11,7 +11,6 @@ #include "audio/voip/audio_ingress.h" #include -#include #include #include @@ -51,8 +50,7 @@ AudioIngress::AudioIngress( rtp_receive_statistics_(receive_statistics), rtp_rtcp_(rtp_rtcp), acm_receiver_(CreateAcmConfig(decoder_factory)), - ntp_estimator_(clock), - clock_(clock) {} + ntp_estimator_(clock) {} AudioIngress::~AudioIngress() = default; @@ -186,8 +184,7 @@ void AudioIngress::ReceivedRTPPacket(rtc::ArrayView rtp_packet) { auto data_view = rtc::ArrayView(payload, payload_data_length); // Push the incoming payload (parsed and ready for decoding) into the ACM. - if (acm_receiver_.InsertPacket(header, data_view, clock_->CurrentTime()) != - 0) { + if (acm_receiver_.InsertPacket(header, data_view) != 0) { RTC_DLOG(LS_ERROR) << "AudioIngress::ReceivedRTPPacket() unable to " "push data to the ACM"; } diff --git a/audio/voip/audio_ingress.h b/audio/voip/audio_ingress.h index 36876deead..11bde7ce28 100644 --- a/audio/voip/audio_ingress.h +++ b/audio/voip/audio_ingress.h @@ -133,8 +133,6 @@ class AudioIngress : public AudioMixer::Source { RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(lock_); - Clock* clock_; - // For receiving RTP statistics, this tracks the sampling rate value // per payload type set when caller set via SetReceiveCodecs. std::map receive_codec_info_ RTC_GUARDED_BY(lock_); diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn index 655a9347fe..0ae4e34afb 100644 --- a/modules/audio_coding/BUILD.gn +++ b/modules/audio_coding/BUILD.gn @@ -47,7 +47,6 @@ rtc_library("audio_coding") { "../../api/audio:audio_frame_api", "../../api/audio_codecs:audio_codecs_api", "../../api/neteq:neteq_api", - "../../api/units:timestamp", "../../common_audio", "../../common_audio:common_audio_c", "../../rtc_base:audio_format_to_string", @@ -713,7 +712,6 @@ rtc_library("neteq") { "../../api/neteq:neteq_api", "../../api/neteq:neteq_controller_api", "../../api/neteq:tick_timer", - "../../api/units:timestamp", "../../common_audio", "../../common_audio:common_audio_c", "../../rtc_base:audio_format_to_string", @@ -786,7 +784,6 @@ rtc_library("neteq_tools_minimal") { "../../api/neteq:custom_neteq_factory", "../../api/neteq:default_neteq_controller_factory", "../../api/neteq:neteq_api", - "../../api/units:timestamp", "../../rtc_base:buffer", "../../rtc_base:checks", "../../rtc_base:copy_on_write_buffer", @@ -941,7 +938,6 @@ rtc_library("audio_coding_modules_tests_shared") { "../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_encoder_factory", "../../api/neteq:neteq_api", - "../../api/units:timestamp", "../../rtc_base:checks", "../../rtc_base:digest", "../../rtc_base:stringutils", @@ -1071,7 +1067,6 @@ if (rtc_include_tests) { "../../api/audio_codecs/ilbc:audio_encoder_ilbc", "../../api/audio_codecs/opus:audio_decoder_opus", "../../api/audio_codecs/opus:audio_encoder_opus", - "../../api/units:timestamp", "../../common_audio", "../../rtc_base:checks", "../../rtc_base:logging", @@ -1361,7 +1356,6 @@ if (rtc_include_tests) { ":neteq_tools_minimal", "../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/neteq:neteq_api", - "../../api/units:timestamp", "../../rtc_base:checks", "../../rtc_base:stringutils", "../../system_wrappers", @@ -1690,7 +1684,6 @@ if (rtc_include_tests) { "../../api/neteq:tick_timer", "../../api/neteq:tick_timer_unittest", "../../api/rtc_event_log", - "../../api/units:timestamp", "../../common_audio", "../../common_audio:common_audio_c", "../../common_audio:mock_common_audio", diff --git a/modules/audio_coding/acm2/acm_receive_test.cc b/modules/audio_coding/acm2/acm_receive_test.cc index 20d0a2f734..66f6255b01 100644 --- a/modules/audio_coding/acm2/acm_receive_test.cc +++ b/modules/audio_coding/acm2/acm_receive_test.cc @@ -122,8 +122,7 @@ void AcmReceiveTestOldApi::Run() { EXPECT_EQ(0, acm_receiver_->InsertPacket( packet->header(), rtc::ArrayView( - packet->payload(), packet->payload_length_bytes()), - clock_.CurrentTime())) + packet->payload(), packet->payload_length_bytes()))) << "Failure when inserting packet:" << std::endl << " PT = " << static_cast(packet->header().payloadType) << std::endl diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc index c0ac681ca9..ab113586cb 100644 --- a/modules/audio_coding/acm2/acm_receiver.cc +++ b/modules/audio_coding/acm2/acm_receiver.cc @@ -20,7 +20,6 @@ #include "api/audio/audio_frame.h" #include "api/audio_codecs/audio_decoder.h" #include "api/neteq/neteq.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/acm2/acm_resampler.h" #include "modules/audio_coding/acm2/call_statistics.h" #include "modules/audio_coding/neteq/default_neteq_factory.h" @@ -103,8 +102,7 @@ int AcmReceiver::last_output_sample_rate_hz() const { } int AcmReceiver::InsertPacket(const RTPHeader& rtp_header, - rtc::ArrayView incoming_payload, - Timestamp receive_time) { + rtc::ArrayView incoming_payload) { if (incoming_payload.empty()) { neteq_->InsertEmptyPacket(rtp_header); return 0; @@ -139,7 +137,7 @@ int AcmReceiver::InsertPacket(const RTPHeader& rtp_header, } } // `mutex_` is released. - if (neteq_->InsertPacket(rtp_header, incoming_payload, receive_time) < 0) { + if (neteq_->InsertPacket(rtp_header, incoming_payload) < 0) { RTC_LOG(LS_ERROR) << "AcmReceiver::InsertPacket " << static_cast(rtp_header.payloadType) << " Failed to insert packet"; diff --git a/modules/audio_coding/acm2/acm_receiver.h b/modules/audio_coding/acm2/acm_receiver.h index d631403873..21bee16d6a 100644 --- a/modules/audio_coding/acm2/acm_receiver.h +++ b/modules/audio_coding/acm2/acm_receiver.h @@ -28,7 +28,6 @@ #include "api/audio_codecs/audio_format.h" #include "api/neteq/neteq.h" #include "api/neteq/neteq_factory.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/acm2/acm_resampler.h" #include "modules/audio_coding/acm2/call_statistics.h" #include "modules/audio_coding/include/audio_coding_module_typedefs.h" @@ -71,15 +70,13 @@ class AcmReceiver { // information about payload type, sequence number, // timestamp, SSRC and marker bit. // - incoming_payload : Incoming audio payload. - // - receive_time : Timestamp when the packet has been seen on the - // network card. + // - length_payload : Length of incoming audio payload in bytes. // // Return value : 0 if OK. // <0 if NetEq returned an error. // int InsertPacket(const RTPHeader& rtp_header, - rtc::ArrayView incoming_payload, - Timestamp receive_time = Timestamp::MinusInfinity()); + rtc::ArrayView incoming_payload); // // Asks NetEq for 10 milliseconds of decoded audio. diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc index e86c718961..8b35f4a621 100644 --- a/modules/audio_coding/acm2/acm_receiver_unittest.cc +++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc @@ -16,7 +16,6 @@ #include "absl/types/optional.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/audio_codecs/builtin_audio_encoder_factory.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/codecs/cng/audio_encoder_cng.h" #include "modules/audio_coding/include/audio_coding_module.h" #include "modules/audio_coding/neteq/tools/rtp_generator.h" @@ -120,8 +119,7 @@ class AcmReceiverTestOldApi : public AudioPacketizationCallback, int ret_val = receiver_->InsertPacket( rtp_header_, - rtc::ArrayView(payload_data, payload_len_bytes), - Timestamp::MinusInfinity()); + rtc::ArrayView(payload_data, payload_len_bytes)); if (ret_val < 0) { RTC_DCHECK_NOTREACHED(); return -1; @@ -375,8 +373,7 @@ TEST_F(AcmReceiverTestOldApi, MAYBE_NetEqCalls) { for (int num_calls = 0; num_calls < kNumNormalCalls; ++num_calls) { const uint8_t kPayload[kPayloadSizeBytes] = {0}; - ASSERT_EQ(0, receiver_->InsertPacket(rtp_header, kPayload, - Timestamp::MinusInfinity())); + ASSERT_EQ(0, receiver_->InsertPacket(rtp_header, kPayload)); ++rtp_header.sequenceNumber; rtp_header.timestamp += kFrameSizeSamples; ASSERT_EQ(0, receiver_->GetAudio(-1, &audio_frame, &muted)); diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc index 7674538305..75e38bcc7f 100644 --- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc +++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc @@ -25,7 +25,6 @@ #include "api/audio_codecs/opus/audio_decoder_opus.h" #include "api/audio_codecs/opus/audio_encoder_multi_channel_opus.h" #include "api/audio_codecs/opus/audio_encoder_opus.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/acm2/acm_receive_test.h" #include "modules/audio_coding/acm2/acm_send_test.h" #include "modules/audio_coding/codecs/cng/audio_encoder_cng.h" @@ -210,10 +209,9 @@ class AudioCodingModuleTestOldApi : public ::testing::Test { virtual void InsertPacket() { const uint8_t kPayload[kPayloadSizeBytes] = {0}; - ASSERT_EQ(0, acm_receiver_->InsertPacket( - rtp_header_, - rtc::ArrayView(kPayload, kPayloadSizeBytes), - /*receive_time=*/Timestamp::MinusInfinity())); + ASSERT_EQ(0, acm_receiver_->InsertPacket(rtp_header_, + rtc::ArrayView( + kPayload, kPayloadSizeBytes))); rtp_utility_->Forward(&rtp_header_); } diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc index dcdac980b2..1ee4dc4eb7 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc @@ -193,12 +193,11 @@ NetEqImpl::NetEqImpl(const NetEq::Config& config, NetEqImpl::~NetEqImpl() = default; int NetEqImpl::InsertPacket(const RTPHeader& rtp_header, - rtc::ArrayView payload, - Timestamp receive_time) { + rtc::ArrayView payload) { rtc::MsanCheckInitialized(payload); TRACE_EVENT0("webrtc", "NetEqImpl::InsertPacket"); MutexLock lock(&mutex_); - if (InsertPacketInternal(rtp_header, payload, receive_time) != 0) { + if (InsertPacketInternal(rtp_header, payload) != 0) { return kFail; } return kOK; @@ -465,12 +464,13 @@ NetEq::Operation NetEqImpl::last_operation_for_test() const { // Methods below this line are private. int NetEqImpl::InsertPacketInternal(const RTPHeader& rtp_header, - rtc::ArrayView payload, - Timestamp receive_time) { + rtc::ArrayView payload) { if (payload.empty()) { RTC_LOG_F(LS_ERROR) << "payload is empty"; return kInvalidPointer; } + + Timestamp receive_time = clock_->CurrentTime(); stats_->ReceivedPacket(); PacketList packet_list; diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h index 8730d9a85f..f808c9ed8b 100644 --- a/modules/audio_coding/neteq/neteq_impl.h +++ b/modules/audio_coding/neteq/neteq_impl.h @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -25,7 +24,6 @@ #include "api/neteq/neteq_controller_factory.h" #include "api/neteq/tick_timer.h" #include "api/rtp_packet_info.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/neteq/audio_multi_vector.h" #include "modules/audio_coding/neteq/expand_uma_logger.h" #include "modules/audio_coding/neteq/packet.h" @@ -129,8 +127,7 @@ class NetEqImpl : public webrtc::NetEq { // 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; + rtc::ArrayView payload) override; void InsertEmptyPacket(const RTPHeader& rtp_header) override; @@ -207,8 +204,7 @@ class NetEqImpl : public webrtc::NetEq { // above. Returns 0 on success, otherwise an error code. // TODO(hlundin): Merge this with InsertPacket above? int InsertPacketInternal(const RTPHeader& rtp_header, - rtc::ArrayView payload, - Timestamp receive_time) + rtc::ArrayView payload) RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Returns true if the payload type changed (this should be followed by diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc index 9018d78488..07c924c2f2 100644 --- a/modules/audio_coding/neteq/neteq_impl_unittest.cc +++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc @@ -194,9 +194,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 = @@ -375,14 +373,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, InsertPacketsUntilBufferIsFull) { @@ -404,9 +400,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()); @@ -414,9 +408,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); @@ -502,8 +494,7 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) { // Insert one packet. clock_.AdvanceTimeMilliseconds(123456); Timestamp expected_receive_time = clock_.CurrentTime(); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, expected_receive_time)); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); // Pull audio once. const size_t kMaxOutputSize = static_cast(10 * kSampleRateHz / 1000); @@ -597,9 +588,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) { // Insert one packet. clock_.AdvanceTimeMilliseconds(123456); Timestamp expected_receive_time = clock_.CurrentTime(); - 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 = static_cast(10 * kSampleRateHz / 1000); @@ -629,18 +618,14 @@ 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(); - EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header, payload, - /*receive_time=*/clock_.CurrentTime())); + EXPECT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header, payload)); // Expect only the second packet to be decoded (the one with "2" as the first // payload byte). @@ -699,9 +684,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); @@ -722,9 +705,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()); } @@ -796,8 +777,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); @@ -895,9 +875,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) { @@ -981,9 +959,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) { @@ -1057,9 +1033,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. @@ -1148,9 +1122,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(). @@ -1248,9 +1220,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. @@ -1258,9 +1228,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; @@ -1313,9 +1281,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; } @@ -1367,9 +1333,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()); @@ -1461,9 +1425,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. @@ -1588,9 +1550,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)); @@ -1612,9 +1572,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. @@ -1668,8 +1626,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; @@ -1698,16 +1655,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); @@ -1735,16 +1688,12 @@ TEST_F(NetEqImplTest, InsertPacketChangePayloadType) { header.timestamp = 1234; uint8_t payload[160] = {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 = kPcmaPayloadType; header.timestamp += 80; - EXPECT_EQ(neteq_->InsertPacket(header, payload, - /*receive_time=*/clock_.CurrentTime()), - NetEq::kOK); + EXPECT_EQ(neteq_->InsertPacket(header, payload), NetEq::kOK); // The previous packet should be discarded since the codec changed. EXPECT_EQ(neteq_->GetLifetimeStatistics().packets_discarded, 1u); @@ -1831,9 +1780,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_++; } diff --git a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc index 69538d222c..da516982c7 100644 --- a/modules/audio_coding/neteq/neteq_network_stats_unittest.cc +++ b/modules/audio_coding/neteq/neteq_network_stats_unittest.cc @@ -238,9 +238,7 @@ class NetEqNetworkStatsTest { kPayloadType, frame_size_samples_, &rtp_header_); if (!Lost(next_send_time)) { static const uint8_t payload[kPayloadSizeByte] = {0}; - ASSERT_EQ(NetEq::kOK, - neteq_->InsertPacket(rtp_header_, payload, - Timestamp::Millis(next_send_time))); + ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket(rtp_header_, payload)); } } bool muted = true; diff --git a/modules/audio_coding/neteq/neteq_stereo_unittest.cc b/modules/audio_coding/neteq/neteq_stereo_unittest.cc index d7bd794490..6fa56fd1c1 100644 --- a/modules/audio_coding/neteq/neteq_stereo_unittest.cc +++ b/modules/audio_coding/neteq/neteq_stereo_unittest.cc @@ -18,7 +18,6 @@ #include "api/audio/audio_frame.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/neteq/neteq.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/input_audio_file.h" @@ -110,7 +109,7 @@ class NetEqStereoTest : public ::testing::TestWithParam { if (frame_size_samples_ * 2 != payload_size_bytes_) { return -1; } - int next_send_time_ms = rtp_generator_mono_.GetRtpHeader( + int next_send_time = rtp_generator_mono_.GetRtpHeader( kPayloadTypeMono, frame_size_samples_, &rtp_header_mono_); MakeMultiChannelInput(); multi_payload_size_bytes_ = WebRtcPcm16b_Encode( @@ -121,7 +120,7 @@ class NetEqStereoTest : public ::testing::TestWithParam { } rtp_generator_.GetRtpHeader(kPayloadTypeMulti, frame_size_samples_, &rtp_header_); - return next_send_time_ms; + return next_send_time; } virtual void MakeMultiChannelInput() { @@ -152,35 +151,32 @@ class NetEqStereoTest : public ::testing::TestWithParam { void RunTest(int num_loops) { // Get next input packets (mono and multi-channel). - int next_send_time_ms; - int next_arrival_time_ms; + int next_send_time; + int next_arrival_time; do { - next_send_time_ms = GetNewPackets(); - ASSERT_NE(-1, next_send_time_ms); - next_arrival_time_ms = GetArrivalTime(next_send_time_ms); + next_send_time = GetNewPackets(); + ASSERT_NE(-1, next_send_time); + next_arrival_time = GetArrivalTime(next_send_time); } while (Lost()); // If lost, immediately read the next packet. - int time_now_ms = 0; + int time_now = 0; for (int k = 0; k < num_loops; ++k) { - while (time_now_ms >= next_arrival_time_ms) { + while (time_now >= next_arrival_time) { // Insert packet in mono instance. ASSERT_EQ(NetEq::kOK, - neteq_mono_->InsertPacket(rtp_header_mono_, - rtc::ArrayView( - encoded_, payload_size_bytes_), - Timestamp::Millis(time_now_ms))); + neteq_mono_->InsertPacket( + rtp_header_mono_, rtc::ArrayView( + encoded_, payload_size_bytes_))); // Insert packet in multi-channel instance. - ASSERT_EQ(NetEq::kOK, - neteq_->InsertPacket( - rtp_header_, - rtc::ArrayView(encoded_multi_channel_, - multi_payload_size_bytes_), - Timestamp::Millis(time_now_ms))); + ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket( + rtp_header_, rtc::ArrayView( + encoded_multi_channel_, + multi_payload_size_bytes_))); // Get next input packets (mono and multi-channel). do { - next_send_time_ms = GetNewPackets(); - ASSERT_NE(-1, next_send_time_ms); - next_arrival_time_ms = GetArrivalTime(next_send_time_ms); + next_send_time = GetNewPackets(); + ASSERT_NE(-1, next_send_time); + next_arrival_time = GetArrivalTime(next_send_time); } while (Lost()); // If lost, immediately read the next packet. } // Get audio from mono instance. @@ -201,7 +197,7 @@ class NetEqStereoTest : public ::testing::TestWithParam { // Compare mono and multi-channel. ASSERT_NO_FATAL_FAILURE(VerifyOutput(output_size_samples_)); - time_now_ms += kTimeStepMs; + time_now += kTimeStepMs; clock_.AdvanceTimeMilliseconds(kTimeStepMs); } } diff --git a/modules/audio_coding/neteq/neteq_unittest.cc b/modules/audio_coding/neteq/neteq_unittest.cc index 8ebed6fa62..7104b7a6dc 100644 --- a/modules/audio_coding/neteq/neteq_unittest.cc +++ b/modules/audio_coding/neteq/neteq_unittest.cc @@ -132,7 +132,7 @@ TEST_F(NetEqDecodingTestFaxMode, TestFrameWaitingTimeStatistics) { rtp_info.ssrc = 0x1234; // Just an arbitrary SSRC. rtp_info.payloadType = 94; // PCM16b WB codec. rtp_info.markerBit = 0; - ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); } // Pull out all data. for (size_t i = 0; i < num_frames; ++i) { @@ -237,8 +237,7 @@ TEST_F(NetEqDecodingTest, UnknownPayloadType) { RTPHeader rtp_info; PopulateRtpInfo(0, 0, &rtp_info); rtp_info.payloadType = 1; // Not registered as a decoder. - EXPECT_EQ(NetEq::kFail, - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload)); } #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) @@ -253,7 +252,7 @@ TEST_F(NetEqDecodingTest, MAYBE_DecoderError) { RTPHeader rtp_info; PopulateRtpInfo(0, 0, &rtp_info); rtp_info.payloadType = 103; // iSAC, but the payload is invalid. - EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); // Set all of `out_data_` to 1, and verify that it was set to 0 by the call // to GetAudio. int16_t* out_frame_data = out_frame_.mutable_data(); @@ -341,10 +340,8 @@ class NetEqBgnTest : public NetEqDecodingTest { WebRtcPcm16b_Encode(block.data(), block.size(), payload); ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2); - ASSERT_EQ(0, neteq_->InsertPacket( - rtp_info, - rtc::ArrayView(payload, enc_len_bytes), - clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, enc_len_bytes))); output.Reset(); ASSERT_EQ(0, neteq_->GetAudio(&output, &muted)); ASSERT_EQ(1u, output.num_channels_); @@ -448,7 +445,7 @@ TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { bool muted; for (int i = 0; i < 3; ++i) { PopulateRtpInfo(seq_no, timestamp, &rtp_info); - ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); ++seq_no; timestamp += kSamples; @@ -465,10 +462,8 @@ TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { size_t payload_len; PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); // This is the first time this CNG packet is inserted. - ASSERT_EQ(0, - neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, payload_len))); // Pull audio once and make sure CNG is played. ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); @@ -481,10 +476,8 @@ TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { // Insert the same CNG packet again. Note that at this point it is old, since // we have already decoded the first copy of it. - ASSERT_EQ(0, - neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, payload_len))); // Pull audio until we have played `kCngPeriodMs` of CNG. Start at 10 ms since // we have already pulled out CNG once. @@ -504,7 +497,7 @@ TEST_F(NetEqDecodingTest, DiscardDuplicateCng) { // Insert speech again. for (int i = 0; i < 4; ++i) { PopulateRtpInfo(seq_no, timestamp, &rtp_info); - ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); ++seq_no; timestamp += kSamples; } @@ -536,8 +529,7 @@ TEST_F(NetEqDecodingTest, CngFirst) { PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); ASSERT_EQ(NetEq::kOK, neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - clock_.CurrentTime())); + rtp_info, rtc::ArrayView(payload, payload_len))); ++seq_no; timestamp += kCngPeriodSamples; @@ -553,7 +545,7 @@ TEST_F(NetEqDecodingTest, CngFirst) { do { ASSERT_LT(timeout_counter++, 20) << "Test timed out"; PopulateRtpInfo(seq_no, timestamp, &rtp_info); - ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); ++seq_no; timestamp += kSamples; @@ -579,7 +571,7 @@ class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { uint8_t payload[kPayloadBytes] = {0}; RTPHeader rtp_info; PopulateRtpInfo(0, rtp_timestamp, &rtp_info); - EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); } void InsertCngPacket(uint32_t rtp_timestamp) { @@ -588,9 +580,8 @@ class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { size_t payload_len; PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len); EXPECT_EQ(NetEq::kOK, - neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - clock_.CurrentTime())); + neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, payload_len))); } bool GetAudioReturnMuted() { @@ -800,8 +791,8 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) { uint8_t payload[kPayloadBytes] = {0}; RTPHeader rtp_info; PopulateRtpInfo(0, 0, &rtp_info); - EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); - EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); + EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload)); AudioFrame out_frame1, out_frame2; bool muted; @@ -824,9 +815,8 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) { // packet. for (int i = 0; i < 5; ++i) { PopulateRtpInfo(0, kSamples * 1000 + kSamples * i, &rtp_info); - EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); - EXPECT_EQ(0, - neteq2_->InsertPacket(rtp_info, payload, clock_.CurrentTime())); + EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); + EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload)); } int counter = 0; @@ -864,7 +854,7 @@ TEST_F(NetEqDecodingTest, TestConcealmentEvents) { for (int j = 0; j < 10; j++) { rtp_info.sequenceNumber = seq_no++; rtp_info.timestamp = rtp_info.sequenceNumber * kSamples; - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_info, payload); neteq_->GetAudio(&out_frame_, &muted); } @@ -904,7 +894,7 @@ void NetEqDecodingTestFaxMode::TestJitterBufferDelay(bool apply_packet_loss) { if (packets_sent < kNumPackets) { rtp_info.sequenceNumber = packets_sent++; rtp_info.timestamp = rtp_info.sequenceNumber * kSamples; - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_info, payload); } // Get packet. @@ -960,17 +950,17 @@ TEST_F(NetEqDecodingTestFaxMode, TestJitterBufferDelayWithAcceleration) { const uint8_t payload[kPayloadBytes] = {0}; int expected_target_delay = neteq_->TargetDelayMs() * kSamples; - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_info, payload); bool muted; neteq_->GetAudio(&out_frame_, &muted); rtp_info.sequenceNumber += 1; rtp_info.timestamp += kSamples; - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_info, payload); rtp_info.sequenceNumber += 1; rtp_info.timestamp += kSamples; - neteq_->InsertPacket(rtp_info, payload, clock_.CurrentTime()); + neteq_->InsertPacket(rtp_info, payload); expected_target_delay += neteq_->TargetDelayMs() * 2 * kSamples; // We have two packets in the buffer and kAccelerate operation will diff --git a/modules/audio_coding/neteq/test/neteq_decoding_test.cc b/modules/audio_coding/neteq/test/neteq_decoding_test.cc index 1767aa69e6..e626d09c99 100644 --- a/modules/audio_coding/neteq/test/neteq_decoding_test.cc +++ b/modules/audio_coding/neteq/test/neteq_decoding_test.cc @@ -13,7 +13,6 @@ #include "absl/strings/string_view.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/rtp_headers.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/test/result_sink.h" #include "rtc_base/strings/string_builder.h" @@ -107,11 +106,11 @@ void NetEqDecodingTest::Process() { // Ignore payload type 104 (iSAC-swb) if ISAC is not supported. if (packet_->header().payloadType != 104) #endif - ASSERT_EQ(0, neteq_->InsertPacket(packet_->header(), - rtc::ArrayView( - packet_->payload(), - packet_->payload_length_bytes()), - clock_.CurrentTime())); + ASSERT_EQ( + 0, neteq_->InsertPacket( + packet_->header(), + rtc::ArrayView( + packet_->payload(), packet_->payload_length_bytes()))); } // Get next packet. packet_ = rtp_source_->NextPacket(); @@ -240,8 +239,7 @@ void NetEqDecodingTest::WrapTest(uint16_t start_seq_no, PopulateRtpInfo(seq_no, timestamp, &rtp_info); if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) { // This sequence number was not in the set to drop. Insert it. - ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, - Timestamp::Millis(t_ms))); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); } NetEqNetworkStatistics network_stats; ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats)); @@ -300,8 +298,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor, uint8_t payload[kPayloadBytes] = {0}; RTPHeader rtp_info; PopulateRtpInfo(seq_no, timestamp, &rtp_info); - ASSERT_EQ( - 0, neteq_->InsertPacket(rtp_info, payload, Timestamp::Millis(t_ms))); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); ++seq_no; timestamp += kSamples; next_input_time_ms += static_cast(kFrameSizeMs) * drift_factor; @@ -328,10 +325,8 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor, size_t payload_len; RTPHeader rtp_info; PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); - ASSERT_EQ( - 0, neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - Timestamp::Millis(t_ms))); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, payload_len))); ++seq_no; timestamp += kCngPeriodSamples; next_input_time_ms += static_cast(kCngPeriodMs) * drift_factor; @@ -372,10 +367,8 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor, size_t payload_len; RTPHeader rtp_info; PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); - ASSERT_EQ( - 0, neteq_->InsertPacket( - rtp_info, rtc::ArrayView(payload, payload_len), - Timestamp::Millis(t_ms))); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView( + payload, payload_len))); ++seq_no; timestamp += kCngPeriodSamples; next_input_time_ms += kCngPeriodMs * drift_factor; @@ -391,8 +384,7 @@ void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor, uint8_t payload[kPayloadBytes] = {0}; RTPHeader rtp_info; PopulateRtpInfo(seq_no, timestamp, &rtp_info); - ASSERT_EQ( - 0, neteq_->InsertPacket(rtp_info, payload, Timestamp::Millis(t_ms))); + ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload)); ++seq_no; timestamp += kSamples; next_input_time_ms += kFrameSizeMs * drift_factor; diff --git a/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/modules/audio_coding/neteq/tools/neteq_performance_test.cc index a560b0d3a1..ccaa87b5e8 100644 --- a/modules/audio_coding/neteq/tools/neteq_performance_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_performance_test.cc @@ -87,8 +87,7 @@ int64_t NetEqPerformanceTest::Run(int runtime_ms, } if (!lost) { // Insert packet. - int error = neteq->InsertPacket(rtp_header, input_payload, - Timestamp::Millis(time_now_ms)); + int error = neteq->InsertPacket(rtp_header, input_payload); if (error != NetEq::kOK) return -1; } diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc index 77a0542b10..18e6091f93 100644 --- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc @@ -16,7 +16,6 @@ #include "absl/flags/flag.h" #include "absl/strings/string_view.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/audio_coding/neteq/tools/neteq_quality_test.h" #include "modules/audio_coding/neteq/tools/output_audio_file.h" @@ -416,8 +415,7 @@ int NetEqQualityTest::Transmit() { if (!PacketLost()) { int ret = neteq_->InsertPacket( rtp_header_, - rtc::ArrayView(payload_.data(), payload_size_bytes_), - Timestamp::Millis(packet_input_time_ms)); + rtc::ArrayView(payload_.data(), payload_size_bytes_)); if (ret != NetEq::kOK) return -1; Log() << "was sent."; diff --git a/modules/audio_coding/neteq/tools/neteq_test.cc b/modules/audio_coding/neteq/tools/neteq_test.cc index 7755b4e687..d47671fc11 100644 --- a/modules/audio_coding/neteq/tools/neteq_test.cc +++ b/modules/audio_coding/neteq/tools/neteq_test.cc @@ -13,7 +13,6 @@ #include #include -#include "api/units/timestamp.h" #include "modules/audio_coding/neteq/default_neteq_factory.h" #include "modules/rtp_rtcp/source/byte_io.h" #include "system_wrappers/include/clock.h" @@ -115,8 +114,7 @@ NetEqTest::SimulationStepResult NetEqTest::RunToNextGetAudio() { if (payload_data_length != 0) { int error = neteq_->InsertPacket( packet_data->header, - rtc::ArrayView(packet_data->payload), - Timestamp::Millis(time_now_ms)); + rtc::ArrayView(packet_data->payload)); if (error != NetEq::kOK && callbacks_.error_callback) { callbacks_.error_callback->OnInsertPacketError(*packet_data); } diff --git a/modules/audio_coding/test/Channel.cc b/modules/audio_coding/test/Channel.cc index f09b3572b5..8f634db4f6 100644 --- a/modules/audio_coding/test/Channel.cc +++ b/modules/audio_coding/test/Channel.cc @@ -83,8 +83,7 @@ int32_t Channel::SendData(AudioFrameType frameType, } status = _receiverACM->InsertPacket( - rtp_header, rtc::ArrayView(_payloadData, payloadDataSize), - /*receive_time=*/Timestamp::MinusInfinity()); + rtp_header, rtc::ArrayView(_payloadData, payloadDataSize)); return status; } diff --git a/modules/audio_coding/test/EncodeDecodeTest.cc b/modules/audio_coding/test/EncodeDecodeTest.cc index ef997f1bdf..cab36458e0 100644 --- a/modules/audio_coding/test/EncodeDecodeTest.cc +++ b/modules/audio_coding/test/EncodeDecodeTest.cc @@ -170,10 +170,8 @@ bool Receiver::IncomingPacket() { } EXPECT_EQ(0, _acm_receiver->InsertPacket( - _rtpHeader, - rtc::ArrayView(_incomingPayload, - _realPayloadSizeBytes), - /*receive_time=*/Timestamp::Millis(_nextTime))); + _rtpHeader, rtc::ArrayView( + _incomingPayload, _realPayloadSizeBytes))); _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload, _payloadSizeBytes, &_nextTime); if (_realPayloadSizeBytes == 0 && _rtpStream->EndOfFile()) { diff --git a/modules/audio_coding/test/PacketLossTest.cc b/modules/audio_coding/test/PacketLossTest.cc index 6b520006d5..c4f665677f 100644 --- a/modules/audio_coding/test/PacketLossTest.cc +++ b/modules/audio_coding/test/PacketLossTest.cc @@ -14,7 +14,6 @@ #include "absl/strings/string_view.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" -#include "api/units/timestamp.h" #include "rtc_base/strings/string_builder.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" @@ -59,10 +58,9 @@ bool ReceiverWithPacketLoss::IncomingPacket() { } if (!PacketLost()) { - _acm_receiver->InsertPacket(_rtpHeader, - rtc::ArrayView( - _incomingPayload, _realPayloadSizeBytes), - Timestamp::Millis(_nextTime)); + _acm_receiver->InsertPacket( + _rtpHeader, rtc::ArrayView(_incomingPayload, + _realPayloadSizeBytes)); } packet_counter_++; _realPayloadSizeBytes = _rtpStream->Read(&_rtpHeader, _incomingPayload, diff --git a/modules/audio_coding/test/TestAllCodecs.cc b/modules/audio_coding/test/TestAllCodecs.cc index 1a56fbc92b..dd51760fd1 100644 --- a/modules/audio_coding/test/TestAllCodecs.cc +++ b/modules/audio_coding/test/TestAllCodecs.cc @@ -84,8 +84,7 @@ int32_t TestPack::SendData(AudioFrameType frame_type, memcpy(payload_data_, payload_data, payload_size); status = receiver_acm_->InsertPacket( - rtp_header, rtc::ArrayView(payload_data_, payload_size), - /*receive_time=*/Timestamp::MinusInfinity()); + rtp_header, rtc::ArrayView(payload_data_, payload_size)); payload_size_ = payload_size; timestamp_diff_ = timestamp - last_in_timestamp_; diff --git a/modules/audio_coding/test/TestStereo.cc b/modules/audio_coding/test/TestStereo.cc index 4573a7e613..1e65e4a219 100644 --- a/modules/audio_coding/test/TestStereo.cc +++ b/modules/audio_coding/test/TestStereo.cc @@ -61,8 +61,7 @@ int32_t TestPackStereo::SendData(const AudioFrameType frame_type, if (lost_packet_ == false) { status = receiver_acm_->InsertPacket( - rtp_header, rtc::ArrayView(payload_data, payload_size), - /*receive_time=*/Timestamp::MinusInfinity()); + rtp_header, rtc::ArrayView(payload_data, payload_size)); if (frame_type != AudioFrameType::kAudioFrameCN) { payload_size_ = static_cast(payload_size); diff --git a/modules/audio_coding/test/target_delay_unittest.cc b/modules/audio_coding/test/target_delay_unittest.cc index cd8fb3435c..2a7162794c 100644 --- a/modules/audio_coding/test/target_delay_unittest.cc +++ b/modules/audio_coding/test/target_delay_unittest.cc @@ -13,7 +13,6 @@ #include "api/audio/audio_frame.h" #include "api/audio_codecs/builtin_audio_decoder_factory.h" #include "api/rtp_headers.h" -#include "api/units/timestamp.h" #include "modules/audio_coding/acm2/acm_receiver.h" #include "modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "modules/audio_coding/include/audio_coding_module.h" @@ -86,8 +85,7 @@ class TargetDelayTest : public ::testing::Test { rtp_header_.sequenceNumber++; ASSERT_EQ(0, receiver_.InsertPacket(rtp_header_, rtc::ArrayView( - payload_, kFrameSizeSamples * 2), - Timestamp::MinusInfinity())); + payload_, kFrameSizeSamples * 2))); } // Pull audio equivalent to the amount of audio in one RTP packet.