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 "media/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 780 |
781 if (!pending_reset_cb_.is_null()) | 781 if (!pending_reset_cb_.is_null()) |
782 base::ResetAndReturn(&pending_reset_cb_).Run(); | 782 base::ResetAndReturn(&pending_reset_cb_).Run(); |
783 } | 783 } |
784 | 784 |
785 void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { | 785 void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { |
786 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 786 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
787 if (!vda_) | 787 if (!vda_) |
788 return; | 788 return; |
789 | 789 |
790 state_ = kError; | |
791 | |
792 // If we have any bitstream buffers, then notify one that an error has | 790 // If we have any bitstream buffers, then notify one that an error has |
793 // occurred. This guarantees that somebody finds out about the error. If | 791 // occurred. This guarantees that somebody finds out about the error. If |
794 // we don't do this, and if the max decodes are already in flight, then there | 792 // we don't do this, and if the max decodes are already in flight, then there |
795 // won't be another decode request to report the error. | 793 // won't be another decode request to report the error. |
796 if (!bitstream_buffers_in_decoder_.empty()) { | 794 if (!bitstream_buffers_in_decoder_.empty()) { |
797 auto it = bitstream_buffers_in_decoder_.begin(); | 795 auto it = bitstream_buffers_in_decoder_.begin(); |
798 it->second.done_cb.Run(DecodeStatus::DECODE_ERROR); | 796 it->second.done_cb.Run(DecodeStatus::DECODE_ERROR); |
799 bitstream_buffers_in_decoder_.erase(it); | 797 bitstream_buffers_in_decoder_.erase(it); |
800 } | 798 } |
801 | 799 |
| 800 if (state_ == kDrainingDecoder) |
| 801 base::ResetAndReturn(&eos_decode_cb_).Run(DecodeStatus::DECODE_ERROR); |
| 802 |
| 803 state_ = kError; |
| 804 |
802 DLOG(ERROR) << "VDA Error: " << error; | 805 DLOG(ERROR) << "VDA Error: " << error; |
803 UMA_HISTOGRAM_ENUMERATION("Media.GpuVideoDecoderError", error, | 806 UMA_HISTOGRAM_ENUMERATION("Media.GpuVideoDecoderError", error, |
804 media::VideoDecodeAccelerator::ERROR_MAX + 1); | 807 media::VideoDecodeAccelerator::ERROR_MAX + 1); |
805 | 808 |
806 DestroyVDA(); | 809 DestroyVDA(); |
807 } | 810 } |
808 | 811 |
809 bool GpuVideoDecoder::IsProfileSupported( | 812 bool GpuVideoDecoder::IsProfileSupported( |
810 const VideoDecodeAccelerator::Capabilities& capabilities, | 813 const VideoDecodeAccelerator::Capabilities& capabilities, |
811 VideoCodecProfile profile, | 814 VideoCodecProfile profile, |
(...skipping 12 matching lines...) Expand all Loading... |
824 } | 827 } |
825 return false; | 828 return false; |
826 } | 829 } |
827 | 830 |
828 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 831 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
829 const { | 832 const { |
830 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 833 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
831 } | 834 } |
832 | 835 |
833 } // namespace media | 836 } // namespace media |
OLD | NEW |