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

Unified Diff: webrtc/video/rtp_stream_receiver.cc

Issue 2638423003: Revert of Make the new jitter buffer the default jitter buffer. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « webrtc/video/rtp_stream_receiver.h ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/rtp_stream_receiver.cc
diff --git a/webrtc/video/rtp_stream_receiver.cc b/webrtc/video/rtp_stream_receiver.cc
index e75169ab89fdaaf91d7294e40b69f2cf5a6b65e9..d2360858729993b3432006b746bc0c54516d729b 100644
--- a/webrtc/video/rtp_stream_receiver.cc
+++ b/webrtc/video/rtp_stream_receiver.cc
@@ -199,21 +199,25 @@
process_thread_->RegisterModule(rtp_rtcp_.get());
- nack_module_.reset(
- new NackModule(clock_, nack_sender, keyframe_request_sender));
- if (config_.rtp.nack.rtp_history_ms == 0)
- nack_module_->Stop();
- process_thread_->RegisterModule(nack_module_.get());
-
- packet_buffer_ = video_coding::PacketBuffer::Create(
- clock_, kPacketBufferStartSize, kPacketBufferMaxSixe, this);
- reference_finder_.reset(new video_coding::RtpFrameReferenceFinder(this));
+ jitter_buffer_experiment_ =
+ field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") == "Enabled";
+
+ if (jitter_buffer_experiment_) {
+ nack_module_.reset(
+ new NackModule(clock_, nack_sender, keyframe_request_sender));
+ process_thread_->RegisterModule(nack_module_.get());
+
+ packet_buffer_ = video_coding::PacketBuffer::Create(
+ clock_, kPacketBufferStartSize, kPacketBufferMaxSixe, this);
+ reference_finder_.reset(new video_coding::RtpFrameReferenceFinder(this));
+ }
}
RtpStreamReceiver::~RtpStreamReceiver() {
process_thread_->DeRegisterModule(rtp_rtcp_.get());
- process_thread_->DeRegisterModule(nack_module_.get());
+ if (jitter_buffer_experiment_)
+ process_thread_->DeRegisterModule(nack_module_.get());
packet_router_->RemoveRtpModule(rtp_rtcp_.get());
rtp_rtcp_->SetREMBStatus(false);
@@ -257,35 +261,43 @@
WebRtcRTPHeader rtp_header_with_ntp = *rtp_header;
rtp_header_with_ntp.ntp_time_ms =
ntp_estimator_.Estimate(rtp_header->header.timestamp);
- VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp);
- timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
- packet.timesNacked = nack_module_->OnReceivedPacket(packet);
-
- if (packet.codec == kVideoCodecH264) {
- // Only when we start to receive packets will we know what payload type
- // that will be used. When we know the payload type insert the correct
- // sps/pps into the tracker.
- if (packet.payloadType != last_payload_type_) {
- last_payload_type_ = packet.payloadType;
- InsertSpsPpsIntoTracker(packet.payloadType);
- }
-
- switch (tracker_.CopyAndFixBitstream(&packet)) {
- case video_coding::H264SpsPpsTracker::kRequestKeyframe:
- keyframe_request_sender_->RequestKeyFrame();
- FALLTHROUGH();
- case video_coding::H264SpsPpsTracker::kDrop:
- return 0;
- case video_coding::H264SpsPpsTracker::kInsert:
- break;
- }
+ if (jitter_buffer_experiment_) {
+ VCMPacket packet(payload_data, payload_size, rtp_header_with_ntp);
+ timing_->IncomingTimestamp(packet.timestamp, clock_->TimeInMilliseconds());
+ packet.timesNacked = nack_module_->OnReceivedPacket(packet);
+
+ if (packet.codec == kVideoCodecH264) {
+ // Only when we start to receive packets will we know what payload type
+ // that will be used. When we know the payload type insert the correct
+ // sps/pps into the tracker.
+ if (packet.payloadType != last_payload_type_) {
+ last_payload_type_ = packet.payloadType;
+ InsertSpsPpsIntoTracker(packet.payloadType);
+ }
+
+ switch (tracker_.CopyAndFixBitstream(&packet)) {
+ case video_coding::H264SpsPpsTracker::kRequestKeyframe:
+ keyframe_request_sender_->RequestKeyFrame();
+ FALLTHROUGH();
+ case video_coding::H264SpsPpsTracker::kDrop:
+ return 0;
+ case video_coding::H264SpsPpsTracker::kInsert:
+ break;
+ }
+ } else {
+ uint8_t* data = new uint8_t[packet.sizeBytes];
+ memcpy(data, packet.dataPtr, packet.sizeBytes);
+ packet.dataPtr = data;
+ }
+
+ packet_buffer_->InsertPacket(&packet);
} else {
- uint8_t* data = new uint8_t[packet.sizeBytes];
- memcpy(data, packet.dataPtr, packet.sizeBytes);
- packet.dataPtr = data;
- }
-
- packet_buffer_->InsertPacket(&packet);
+ if (video_receiver_->IncomingPacket(payload_data, payload_size,
+ rtp_header_with_ntp) != 0) {
+ // Check this...
+ return -1;
+ }
+ }
return 0;
}
@@ -422,7 +434,8 @@
}
void RtpStreamReceiver::OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) {
- nack_module_->UpdateRtt(max_rtt_ms);
+ if (jitter_buffer_experiment_)
+ nack_module_->UpdateRtt(max_rtt_ms);
}
bool RtpStreamReceiver::ReceivePacket(const uint8_t* packet,
@@ -550,31 +563,35 @@
}
void RtpStreamReceiver::FrameContinuous(uint16_t picture_id) {
- int seq_num = -1;
- {
- rtc::CritScope lock(&last_seq_num_cs_);
- auto seq_num_it = last_seq_num_for_pic_id_.find(picture_id);
- if (seq_num_it != last_seq_num_for_pic_id_.end())
- seq_num = seq_num_it->second;
- }
- if (seq_num != -1)
- nack_module_->ClearUpTo(seq_num);
+ if (jitter_buffer_experiment_) {
+ int seq_num = -1;
+ {
+ rtc::CritScope lock(&last_seq_num_cs_);
+ auto seq_num_it = last_seq_num_for_pic_id_.find(picture_id);
+ if (seq_num_it != last_seq_num_for_pic_id_.end())
+ seq_num = seq_num_it->second;
+ }
+ if (seq_num != -1)
+ nack_module_->ClearUpTo(seq_num);
+ }
}
void RtpStreamReceiver::FrameDecoded(uint16_t picture_id) {
- int seq_num = -1;
- {
- rtc::CritScope lock(&last_seq_num_cs_);
- auto seq_num_it = last_seq_num_for_pic_id_.find(picture_id);
- if (seq_num_it != last_seq_num_for_pic_id_.end()) {
- seq_num = seq_num_it->second;
- last_seq_num_for_pic_id_.erase(last_seq_num_for_pic_id_.begin(),
- ++seq_num_it);
- }
- }
- if (seq_num != -1) {
- packet_buffer_->ClearTo(seq_num);
- reference_finder_->ClearTo(seq_num);
+ if (jitter_buffer_experiment_) {
+ int seq_num = -1;
+ {
+ rtc::CritScope lock(&last_seq_num_cs_);
+ auto seq_num_it = last_seq_num_for_pic_id_.find(picture_id);
+ if (seq_num_it != last_seq_num_for_pic_id_.end()) {
+ seq_num = seq_num_it->second;
+ last_seq_num_for_pic_id_.erase(last_seq_num_for_pic_id_.begin(),
+ ++seq_num_it);
+ }
+ }
+ if (seq_num != -1) {
+ packet_buffer_->ClearTo(seq_num);
+ reference_finder_->ClearTo(seq_num);
+ }
}
}
« no previous file with comments | « webrtc/video/rtp_stream_receiver.h ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698