diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc index 7a65d8bb41d..881ab349bc2 100644 --- a/video/rtp_video_stream_receiver.cc +++ b/video/rtp_video_stream_receiver.cc @@ -21,7 +21,6 @@ #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "modules/rtp_rtcp/include/receive_statistics.h" #include "modules/rtp_rtcp/include/rtp_cvo.h" -#include "modules/rtp_rtcp/include/rtp_header_parser.h" #include "modules/rtp_rtcp/include/rtp_receiver.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/include/ulpfec_receiver.h" @@ -98,7 +97,7 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( packet_router_(packet_router), process_thread_(process_thread), ntp_estimator_(clock_), - rtp_header_parser_(RtpHeaderParser::Create()), + rtp_header_extensions_(config_.rtp.extensions), rtp_receiver_(RtpReceiver::CreateVideoReceiver(clock_, this, this, @@ -134,11 +133,6 @@ RtpVideoStreamReceiver::RtpVideoStreamReceiver( rtp_rtcp_->SetRemoteSSRC(config_.rtp.remote_ssrc); rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp); - for (size_t i = 0; i < config_.rtp.extensions.size(); ++i) { - EnableReceiveRtpHeaderExtension(config_.rtp.extensions[i].uri, - config_.rtp.extensions[i].id); - } - static const int kMaxPacketAgeToNack = 450; const int max_reordering_threshold = (config_.rtp.nack.rtp_history_ms > 0) ? kMaxPacketAgeToNack @@ -276,16 +270,16 @@ int32_t RtpVideoStreamReceiver::OnReceivedPayloadData( return 0; } -// TODO(nisse): Try to delete this method. Obstacles: It is used by -// ParseAndHandleEncapsulatingHeader, for handling Rtx packets, and -// for callbacks from |ulpfec_receiver_|. void RtpVideoStreamReceiver::OnRecoveredPacket(const uint8_t* rtp_packet, size_t rtp_packet_length) { - RTPHeader header; - if (!rtp_header_parser_->Parse(rtp_packet, rtp_packet_length, &header)) { + RtpPacketReceived packet; + if (!packet.Parse(rtp_packet, rtp_packet_length)) return; - } - header.payload_type_frequency = kVideoPayloadTypeFrequency; + packet.IdentifyExtensions(rtp_header_extensions_); + packet.set_payload_type_frequency(kVideoPayloadTypeFrequency); + + RTPHeader header; + packet.GetHeader(&header); bool in_order = IsPacketInOrder(header); ReceivePacket(rtp_packet, rtp_packet_length, header, in_order); } @@ -646,16 +640,6 @@ void RtpVideoStreamReceiver::UpdateHistograms() { } } -void RtpVideoStreamReceiver::EnableReceiveRtpHeaderExtension( - const std::string& extension, int id) { - // One-byte-extension local identifiers are in the range 1-14 inclusive. - RTC_DCHECK_GE(id, 1); - RTC_DCHECK_LE(id, 14); - RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); - RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( - StringToRtpExtensionType(extension), id)); -} - void RtpVideoStreamReceiver::InsertSpsPpsIntoTracker(uint8_t payload_type) { auto codec_params_it = pt_codec_params_.find(payload_type); if (codec_params_it == pt_codec_params_.end()) diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h index 0b8ecd93e7c..18743bb0f1c 100644 --- a/video/rtp_video_stream_receiver.h +++ b/video/rtp_video_stream_receiver.h @@ -23,6 +23,7 @@ #include "modules/rtp_rtcp/include/receive_statistics.h" #include "modules/rtp_rtcp/include/remote_ntp_time_estimator.h" #include "modules/rtp_rtcp/include/rtp_payload_registry.h" +#include "modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/video_coding/h264_sps_pps_tracker.h" @@ -166,7 +167,6 @@ class RtpVideoStreamReceiver : public RtpData, bool IsPacketInOrder(const RTPHeader& header) const; bool IsPacketRetransmitted(const RTPHeader& header, bool in_order) const; void UpdateHistograms(); - void EnableReceiveRtpHeaderExtension(const std::string& extension, int id); bool IsRedEnabled() const; void InsertSpsPpsIntoTracker(uint8_t payload_type); @@ -179,7 +179,7 @@ class RtpVideoStreamReceiver : public RtpData, RemoteNtpTimeEstimator ntp_estimator_; RTPPayloadRegistry rtp_payload_registry_; - const std::unique_ptr rtp_header_parser_; + RtpHeaderExtensionMap rtp_header_extensions_; const std::unique_ptr rtp_receiver_; ReceiveStatistics* const rtp_receive_statistics_; std::unique_ptr ulpfec_receiver_;