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 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 |
| 234 UpdatePlayoutDelays(*frame); | |
|
philipel
2017/05/09 16:12:58
I just realized this now, but I think we should on
gnish
2017/05/09 16:24:12
Done.
| |
| 235 | |
| 219 int last_continuous_picture_id = | 236 int last_continuous_picture_id = |
| 220 last_continuous_frame_it_ == frames_.end() | 237 last_continuous_frame_it_ == frames_.end() |
| 221 ? -1 | 238 ? -1 |
| 222 : last_continuous_frame_it_->first.picture_id; | 239 : last_continuous_frame_it_->first.picture_id; |
| 223 | 240 |
| 224 if (num_frames_buffered_ >= kMaxFramesBuffered) { | 241 if (num_frames_buffered_ >= kMaxFramesBuffered) { |
| 225 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id | 242 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" << key.picture_id |
| 226 << ":" << static_cast<int>(key.spatial_layer) | 243 << ":" << static_cast<int>(key.spatial_layer) |
| 227 << ") could not be inserted due to the frame " | 244 << ") could not be inserted due to the frame " |
| 228 << "buffer being full, dropping frame."; | 245 << "buffer being full, dropping frame."; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 frames_.clear(); | 484 frames_.clear(); |
| 468 last_decoded_frame_it_ = frames_.end(); | 485 last_decoded_frame_it_ = frames_.end(); |
| 469 last_continuous_frame_it_ = frames_.end(); | 486 last_continuous_frame_it_ = frames_.end(); |
| 470 next_frame_it_ = frames_.end(); | 487 next_frame_it_ = frames_.end(); |
| 471 num_frames_history_ = 0; | 488 num_frames_history_ = 0; |
| 472 num_frames_buffered_ = 0; | 489 num_frames_buffered_ = 0; |
| 473 } | 490 } |
| 474 | 491 |
| 475 } // namespace video_coding | 492 } // namespace video_coding |
| 476 } // namespace webrtc | 493 } // namespace webrtc |
| OLD | NEW |