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

Unified Diff: webrtc/video/video_receive_stream.cc

Issue 2642753002: Reland of Make the new jitter buffer the default jitter buffer. (Closed)
Patch Set: Rebase 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/video_receive_stream.h ('k') | webrtc/video/video_stream_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_receive_stream.cc
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index 183f72b537fcf9e6f75afb6bfebe44eaf648275a..7835e779b0dca5aa11fe5c79f20a3976bd47b9c5 100644
--- a/webrtc/video/video_receive_stream.cc
+++ b/webrtc/video/video_receive_stream.cc
@@ -223,10 +223,7 @@ VideoReceiveStream::VideoReceiveStream(
this, // KeyFrameRequestSender
this, // OnCompleteFrameCallback
timing_.get()),
- rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_),
- jitter_buffer_experiment_(
- field_trial::FindFullName("WebRTC-NewVideoJitterBuffer") ==
- "Enabled") {
+ rtp_stream_sync_(&video_receiver_, &rtp_stream_receiver_) {
LOG(LS_INFO) << "VideoReceiveStream: " << config_.ToString();
RTC_DCHECK(process_thread_);
@@ -246,11 +243,9 @@ VideoReceiveStream::VideoReceiveStream(
video_receiver_.SetRenderDelay(config.render_delay_ms);
- if (jitter_buffer_experiment_) {
- jitter_estimator_.reset(new VCMJitterEstimator(clock_));
- frame_buffer_.reset(new video_coding::FrameBuffer(
- clock_, jitter_estimator_.get(), timing_.get()));
- }
+ jitter_estimator_.reset(new VCMJitterEstimator(clock_));
+ frame_buffer_.reset(new video_coding::FrameBuffer(
+ clock_, jitter_estimator_.get(), timing_.get(), &stats_proxy_));
process_thread_->RegisterModule(&video_receiver_);
process_thread_->RegisterModule(&rtp_stream_sync_);
@@ -290,15 +285,15 @@ bool VideoReceiveStream::OnRecoveredPacket(const uint8_t* packet,
void VideoReceiveStream::Start() {
if (decode_thread_.IsRunning())
return;
- if (jitter_buffer_experiment_) {
- frame_buffer_->Start();
- call_stats_->RegisterStatsObserver(&rtp_stream_receiver_);
- if (rtp_stream_receiver_.IsRetransmissionsEnabled() &&
- rtp_stream_receiver_.IsUlpfecEnabled()) {
- frame_buffer_->SetProtectionMode(kProtectionNackFEC);
- }
+ frame_buffer_->Start();
+ call_stats_->RegisterStatsObserver(&rtp_stream_receiver_);
+
+ if (rtp_stream_receiver_.IsRetransmissionsEnabled() &&
+ rtp_stream_receiver_.IsUlpfecEnabled()) {
+ frame_buffer_->SetProtectionMode(kProtectionNackFEC);
}
+
transport_adapter_.Enable();
rtc::VideoSinkInterface<VideoFrame>* renderer = nullptr;
if (config_.renderer) {
@@ -343,10 +338,8 @@ void VideoReceiveStream::Stop() {
// before joining the decoder thread thread.
video_receiver_.TriggerDecoderShutdown();
- if (jitter_buffer_experiment_) {
- frame_buffer_->Stop();
- call_stats_->DeregisterStatsObserver(&rtp_stream_receiver_);
- }
+ frame_buffer_->Stop();
+ call_stats_->DeregisterStatsObserver(&rtp_stream_receiver_);
if (decode_thread_.IsRunning()) {
decode_thread_.Stop();
@@ -442,26 +435,21 @@ bool VideoReceiveStream::DecodeThreadFunction(void* ptr) {
}
void VideoReceiveStream::Decode() {
- static const int kMaxDecodeWaitTimeMs = 50;
- if (jitter_buffer_experiment_) {
- static const int kMaxWaitForFrameMs = 3000;
- std::unique_ptr<video_coding::FrameObject> frame;
- video_coding::FrameBuffer::ReturnReason res =
- frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame);
-
- if (res == video_coding::FrameBuffer::ReturnReason::kStopped)
- return;
-
- if (frame) {
- if (video_receiver_.Decode(frame.get()) == VCM_OK)
- rtp_stream_receiver_.FrameDecoded(frame->picture_id);
- } else {
- LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
- << " ms, requesting keyframe.";
- RequestKeyFrame();
- }
+ static const int kMaxWaitForFrameMs = 3000;
+ std::unique_ptr<video_coding::FrameObject> frame;
+ video_coding::FrameBuffer::ReturnReason res =
+ frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame);
+
+ if (res == video_coding::FrameBuffer::ReturnReason::kStopped)
+ return;
+
+ if (frame) {
+ if (video_receiver_.Decode(frame.get()) == VCM_OK)
+ rtp_stream_receiver_.FrameDecoded(frame->picture_id);
} else {
- video_receiver_.Decode(kMaxDecodeWaitTimeMs);
+ LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
+ << " ms, requesting keyframe.";
+ RequestKeyFrame();
}
}
« no previous file with comments | « webrtc/video/video_receive_stream.h ('k') | webrtc/video/video_stream_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698