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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 namespace video_coding { | 27 namespace video_coding { |
28 | 28 |
29 namespace { | 29 namespace { |
30 // Max number of frames the buffer will hold. | 30 // Max number of frames the buffer will hold. |
31 constexpr int kMaxFramesBuffered = 600; | 31 constexpr int kMaxFramesBuffered = 600; |
32 | 32 |
33 // Max number of decoded frame info that will be saved. | 33 // Max number of decoded frame info that will be saved. |
34 constexpr int kMaxFramesHistory = 50; | 34 constexpr int kMaxFramesHistory = 50; |
| 35 |
| 36 constexpr int64_t kLogNonDecodedIntervalMs = 5000; |
35 } // namespace | 37 } // namespace |
36 | 38 |
37 FrameBuffer::FrameBuffer(Clock* clock, | 39 FrameBuffer::FrameBuffer(Clock* clock, |
38 VCMJitterEstimator* jitter_estimator, | 40 VCMJitterEstimator* jitter_estimator, |
39 VCMTiming* timing, | 41 VCMTiming* timing, |
40 VCMReceiveStatisticsCallback* stats_callback) | 42 VCMReceiveStatisticsCallback* stats_callback) |
41 : clock_(clock), | 43 : clock_(clock), |
42 new_continuous_frame_event_(false, false), | 44 new_continuous_frame_event_(false, false), |
43 jitter_estimator_(jitter_estimator), | 45 jitter_estimator_(jitter_estimator), |
44 timing_(timing), | 46 timing_(timing), |
45 inter_frame_delay_(clock_->TimeInMilliseconds()), | 47 inter_frame_delay_(clock_->TimeInMilliseconds()), |
46 last_decoded_frame_timestamp_(0), | 48 last_decoded_frame_timestamp_(0), |
47 last_decoded_frame_it_(frames_.end()), | 49 last_decoded_frame_it_(frames_.end()), |
48 last_continuous_frame_it_(frames_.end()), | 50 last_continuous_frame_it_(frames_.end()), |
49 num_frames_history_(0), | 51 num_frames_history_(0), |
50 num_frames_buffered_(0), | 52 num_frames_buffered_(0), |
51 stopped_(false), | 53 stopped_(false), |
52 protection_mode_(kProtectionNack), | 54 protection_mode_(kProtectionNack), |
53 stats_callback_(stats_callback) {} | 55 stats_callback_(stats_callback), |
| 56 last_log_non_decoded_ms_(-kLogNonDecodedIntervalMs) {} |
54 | 57 |
55 FrameBuffer::~FrameBuffer() {} | 58 FrameBuffer::~FrameBuffer() {} |
56 | 59 |
57 FrameBuffer::ReturnReason FrameBuffer::NextFrame( | 60 FrameBuffer::ReturnReason FrameBuffer::NextFrame( |
58 int64_t max_wait_time_ms, | 61 int64_t max_wait_time_ms, |
59 std::unique_ptr<FrameObject>* frame_out) { | 62 std::unique_ptr<FrameObject>* frame_out) { |
60 TRACE_EVENT0("webrtc", "FrameBuffer::NextFrame"); | 63 TRACE_EVENT0("webrtc", "FrameBuffer::NextFrame"); |
61 int64_t latest_return_time_ms = | 64 int64_t latest_return_time_ms = |
62 clock_->TimeInMilliseconds() + max_wait_time_ms; | 65 clock_->TimeInMilliseconds() + max_wait_time_ms; |
63 int64_t wait_ms = max_wait_time_ms; | 66 int64_t wait_ms = max_wait_time_ms; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 448 |
446 // Check how many dependencies that have already been fulfilled. | 449 // Check how many dependencies that have already been fulfilled. |
447 for (size_t i = 0; i < frame.num_references; ++i) { | 450 for (size_t i = 0; i < frame.num_references; ++i) { |
448 FrameKey ref_key(frame.references[i], frame.spatial_layer); | 451 FrameKey ref_key(frame.references[i], frame.spatial_layer); |
449 auto ref_info = frames_.find(ref_key); | 452 auto ref_info = frames_.find(ref_key); |
450 | 453 |
451 // Does |frame| depend on a frame earlier than the last decoded frame? | 454 // Does |frame| depend on a frame earlier than the last decoded frame? |
452 if (last_decoded_frame_it_ != frames_.end() && | 455 if (last_decoded_frame_it_ != frames_.end() && |
453 ref_key <= last_decoded_frame_it_->first) { | 456 ref_key <= last_decoded_frame_it_->first) { |
454 if (ref_info == frames_.end()) { | 457 if (ref_info == frames_.end()) { |
455 LOG(LS_WARNING) << "Frame with (picture_id:spatial_id) (" | 458 int64_t now_ms = clock_->TimeInMilliseconds(); |
456 << key.picture_id << ":" | 459 if (last_log_non_decoded_ms_ + kLogNonDecodedIntervalMs < now_ms) { |
457 << static_cast<int>(key.spatial_layer) | 460 LOG(LS_WARNING) |
458 << " depends on a non-decoded frame more previous than " | 461 << "Frame with (picture_id:spatial_id) (" << key.picture_id << ":" |
459 << "the last decoded frame, dropping frame."; | 462 << static_cast<int>(key.spatial_layer) |
| 463 << ") depends on a non-decoded frame more previous than" |
| 464 << " the last decoded frame, dropping frame."; |
| 465 last_log_non_decoded_ms_ = now_ms; |
| 466 } |
460 return false; | 467 return false; |
461 } | 468 } |
462 | 469 |
463 --info->second.num_missing_continuous; | 470 --info->second.num_missing_continuous; |
464 --info->second.num_missing_decodable; | 471 --info->second.num_missing_decodable; |
465 } else { | 472 } else { |
466 if (ref_info == frames_.end()) | 473 if (ref_info == frames_.end()) |
467 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first; | 474 ref_info = frames_.insert(std::make_pair(ref_key, FrameInfo())).first; |
468 | 475 |
469 if (ref_info->second.continuous) | 476 if (ref_info->second.continuous) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 frames_.clear(); | 554 frames_.clear(); |
548 last_decoded_frame_it_ = frames_.end(); | 555 last_decoded_frame_it_ = frames_.end(); |
549 last_continuous_frame_it_ = frames_.end(); | 556 last_continuous_frame_it_ = frames_.end(); |
550 next_frame_it_ = frames_.end(); | 557 next_frame_it_ = frames_.end(); |
551 num_frames_history_ = 0; | 558 num_frames_history_ = 0; |
552 num_frames_buffered_ = 0; | 559 num_frames_buffered_ = 0; |
553 } | 560 } |
554 | 561 |
555 } // namespace video_coding | 562 } // namespace video_coding |
556 } // namespace webrtc | 563 } // namespace webrtc |
OLD | NEW |