Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 24 matching lines...) Expand all Loading... | |
| 35 } // namespace | 35 } // namespace |
| 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()), |
|
sprang_webrtc
2017/05/10 13:58:10
While you're here, can you update the initializer
| |
| 46 last_decoded_frame_it_(frames_.end()), | 46 last_decoded_frame_it_(frames_.end()), |
| 47 last_continuous_frame_it_(frames_.end()), | 47 last_continuous_frame_it_(frames_.end()), |
| 48 num_frames_history_(0), | 48 num_frames_history_(0), |
| 49 num_frames_buffered_(0), | 49 num_frames_buffered_(0), |
| 50 stopped_(false), | 50 stopped_(false), |
| 51 protection_mode_(kProtectionNack), | 51 protection_mode_(kProtectionNack), |
| 52 stats_callback_(stats_callback) {} | 52 stats_callback_(stats_callback) {} |
| 53 | 53 |
| 54 FrameBuffer::~FrameBuffer() {} | 54 FrameBuffer::~FrameBuffer() {} |
| 55 | 55 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 stopped_ = false; | 200 stopped_ = false; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void FrameBuffer::Stop() { | 203 void FrameBuffer::Stop() { |
| 204 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); | 204 TRACE_EVENT0("webrtc", "FrameBuffer::Stop"); |
| 205 rtc::CritScope lock(&crit_); | 205 rtc::CritScope lock(&crit_); |
| 206 stopped_ = true; | 206 stopped_ = true; |
| 207 new_continuous_frame_event_.Set(); | 207 new_continuous_frame_event_.Set(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void FrameBuffer::UpdatePlayoutDelays(const FrameObject& frame) { | |
| 211 TRACE_EVENT0("webrtc", "FrameBuffer::UpdatePlayoutDelays"); | |
| 212 int minimal_playout_delay_ms = -1; | |
| 213 int maximal_playout_delay_ms = -1; | |
|
sprang_webrtc
2017/05/10 13:58:10
No need to initialize these temporaries. In fact,
| |
| 214 | |
| 215 minimal_playout_delay_ms = frame.EncodedImage().playout_delay_.min_ms; | |
| 216 maximal_playout_delay_ms = frame.EncodedImage().playout_delay_.max_ms; | |
| 217 | |
| 218 if (minimal_playout_delay_ms >= 0) | |
| 219 timing_->set_min_playout_delay(minimal_playout_delay_ms); | |
| 220 | |
| 221 if (maximal_playout_delay_ms >= 0) | |
| 222 timing_->set_max_playout_delay(maximal_playout_delay_ms); | |
| 223 } | |
| 224 | |
| 210 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { | 225 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { |
| 211 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); | 226 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); |
| 212 RTC_DCHECK(frame); | 227 RTC_DCHECK(frame); |
| 213 if (stats_callback_) | 228 if (stats_callback_) |
| 214 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); | 229 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); |
| 215 FrameKey key(frame->picture_id, frame->spatial_layer); | 230 FrameKey key(frame->picture_id, frame->spatial_layer); |
| 216 | 231 |
| 217 rtc::CritScope lock(&crit_); | 232 rtc::CritScope lock(&crit_); |
| 218 | 233 |
| 219 int last_continuous_picture_id = | 234 int last_continuous_picture_id = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 | 291 |
| 277 if (info->second.frame) { | 292 if (info->second.frame) { |
| 278 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id | 293 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id |
| 279 << ":" << static_cast<int>(key.spatial_layer) | 294 << ":" << static_cast<int>(key.spatial_layer) |
| 280 << ") already inserted, dropping frame."; | 295 << ") already inserted, dropping frame."; |
| 281 return last_continuous_picture_id; | 296 return last_continuous_picture_id; |
| 282 } | 297 } |
| 283 | 298 |
| 284 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) | 299 if (!UpdateFrameInfoWithIncomingFrame(*frame, info)) |
| 285 return last_continuous_picture_id; | 300 return last_continuous_picture_id; |
| 286 | 301 UpdatePlayoutDelays(*frame); |
| 287 info->second.frame = std::move(frame); | 302 info->second.frame = std::move(frame); |
| 288 ++num_frames_buffered_; | 303 ++num_frames_buffered_; |
| 289 | 304 |
| 290 if (info->second.num_missing_continuous == 0) { | 305 if (info->second.num_missing_continuous == 0) { |
| 291 info->second.continuous = true; | 306 info->second.continuous = true; |
| 292 PropagateContinuity(info); | 307 PropagateContinuity(info); |
| 293 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id; | 308 last_continuous_picture_id = last_continuous_frame_it_->first.picture_id; |
| 294 | 309 |
| 295 // Since we now have new continuous frames there might be a better frame | 310 // 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 | 311 // 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 Loading... | |
| 467 frames_.clear(); | 482 frames_.clear(); |
| 468 last_decoded_frame_it_ = frames_.end(); | 483 last_decoded_frame_it_ = frames_.end(); |
| 469 last_continuous_frame_it_ = frames_.end(); | 484 last_continuous_frame_it_ = frames_.end(); |
| 470 next_frame_it_ = frames_.end(); | 485 next_frame_it_ = frames_.end(); |
| 471 num_frames_history_ = 0; | 486 num_frames_history_ = 0; |
| 472 num_frames_buffered_ = 0; | 487 num_frames_buffered_ = 0; |
| 473 } | 488 } |
| 474 | 489 |
| 475 } // namespace video_coding | 490 } // namespace video_coding |
| 476 } // namespace webrtc | 491 } // namespace webrtc |
| OLD | NEW |