OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 DVLOG(4) << "Skipping output, non-existing frame_num: " << pic->frame_num; | 666 DVLOG(4) << "Skipping output, non-existing frame_num: " << pic->frame_num; |
667 return; | 667 return; |
668 } | 668 } |
669 | 669 |
670 DVLOG_IF(1, pic->pic_order_cnt < last_output_poc_) | 670 DVLOG_IF(1, pic->pic_order_cnt < last_output_poc_) |
671 << "Outputting out of order, likely a broken stream: " | 671 << "Outputting out of order, likely a broken stream: " |
672 << last_output_poc_ << " -> " << pic->pic_order_cnt; | 672 << last_output_poc_ << " -> " << pic->pic_order_cnt; |
673 last_output_poc_ = pic->pic_order_cnt; | 673 last_output_poc_ = pic->pic_order_cnt; |
674 | 674 |
675 DVLOG(4) << "Posting output task for POC: " << pic->pic_order_cnt; | 675 DVLOG(4) << "Posting output task for POC: " << pic->pic_order_cnt; |
676 accelerator_->OutputPicture(pic); | 676 accelerator_->OutputPicture(pic, visible_rect_); |
677 } | 677 } |
678 | 678 |
679 void H264Decoder::ClearDPB() { | 679 void H264Decoder::ClearDPB() { |
680 // Clear DPB contents, marking the pictures as unused first. | 680 // Clear DPB contents, marking the pictures as unused first. |
681 dpb_.Clear(); | 681 dpb_.Clear(); |
682 last_output_poc_ = std::numeric_limits<int>::min(); | 682 last_output_poc_ = std::numeric_limits<int>::min(); |
683 } | 683 } |
684 | 684 |
685 bool H264Decoder::OutputAllRemainingPics() { | 685 bool H264Decoder::OutputAllRemainingPics() { |
686 // Output all pictures that are waiting to be outputted. | 686 // Output all pictures that are waiting to be outputted. |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 DVLOG(1) << "frame_mbs_only_flag != 1 not supported"; | 1086 DVLOG(1) << "frame_mbs_only_flag != 1 not supported"; |
1087 return false; | 1087 return false; |
1088 } | 1088 } |
1089 | 1089 |
1090 gfx::Size new_pic_size = sps->GetCodedSize().value_or(gfx::Size()); | 1090 gfx::Size new_pic_size = sps->GetCodedSize().value_or(gfx::Size()); |
1091 if (new_pic_size.IsEmpty()) { | 1091 if (new_pic_size.IsEmpty()) { |
1092 DVLOG(1) << "Invalid picture size"; | 1092 DVLOG(1) << "Invalid picture size"; |
1093 return false; | 1093 return false; |
1094 } | 1094 } |
1095 | 1095 |
| 1096 gfx::Rect new_visible_rect = sps->GetVisibleRect().value_or(gfx::Rect()); |
| 1097 if (visible_rect_ != new_visible_rect) { |
| 1098 DVLOG(1) << "New visible rect: " << new_visible_rect.ToString(); |
| 1099 visible_rect_ = new_visible_rect; |
| 1100 } |
| 1101 |
1096 int width_mb = new_pic_size.width() / 16; | 1102 int width_mb = new_pic_size.width() / 16; |
1097 int height_mb = new_pic_size.height() / 16; | 1103 int height_mb = new_pic_size.height() / 16; |
1098 | 1104 |
1099 // Verify that the values are not too large before multiplying. | 1105 // Verify that the values are not too large before multiplying. |
1100 if (std::numeric_limits<int>::max() / width_mb < height_mb) { | 1106 if (std::numeric_limits<int>::max() / width_mb < height_mb) { |
1101 DVLOG(1) << "Picture size is too big: " << new_pic_size.ToString(); | 1107 DVLOG(1) << "Picture size is too big: " << new_pic_size.ToString(); |
1102 return false; | 1108 return false; |
1103 } | 1109 } |
1104 | 1110 |
1105 int level = sps->level_idc; | 1111 int level = sps->level_idc; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 | 1433 |
1428 gfx::Size H264Decoder::GetPicSize() const { | 1434 gfx::Size H264Decoder::GetPicSize() const { |
1429 return pic_size_; | 1435 return pic_size_; |
1430 } | 1436 } |
1431 | 1437 |
1432 size_t H264Decoder::GetRequiredNumOfPictures() const { | 1438 size_t H264Decoder::GetRequiredNumOfPictures() const { |
1433 return dpb_.max_num_pics() + kPicsInPipeline; | 1439 return dpb_.max_num_pics() + kPicsInPipeline; |
1434 } | 1440 } |
1435 | 1441 |
1436 } // namespace media | 1442 } // namespace media |
OLD | NEW |