diff options
author | Niels Möller <nisse@webrtc.org> | 2018-08-16 13:47:49 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2018-08-16 14:44:25 +0000 |
commit | fa2b2d62d77d4ca4e0cc04d0cc0702864e59db52 (patch) | |
tree | 2269b06ec4c7e6f7f31f8ac0fc04968698c3695e /audio | |
parent | e23b8a9899a1bdb1a1d810a9cc08c65dbb927dd9 (diff) | |
download | webrtc-fa2b2d62d77d4ca4e0cc04d0cc0702864e59db52.tar.gz |
Delete use of RtpPayloadRegistry.
Use in voe::Channel replaced by a std::map storing payload type frequencies.
This is a followup to
https://webrtc-review.googlesource.com/c/src/+/93820.
Bug: webrtc:7135
Change-Id: I874b706aee19fdc2d841db42a540e4f7aa2725f1
Reviewed-on: https://webrtc-review.googlesource.com/94508
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24315}
Diffstat (limited to 'audio')
-rw-r--r-- | audio/channel.cc | 27 | ||||
-rw-r--r-- | audio/channel.h | 6 |
2 files changed, 15 insertions, 18 deletions
diff --git a/audio/channel.cc b/audio/channel.cc index 4f9a0f1f8a..90443645ae 100644 --- a/audio/channel.cc +++ b/audio/channel.cc @@ -29,7 +29,6 @@ #include "modules/audio_processing/include/audio_processing.h" #include "modules/pacing/packet_router.h" #include "modules/rtp_rtcp/include/receive_statistics.h" -#include "modules/rtp_rtcp/include/rtp_payload_registry.h" #include "modules/rtp_rtcp/source/rtp_packet_received.h" #include "modules/rtp_rtcp/source/rtp_receiver_strategy.h" #include "modules/utility/include/process_thread.h" @@ -495,7 +494,6 @@ Channel::Channel(ProcessThread* module_process_thread, rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, absl::optional<AudioCodecPairId> codec_pair_id) : event_log_(rtc_event_log), - rtp_payload_registry_(new RTPPayloadRegistry()), rtp_receive_statistics_( ReceiveStatistics::Create(Clock::GetRealTimeClock())), remote_ssrc_(remote_ssrc), @@ -809,7 +807,10 @@ void Channel::OnUplinkPacketLossRate(float packet_loss_rate) { } void Channel::SetReceiveCodecs(const std::map<int, SdpAudioFormat>& codecs) { - rtp_payload_registry_->SetAudioReceivePayloads(codecs); + for (const auto& kv : codecs) { + RTC_DCHECK_GE(kv.second.clockrate_hz, 1000); + payload_type_frequencies_[kv.first] = kv.second.clockrate_hz; + } audio_coding_->SetReceiveCodecs(codecs); } @@ -870,14 +871,15 @@ void Channel::OnRtpPacket(const RtpPacketReceived& packet) { // Store playout timestamp for the received RTP packet UpdatePlayoutTimestamp(false); - header.payload_type_frequency = - rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); - if (header.payload_type_frequency >= 0) { - rtp_receive_statistics_->IncomingPacket(header, packet.size(), - IsPacketRetransmitted(header)); + const auto& it = payload_type_frequencies_.find(header.payloadType); + if (it == payload_type_frequencies_.end()) + return; + header.payload_type_frequency = it->second; - ReceivePacket(packet.data(), packet.size(), header); - } + rtp_receive_statistics_->IncomingPacket(header, packet.size(), + IsPacketRetransmitted(header)); + + ReceivePacket(packet.data(), packet.size(), header); } bool Channel::ReceivePacket(const uint8_t* packet, @@ -886,11 +888,6 @@ bool Channel::ReceivePacket(const uint8_t* packet, const uint8_t* payload = packet + header.headerLength; assert(packet_length >= header.headerLength); size_t payload_length = packet_length - header.headerLength; - const auto pl = - rtp_payload_registry_->PayloadTypeToPayload(header.payloadType); - if (!pl) { - return false; - } WebRtcRTPHeader webrtc_rtp_header = {}; webrtc_rtp_header.header = header; diff --git a/audio/channel.h b/audio/channel.h index 0676dbabf4..98f2613492 100644 --- a/audio/channel.h +++ b/audio/channel.h @@ -53,8 +53,6 @@ class RateLimiter; class ReceiveStatistics; class RemoteNtpTimeEstimator; class RtcEventLog; -class RTPPayloadRegistry; -class RTPReceiverAudio; class RtpPacketReceived; class RtpRtcp; class RtpTransportControllerSendInterface; @@ -340,7 +338,9 @@ class Channel RtcEventLog* const event_log_; - std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_; + // Indexed by payload type. + std::map<uint8_t, int> payload_type_frequencies_; + std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_; std::unique_ptr<RtpRtcp> _rtpRtcpModule; const uint32_t remote_ssrc_; |