Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: media/gpu/h264_decoder.cc

Issue 1973753003: media/gpu: restore some of the reformatting done during migration to media/gpu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 break; 636 break;
637 637
638 case 3: 638 case 3:
639 // End of modification list. 639 // End of modification list.
640 done = true; 640 done = true;
641 break; 641 break;
642 642
643 default: 643 default:
644 // May be recoverable. 644 // May be recoverable.
645 DVLOG(1) << "Invalid modification_of_pic_nums_idc=" 645 DVLOG(1) << "Invalid modification_of_pic_nums_idc="
646 << list_mod->modification_of_pic_nums_idc << " in position " 646 << list_mod->modification_of_pic_nums_idc
647 << i; 647 << " in position " << i;
648 break; 648 break;
649 } 649 }
650 650
651 ++list_mod; 651 ++list_mod;
652 } 652 }
653 653
654 // Per NOTE 2 in 8.2.4.3.2, the ref_pic_listx size in the above loop is 654 // Per NOTE 2 in 8.2.4.3.2, the ref_pic_listx size in the above loop is
655 // temporarily made one element longer than the required final list. 655 // temporarily made one element longer than the required final list.
656 // Resize the list back to its required size. 656 // Resize the list back to its required size.
657 ref_pic_listx->resize(num_ref_idx_lX_active_minus1 + 1); 657 ref_pic_listx->resize(num_ref_idx_lX_active_minus1 + 1);
658 658
659 return true; 659 return true;
660 } 660 }
661 661
662 void H264Decoder::OutputPic(scoped_refptr<H264Picture> pic) { 662 void H264Decoder::OutputPic(scoped_refptr<H264Picture> pic) {
663 DCHECK(!pic->outputted); 663 DCHECK(!pic->outputted);
664 pic->outputted = true; 664 pic->outputted = true;
665 665
666 if (pic->nonexisting) { 666 if (pic->nonexisting) {
667 DVLOG(4) << "Skipping output, non-existing frame_num: " << pic->frame_num; 667 DVLOG(4) << "Skipping output, non-existing frame_num: " << pic->frame_num;
668 return; 668 return;
669 } 669 }
670 670
671 DVLOG_IF(1, pic->pic_order_cnt < last_output_poc_) 671 DVLOG_IF(1, pic->pic_order_cnt < last_output_poc_)
672 << "Outputting out of order, likely a broken stream: " << last_output_poc_ 672 << "Outputting out of order, likely a broken stream: "
673 << " -> " << pic->pic_order_cnt; 673 << last_output_poc_ << " -> " << pic->pic_order_cnt;
674 last_output_poc_ = pic->pic_order_cnt; 674 last_output_poc_ = pic->pic_order_cnt;
675 675
676 DVLOG(4) << "Posting output task for POC: " << pic->pic_order_cnt; 676 DVLOG(4) << "Posting output task for POC: " << pic->pic_order_cnt;
677 accelerator_->OutputPicture(pic); 677 accelerator_->OutputPicture(pic);
678 } 678 }
679 679
680 void H264Decoder::ClearDPB() { 680 void H264Decoder::ClearDPB() {
681 // Clear DPB contents, marking the pictures as unused first. 681 // Clear DPB contents, marking the pictures as unused first.
682 dpb_.Clear(); 682 dpb_.Clear();
683 last_output_poc_ = std::numeric_limits<int>::min(); 683 last_output_poc_ = std::numeric_limits<int>::min();
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 SET_ERROR_AND_RETURN(); 1312 SET_ERROR_AND_RETURN();
1313 1313
1314 DVLOG(4) << "New NALU: " << static_cast<int>(curr_nalu_->nal_unit_type); 1314 DVLOG(4) << "New NALU: " << static_cast<int>(curr_nalu_->nal_unit_type);
1315 } 1315 }
1316 1316
1317 switch (curr_nalu_->nal_unit_type) { 1317 switch (curr_nalu_->nal_unit_type) {
1318 case media::H264NALU::kNonIDRSlice: 1318 case media::H264NALU::kNonIDRSlice:
1319 // We can't resume from a non-IDR slice. 1319 // We can't resume from a non-IDR slice.
1320 if (state_ != kDecoding) 1320 if (state_ != kDecoding)
1321 break; 1321 break;
1322 // else fallthrough 1322 // else fallthrough
1323 case media::H264NALU::kIDRSlice: { 1323 case media::H264NALU::kIDRSlice: {
1324 // TODO(posciak): the IDR may require an SPS that we don't have 1324 // TODO(posciak): the IDR may require an SPS that we don't have
1325 // available. For now we'd fail if that happens, but ideally we'd like 1325 // available. For now we'd fail if that happens, but ideally we'd like
1326 // to keep going until the next SPS in the stream. 1326 // to keep going until the next SPS in the stream.
1327 if (state_ == kNeedStreamMetadata) { 1327 if (state_ == kNeedStreamMetadata) {
1328 // We need an SPS, skip this IDR and keep looking. 1328 // We need an SPS, skip this IDR and keep looking.
1329 break; 1329 break;
1330 } 1330 }
1331 1331
1332 // If after reset, we should be able to recover from an IDR. 1332 // If after reset, we should be able to recover from an IDR.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 1429
1430 gfx::Size H264Decoder::GetPicSize() const { 1430 gfx::Size H264Decoder::GetPicSize() const {
1431 return pic_size_; 1431 return pic_size_;
1432 } 1432 }
1433 1433
1434 size_t H264Decoder::GetRequiredNumOfPictures() const { 1434 size_t H264Decoder::GetRequiredNumOfPictures() const {
1435 return dpb_.max_num_pics() + kPicsInPipeline; 1435 return dpb_.max_num_pics() + kPicsInPipeline;
1436 } 1436 }
1437 1437
1438 } // namespace media 1438 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698