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

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2844643002: Add warning about timestamp non-monotonicity in the frame buffer. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 FrameBuffer::FrameBuffer(Clock* clock, 37 FrameBuffer::FrameBuffer(Clock* clock,
38 VCMJitterEstimator* jitter_estimator, 38 VCMJitterEstimator* jitter_estimator,
39 VCMTiming* timing, 39 VCMTiming* timing,
40 VCMReceiveStatisticsCallback* stats_callback) 40 VCMReceiveStatisticsCallback* stats_callback)
41 : clock_(clock), 41 : clock_(clock),
42 new_continuous_frame_event_(false, false), 42 new_continuous_frame_event_(false, false),
43 jitter_estimator_(jitter_estimator), 43 jitter_estimator_(jitter_estimator),
44 timing_(timing), 44 timing_(timing),
45 inter_frame_delay_(clock_->TimeInMilliseconds()), 45 inter_frame_delay_(clock_->TimeInMilliseconds()),
46 last_decoded_frame_picture_id_(-1),
46 last_decoded_frame_it_(frames_.end()), 47 last_decoded_frame_it_(frames_.end()),
47 last_continuous_frame_it_(frames_.end()), 48 last_continuous_frame_it_(frames_.end()),
48 num_frames_history_(0), 49 num_frames_history_(0),
49 num_frames_buffered_(0), 50 num_frames_buffered_(0),
50 stopped_(false), 51 stopped_(false),
51 protection_mode_(kProtectionNack), 52 protection_mode_(kProtectionNack),
52 stats_callback_(stats_callback) {} 53 stats_callback_(stats_callback) {}
53 54
54 FrameBuffer::~FrameBuffer() {} 55 FrameBuffer::~FrameBuffer() {}
55 56
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 138
138 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0; 139 float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
139 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult)); 140 timing_->SetJitterDelay(jitter_estimator_->GetJitterEstimate(rtt_mult));
140 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms); 141 timing_->UpdateCurrentDelay(frame->RenderTime(), now_ms);
141 } 142 }
142 143
143 UpdateJitterDelay(); 144 UpdateJitterDelay();
144 145
145 PropagateDecodability(next_frame_it_->second); 146 PropagateDecodability(next_frame_it_->second);
146 AdvanceLastDecodedFrame(next_frame_it_); 147 AdvanceLastDecodedFrame(next_frame_it_);
148 if (last_decoded_frame_picture_id_ != -1 &&
149 AheadOrAt(last_decoded_frame_timestamp_, frame->timestamp)) {
150 LOG(LS_WARNING) << "Sending frame "
151 << "(timestamp = " << frame->timestamp
152 << ", picture_id = " << frame->picture_id
153 << ") to decoder when last decoded frame was "
154 << "(timestamp = " << last_decoded_frame_timestamp_
155 << ", picture_id = " << last_decoded_frame_picture_id_
156 << ").";
stefan-webrtc 2017/04/26 09:04:57 Should we drop the frame if this is the case, or i
brandtr 2017/04/26 09:43:51 In order to avoid distortions due to incorrect dec
stefan-webrtc 2017/04/26 10:44:49 We have no plans of supporting interleaved packeti
philipel 2017/04/26 11:05:31 I think a reset might be the right thing to do, no
157 }
147 last_decoded_frame_timestamp_ = frame->timestamp; 158 last_decoded_frame_timestamp_ = frame->timestamp;
159 last_decoded_frame_picture_id_ = frame->picture_id;
148 *frame_out = std::move(frame); 160 *frame_out = std::move(frame);
149 return kFrameFound; 161 return kFrameFound;
150 } 162 }
151 } 163 }
152 164
153 if (latest_return_time_ms - now_ms > 0) { 165 if (latest_return_time_ms - now_ms > 0) {
154 // If |next_frame_it_ == frames_.end()| and there is still time left, it 166 // If |next_frame_it_ == frames_.end()| and there is still time left, it
155 // means that the frame buffer was cleared as the thread in this function 167 // means that the frame buffer was cleared as the thread in this function
156 // was waiting to acquire |crit_| in order to return. Wait for the 168 // was waiting to acquire |crit_| in order to return. Wait for the
157 // remaining time and then return. 169 // remaining time and then return.
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 frames_.clear(); 452 frames_.clear();
441 last_decoded_frame_it_ = frames_.end(); 453 last_decoded_frame_it_ = frames_.end();
442 last_continuous_frame_it_ = frames_.end(); 454 last_continuous_frame_it_ = frames_.end();
443 next_frame_it_ = frames_.end(); 455 next_frame_it_ = frames_.end();
444 num_frames_history_ = 0; 456 num_frames_history_ = 0;
445 num_frames_buffered_ = 0; 457 num_frames_buffered_ = 0;
446 } 458 }
447 459
448 } // namespace video_coding 460 } // namespace video_coding
449 } // namespace webrtc 461 } // namespace webrtc
OLDNEW
« webrtc/modules/video_coding/frame_buffer2.h ('K') | « webrtc/modules/video_coding/frame_buffer2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698