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 1075 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()); | |
Pawel Osciak
2017/06/16 07:14:00
Would it make sense to move this to l.1133 and als
johnylin1
2017/06/16 08:15:10
Moved to l.1133. sps->GetVisibleRect() already che
| |
1097 if (visible_rect_ != new_visible_rect) { | |
1098 DVLOG(2) << "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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1344 SET_ERROR_AND_RETURN(); | 1350 SET_ERROR_AND_RETURN(); |
1345 } | 1351 } |
1346 | 1352 |
1347 if (!curr_pic_) { | 1353 if (!curr_pic_) { |
1348 // New picture/finished previous one, try to start a new one | 1354 // New picture/finished previous one, try to start a new one |
1349 // or tell the client we need more surfaces. | 1355 // or tell the client we need more surfaces. |
1350 curr_pic_ = accelerator_->CreateH264Picture(); | 1356 curr_pic_ = accelerator_->CreateH264Picture(); |
1351 if (!curr_pic_) | 1357 if (!curr_pic_) |
1352 return kRanOutOfSurfaces; | 1358 return kRanOutOfSurfaces; |
1353 | 1359 |
1360 curr_pic_->visible_rect = visible_rect_; | |
Pawel Osciak
2017/06/16 07:14:00
Could we perhaps move this to InitCurrPicture()?
| |
1354 if (!StartNewFrame(curr_slice_hdr_.get())) | 1361 if (!StartNewFrame(curr_slice_hdr_.get())) |
1355 SET_ERROR_AND_RETURN(); | 1362 SET_ERROR_AND_RETURN(); |
1356 } | 1363 } |
1357 | 1364 |
1358 if (!ProcessCurrentSlice()) | 1365 if (!ProcessCurrentSlice()) |
1359 SET_ERROR_AND_RETURN(); | 1366 SET_ERROR_AND_RETURN(); |
1360 | 1367 |
1361 curr_slice_hdr_.reset(); | 1368 curr_slice_hdr_.reset(); |
1362 break; | 1369 break; |
1363 } | 1370 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1427 | 1434 |
1428 gfx::Size H264Decoder::GetPicSize() const { | 1435 gfx::Size H264Decoder::GetPicSize() const { |
1429 return pic_size_; | 1436 return pic_size_; |
1430 } | 1437 } |
1431 | 1438 |
1432 size_t H264Decoder::GetRequiredNumOfPictures() const { | 1439 size_t H264Decoder::GetRequiredNumOfPictures() const { |
1433 return dpb_.max_num_pics() + kPicsInPipeline; | 1440 return dpb_.max_num_pics() + kPicsInPipeline; |
1434 } | 1441 } |
1435 | 1442 |
1436 } // namespace media | 1443 } // namespace media |
OLD | NEW |