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

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

Issue 2870823003: Configured VCMTiming with sender defining delay times. (Closed)
Patch Set: empty Created 3 years, 7 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_timestamp_(0),
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 stopped_ = false; 201 stopped_ = false;
201 } 202 }
202 203
203 void FrameBuffer::Stop() { 204 void FrameBuffer::Stop() {
204 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); 205 TRACE_EVENT0("webrtc", "FrameBuffer::Stop");
205 rtc::CritScope lock(&crit_); 206 rtc::CritScope lock(&crit_);
206 stopped_ = true; 207 stopped_ = true;
207 new_continuous_frame_event_.Set(); 208 new_continuous_frame_event_.Set();
208 } 209 }
209 210
211 void FrameBuffer::UpdatePlayoutDelays(const FrameObject& frame) {
212 TRACE_EVENT0("webrtc", "FrameBuffer::UpdatePlayoutDelays");
213 PlayoutDelay playout_delay = frame.EncodedImage().playout_delay_;
214 if (playout_delay.min_ms >= 0)
215 timing_->set_min_playout_delay(playout_delay.min_ms);
216
217 if (playout_delay.max_ms >= 0)
218 timing_->set_max_playout_delay(playout_delay.max_ms);
219 }
220
210 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { 221 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
211 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); 222 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame");
212 RTC_DCHECK(frame); 223 RTC_DCHECK(frame);
213 if (stats_callback_) 224 if (stats_callback_)
214 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); 225 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size());
215 FrameKey key(frame->picture_id, frame->spatial_layer); 226 FrameKey key(frame->picture_id, frame->spatial_layer);
216 227
217 rtc::CritScope lock(&crit_); 228 rtc::CritScope lock(&crit_);
218 229
219 int last_continuous_picture_id = 230 int last_continuous_picture_id =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 287
277 if (info->second.frame) { 288 if (info->second.frame) {
278 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id 289 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id
279 << ":" << static_cast<int>(key.spatial_layer) 290 << ":" << static_cast<int>(key.spatial_layer)
280 << ") already inserted, dropping frame."; 291 << ") already inserted, dropping frame.";
281 return last_continuous_picture_id; 292 return last_continuous_picture_id;
282 } 293 }
283 294
284 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) 295 if (!UpdateFrameInfoWithIncomingFrame(*frame, info))
285 return last_continuous_picture_id; 296 return last_continuous_picture_id;
286 297 UpdatePlayoutDelays(*frame);
287 info->second.frame = std::move(frame); 298 info->second.frame = std::move(frame);
288 ++num_frames_buffered_; 299 ++num_frames_buffered_;
289 300
290 if (info->second.num_missing_continuous == 0) { 301 if (info->second.num_missing_continuous == 0) {
291 info->second.continuous = true; 302 info->second.continuous = true;
292 PropagateContinuity(info); 303 PropagateContinuity(info);
293 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id; 304 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id;
294 305
295 // Since we now have new continuous frames there might be a better frame 306 // Since we now have new continuous frames there might be a better frame
296 // to return from NextFrame. Signal that thread so that it again can choose 307 // to return from NextFrame. Signal that thread so that it again can choose
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 frames_.clear(); 478 frames_.clear();
468 last_decoded_frame_it_ = frames_.end(); 479 last_decoded_frame_it_ = frames_.end();
469 last_continuous_frame_it_ = frames_.end(); 480 last_continuous_frame_it_ = frames_.end();
470 next_frame_it_ = frames_.end(); 481 next_frame_it_ = frames_.end();
471 num_frames_history_ = 0; 482 num_frames_history_ = 0;
472 num_frames_buffered_ = 0; 483 num_frames_buffered_ = 0;
473 } 484 }
474 485
475 } // namespace video_coding 486 } // namespace video_coding
476 } // namespace webrtc 487 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/modules/video_coding/frame_buffer2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698