| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <inttypes.h> | 5 #include <inttypes.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 const base::Closure& decode_error_cb); | 622 const base::Closure& decode_error_cb); |
| 623 void Initialize(const gfx::Size& coded_size, const gfx::Rect& visible_size); | 623 void Initialize(const gfx::Size& coded_size, const gfx::Rect& visible_size); |
| 624 // Save original YUV frame to compare it with the decoded frame later. | 624 // Save original YUV frame to compare it with the decoded frame later. |
| 625 void AddOriginalFrame(scoped_refptr<media::VideoFrame> frame); | 625 void AddOriginalFrame(scoped_refptr<media::VideoFrame> frame); |
| 626 void AddDecodeBuffer(const scoped_refptr<media::DecoderBuffer>& buffer); | 626 void AddDecodeBuffer(const scoped_refptr<media::DecoderBuffer>& buffer); |
| 627 // Flush the decoder. | 627 // Flush the decoder. |
| 628 void Flush(); | 628 void Flush(); |
| 629 | 629 |
| 630 private: | 630 private: |
| 631 void InitializeCB(bool success); | 631 void InitializeCB(bool success); |
| 632 void DecodeDone(media::VideoDecoder::Status status); | 632 void DecodeDone(media::DecodeStatus status); |
| 633 void FlushDone(media::VideoDecoder::Status status); | 633 void FlushDone(media::DecodeStatus status); |
| 634 void VerifyOutputFrame(const scoped_refptr<media::VideoFrame>& output_frame); | 634 void VerifyOutputFrame(const scoped_refptr<media::VideoFrame>& output_frame); |
| 635 void Decode(); | 635 void Decode(); |
| 636 | 636 |
| 637 enum State { UNINITIALIZED, INITIALIZED, DECODING, ERROR }; | 637 enum State { UNINITIALIZED, INITIALIZED, DECODING, ERROR }; |
| 638 | 638 |
| 639 const media::VideoCodecProfile profile_; | 639 const media::VideoCodecProfile profile_; |
| 640 scoped_ptr<media::FFmpegVideoDecoder> decoder_; | 640 scoped_ptr<media::FFmpegVideoDecoder> decoder_; |
| 641 media::VideoDecoder::DecodeCB decode_cb_; | 641 media::VideoDecoder::DecodeCB decode_cb_; |
| 642 // Decode callback of an EOS buffer. | 642 // Decode callback of an EOS buffer. |
| 643 media::VideoDecoder::DecodeCB eos_decode_cb_; | 643 media::VideoDecoder::DecodeCB eos_decode_cb_; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 FAIL() << "Decoder initialization error"; | 705 FAIL() << "Decoder initialization error"; |
| 706 decode_error_cb_.Run(); | 706 decode_error_cb_.Run(); |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 void VideoFrameQualityValidator::AddOriginalFrame( | 710 void VideoFrameQualityValidator::AddOriginalFrame( |
| 711 scoped_refptr<media::VideoFrame> frame) { | 711 scoped_refptr<media::VideoFrame> frame) { |
| 712 original_frames_.push(frame); | 712 original_frames_.push(frame); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void VideoFrameQualityValidator::DecodeDone( | 715 void VideoFrameQualityValidator::DecodeDone(media::DecodeStatus status) { |
| 716 media::VideoDecoder::Status status) { | 716 if (status == media::DecodeStatus::OK) { |
| 717 if (status == media::VideoDecoder::kOk) { | |
| 718 decoder_state_ = INITIALIZED; | 717 decoder_state_ = INITIALIZED; |
| 719 Decode(); | 718 Decode(); |
| 720 } else { | 719 } else { |
| 721 decoder_state_ = ERROR; | 720 decoder_state_ = ERROR; |
| 722 FAIL() << "Unexpected decode status = " << status << ". Stop decoding."; | 721 FAIL() << "Unexpected decode status = " << status << ". Stop decoding."; |
| 723 decode_error_cb_.Run(); | 722 decode_error_cb_.Run(); |
| 724 } | 723 } |
| 725 } | 724 } |
| 726 | 725 |
| 727 void VideoFrameQualityValidator::FlushDone(media::VideoDecoder::Status status) { | 726 void VideoFrameQualityValidator::FlushDone(media::DecodeStatus status) { |
| 728 flush_complete_cb_.Run(); | 727 flush_complete_cb_.Run(); |
| 729 } | 728 } |
| 730 | 729 |
| 731 void VideoFrameQualityValidator::Flush() { | 730 void VideoFrameQualityValidator::Flush() { |
| 732 if (decoder_state_ != ERROR) { | 731 if (decoder_state_ != ERROR) { |
| 733 decode_buffers_.push(media::DecoderBuffer::CreateEOSBuffer()); | 732 decode_buffers_.push(media::DecoderBuffer::CreateEOSBuffer()); |
| 734 Decode(); | 733 Decode(); |
| 735 } | 734 } |
| 736 } | 735 } |
| 737 | 736 |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 | 1821 |
| 1823 content::g_env = | 1822 content::g_env = |
| 1824 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1823 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
| 1825 testing::AddGlobalTestEnvironment( | 1824 testing::AddGlobalTestEnvironment( |
| 1826 new content::VideoEncodeAcceleratorTestEnvironment( | 1825 new content::VideoEncodeAcceleratorTestEnvironment( |
| 1827 std::move(test_stream_data), log_path, run_at_fps, | 1826 std::move(test_stream_data), log_path, run_at_fps, |
| 1828 needs_encode_latency, verify_all_output))); | 1827 needs_encode_latency, verify_all_output))); |
| 1829 | 1828 |
| 1830 return RUN_ALL_TESTS(); | 1829 return RUN_ALL_TESTS(); |
| 1831 } | 1830 } |
| OLD | NEW |