Skip to content

Commit

Permalink
Reorganize config of RTP header extensions for video receive streams.
Browse files Browse the repository at this point in the history
Bug: webrtc:6847
Change-Id: Iae2386e55520601883379fc7802a5c5246be935e
Reviewed-on: https://webrtc-review.googlesource.com/2001
Reviewed-by: Erik Språng <[email protected]>
Reviewed-by: Danil Chapovalov <[email protected]>
Reviewed-by: Rasmus Brandt <[email protected]>
Commit-Queue: Niels Moller <[email protected]>
Cr-Commit-Position: refs/heads/master@{#19943}
  • Loading branch information
Niels Möller authored and Commit Bot committed Sep 25, 2017
1 parent 0bf6071 commit b0573bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
32 changes: 8 additions & 24 deletions video/rtp_video_stream_receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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())
Expand Down
4 changes: 2 additions & 2 deletions video/rtp_video_stream_receiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand All @@ -179,7 +179,7 @@ class RtpVideoStreamReceiver : public RtpData,
RemoteNtpTimeEstimator ntp_estimator_;
RTPPayloadRegistry rtp_payload_registry_;

const std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
RtpHeaderExtensionMap rtp_header_extensions_;
const std::unique_ptr<RtpReceiver> rtp_receiver_;
ReceiveStatistics* const rtp_receive_statistics_;
std::unique_ptr<UlpfecReceiver> ulpfec_receiver_;
Expand Down

0 comments on commit b0573bc

Please sign in to comment.