Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: webrtc/video/rtp_stream_receiver.cc

Issue 1929313002: Removed all RTP dependencies from ViEChannel and renamed class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/video/rtp_stream_receiver.cc
diff --git a/webrtc/video/rtp_stream_receiver.cc b/webrtc/video/rtp_stream_receiver.cc
index 6421190e9812c0d26fa6868003d13e115f442075..fe8f7a129d9c67504426226167d17d1669738a0d 100644
--- a/webrtc/video/rtp_stream_receiver.cc
+++ b/webrtc/video/rtp_stream_receiver.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "webrtc/base/logging.h"
+#include "webrtc/common_types.h"
#include "webrtc/config.h"
#include "webrtc/modules/pacing/packet_router.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
@@ -64,7 +65,6 @@ std::unique_ptr<RtpRtcp> CreateRtpRtcpModule(
return rtp_rtcp;
}
-
static const int kPacketLogIntervalMs = 10000;
RtpStreamReceiver::RtpStreamReceiver(
@@ -73,7 +73,11 @@ RtpStreamReceiver::RtpStreamReceiver(
Transport* transport,
RtcpRttStats* rtt_stats,
PacedSender* paced_sender,
- PacketRouter* packet_router)
+ PacketRouter* packet_router,
+ const VideoReceiveStream::Config& config,
+ StreamDataCountersCallback* stream_data_counters_callback,
+ RtcpStatisticsCallback* rtcp_statistics_callback,
+ RtcpPacketTypeCounterObserver* rtcp_counter_observer)
: clock_(Clock::GetRealTimeClock()),
video_receiver_(video_receiver),
remote_bitrate_estimator_(remote_bitrate_estimator),
@@ -93,12 +97,30 @@ RtpStreamReceiver::RtpStreamReceiver(
rtp_rtcp_(CreateRtpRtcpModule(rtp_receive_statistics_.get(),
transport,
rtt_stats,
- &rtcp_packet_type_counter_observer_,
+ rtcp_counter_observer,
remote_bitrate_estimator_,
paced_sender,
packet_router)) {
packet_router_->AddRtpModule(rtp_rtcp_.get());
+ rtp_receive_statistics_->RegisterRtpStatisticsCallback(
+ stream_data_counters_callback);
+ rtp_receive_statistics_->RegisterRtcpStatisticsCallback(
+ rtcp_statistics_callback);
+
+ RTC_DCHECK(config.rtp.rtcp_mode != RtcpMode::kOff)
+ << "A stream should not be configured with RTCP disabled. This value is "
+ "reserved for internal usage.";
+ rtp_rtcp_->SetRTCPStatus(config.rtp.rtcp_mode);
rtp_rtcp_->SetKeyFrameRequestMethod(kKeyFrameReqPliRtcp);
+
+ static const int kMaxPacketAgeToNack = 450;
+ NACKMethod nack_method =
+ config.rtp.nack.rtp_history_ms > 0 ? kNackRtcp : kNackOff;
+ const int max_reordering_threshold = (nack_method == kNackRtcp)
+ ? kMaxPacketAgeToNack : kDefaultMaxReorderingThreshold;
+ rtp_receiver_->SetNACKStatus(nack_method);
+ rtp_receive_statistics_->SetMaxReorderingThreshold(max_reordering_threshold);
+ rtp_rtcp_->SetGenericFECStatus(false, 0, 0);
}
RtpStreamReceiver::~RtpStreamReceiver() {
@@ -134,18 +156,6 @@ bool RtpStreamReceiver::SetReceiveCodec(const VideoCodec& video_codec) {
0, 0) == 0;
}
-void RtpStreamReceiver::SetNackStatus(bool enable,
- int max_nack_reordering_threshold) {
- if (!enable) {
- // Reset the threshold back to the lower default threshold when NACK is
- // disabled since we no longer will be receiving retransmissions.
- max_nack_reordering_threshold = kDefaultMaxReorderingThreshold;
- }
- rtp_receive_statistics_->SetMaxReorderingThreshold(
- max_nack_reordering_threshold);
- rtp_receiver_->SetNACKStatus(enable ? kNackRtcp : kNackOff);
-}
-
void RtpStreamReceiver::SetRtxPayloadType(int payload_type,
int associated_payload_type) {
rtp_payload_registry_.SetRtxPayloadType(payload_type,
@@ -187,12 +197,6 @@ void RtpStreamReceiver::EnableReceiveRtpHeaderExtension(
StringToRtpExtensionType(extension), id));
}
-void RtpStreamReceiver::RegisterRtcpPacketTypeCounterObserver(
- RtcpPacketTypeCounterObserver* observer) {
- rtcp_packet_type_counter_observer_.Set(observer);
-}
-
-
int32_t RtpStreamReceiver::OnReceivedPayloadData(
const uint8_t* payload_data,
const size_t payload_size,
@@ -293,6 +297,21 @@ bool RtpStreamReceiver::DeliverRtp(const uint8_t* rtp_packet,
return ret;
}
+int32_t RtpStreamReceiver::RequestKeyFrame() {
+ return rtp_rtcp_->RequestKeyFrame();
+}
+
+int32_t RtpStreamReceiver::SliceLossIndicationRequest(
+ const uint64_t picture_id) {
+ return rtp_rtcp_->SendRTCPSliceLossIndication(
+ static_cast<uint8_t>(picture_id));
+}
+
+int32_t RtpStreamReceiver::ResendPackets(const uint16_t* sequence_numbers,
+ uint16_t length) {
+ return rtp_rtcp_->SendNACK(sequence_numbers, length);
+}
+
bool RtpStreamReceiver::ReceivePacket(const uint8_t* packet,
size_t packet_length,
const RTPHeader& header,

Powered by Google App Engine
This is Rietveld 408576698