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 189 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; | |
| 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 timing_->set_min_playout_delay( | |
| 219 (minimal_playout_delay_ms >= 0) ? minimal_playout_delay_ms : -1); | |
|
philipel
2017/05/09 14:34:47
What happens if you set the min/max playout delay
| |
| 220 timing_->set_max_playout_delay( | |
| 221 (maximal_playout_delay_ms >= 0) ? maximal_playout_delay_ms : -1); | |
| 222 } | |
| 223 | |
| 210 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { | 224 int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) { |
| 211 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); | 225 TRACE_EVENT0("webrtc", "FrameBuffer::InsertFrame"); |
| 212 RTC_DCHECK(frame); | 226 RTC_DCHECK(frame); |
| 213 if (stats_callback_) | 227 if (stats_callback_) |
| 214 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); | 228 stats_callback_->OnCompleteFrame(frame->num_references == 0, frame->size()); |
| 215 FrameKey key(frame->picture_id, frame->spatial_layer); | 229 FrameKey key(frame->picture_id, frame->spatial_layer); |
| 216 | 230 |
| 217 rtc::CritScope lock(&crit_); | 231 rtc::CritScope lock(&crit_); |
| 218 | 232 |
| 233 UpdatePlayoutDelays(*frame); | |
| 234 | |
| 219 int last_continuous_picture_id = | 235 int last_continuous_picture_id = |
| 220 last_continuous_frame_it_ == frames_.end() | 236 last_continuous_frame_it_ == frames_.end() |
| 221 ? -1 | 237 ? -1 |
| 222 : last_continuous_frame_it_->first.picture_id; | 238 : last_continuous_frame_it_->first.picture_id; |
| 223 | 239 |
| 224 if (num_frames_buffered_ >= kMaxFramesBuffered) { | 240 if (num_frames_buffered_ >= kMaxFramesBuffered) { |
| 225 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id | 241 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id |
| 226 << ":" << static_cast<int>(key.spatial_layer) | 242 << ":" << static_cast<int>(key.spatial_layer) |
| 227 << ") could not be inserted due to the frame " | 243 << ") could not be inserted due to the frame " |
| 228 << "buffer being full, dropping frame."; | 244 << "buffer being full, dropping frame."; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 frames_.clear(); | 483 frames_.clear(); |
| 468 last_decoded_frame_it_ = frames_.end(); | 484 last_decoded_frame_it_ = frames_.end(); |
| 469 last_continuous_frame_it_ = frames_.end(); | 485 last_continuous_frame_it_ = frames_.end(); |
| 470 next_frame_it_ = frames_.end(); | 486 next_frame_it_ = frames_.end(); |
| 471 num_frames_history_ = 0; | 487 num_frames_history_ = 0; |
| 472 num_frames_buffered_ = 0; | 488 num_frames_buffered_ = 0; |
| 473 } | 489 } |
| 474 | 490 |
| 475 } // namespace video_coding | 491 } // namespace video_coding |
| 476 } // namespace webrtc | 492 } // namespace webrtc |
| OLD | NEW |