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

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

Issue 2890943002: Configured VCMTiming with sender defining delay times. (Closed)
Patch Set: 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 stopped_ = false; 174 stopped_ = false;
174 } 175 }
175 176
176 void FrameBuffer::Stop() { 177 void FrameBuffer::Stop() {
177 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); 178 TRACE_EVENT0("webrtc", "FrameBuffer::Stop");
178 rtc::CritScope lock(&crit_); 179 rtc::CritScope lock(&crit_);
179 stopped_ = true; 180 stopped_ = true;
180 new_continuous_frame_event_.Set(); 181 new_continuous_frame_event_.Set();
181 } 182 }
182 183
184 void FrameBuffer::UpdatePlayoutDelays(const FrameObject& frame) {
185 TRACE_EVENT0("webrtc", "FrameBuffer::UpdatePlayoutDelays");
186 PlayoutDelay playout_delay = frame.EncodedImage().playout_delay_;
187 if (playout_delay.min_ms >= 0)
188 timing_->set_min_playout_delay(playout_delay.min_ms);
189
190 if (playout_delay.max_ms >= 0)
191 timing_->set_max_playout_delay(playout_delay.max_ms);
192 }
193
183 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { 194 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
184 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); 195 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame");
185 RTC_DCHECK(frame); 196 RTC_DCHECK(frame);
186 if (stats_callback_) 197 if (stats_callback_)
187 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); 198 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size());
188 FrameKey key(frame->picture_id, frame->spatial_layer); 199 FrameKey key(frame->picture_id, frame->spatial_layer);
189 200
190 rtc::CritScope lock(&crit_); 201 rtc::CritScope lock(&crit_);
191 202
192 int last_continuous_picture_id = 203 int last_continuous_picture_id =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 260
250 if (info->second.frame) { 261 if (info->second.frame) {
251 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id 262 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id
252 << ":" << static_cast<int>(key.spatial_layer) 263 << ":" << static_cast<int>(key.spatial_layer)
253 << ") already inserted, dropping frame."; 264 << ") already inserted, dropping frame.";
254 return last_continuous_picture_id; 265 return last_continuous_picture_id;
255 } 266 }
256 267
257 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) 268 if (!UpdateFrameInfoWithIncomingFrame(*frame, info))
258 return last_continuous_picture_id; 269 return last_continuous_picture_id;
259 270 UpdatePlayoutDelays(*frame);
260 info->second.frame = std::move(frame); 271 info->second.frame = std::move(frame);
261 ++num_frames_buffered_; 272 ++num_frames_buffered_;
262 273
263 if (info->second.num_missing_continuous == 0) { 274 if (info->second.num_missing_continuous == 0) {
264 info->second.continuous = true; 275 info->second.continuous = true;
265 PropagateContinuity(info); 276 PropagateContinuity(info);
266 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id; 277 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id;
267 278
268 // Since we now have new continuous frames there might be a better frame 279 // Since we now have new continuous frames there might be a better frame
269 // to return from NextFrame. Signal that thread so that it again can choose 280 // 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
440 frames_.clear(); 451 frames_.clear();
441 last_decoded_frame_it_ = frames_.end(); 452 last_decoded_frame_it_ = frames_.end();
442 last_continuous_frame_it_ = frames_.end(); 453 last_continuous_frame_it_ = frames_.end();
443 next_frame_it_ = frames_.end(); 454 next_frame_it_ = frames_.end();
444 num_frames_history_ = 0; 455 num_frames_history_ = 0;
445 num_frames_buffered_ = 0; 456 num_frames_buffered_ = 0;
446 } 457 }
447 458
448 } // namespace video_coding 459 } // namespace video_coding
449 } // namespace webrtc 460 } // 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