| 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/gpu/vaapi_video_decode_accelerator.h" | 5 #include "media/gpu/vaapi_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 // UMA errors that the VaapiVideoDecodeAccelerator class reports. | 36 // UMA errors that the VaapiVideoDecodeAccelerator class reports. |
| 37 enum VAVDADecoderFailure { | 37 enum VAVDADecoderFailure { |
| 38 VAAPI_ERROR = 0, | 38 VAAPI_ERROR = 0, |
| 39 VAVDA_DECODER_FAILURES_MAX, | 39 VAVDA_DECODER_FAILURES_MAX, |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Buffer format to use for output buffers backing PictureBuffers. This is the | 42 // Buffer format to use for output buffers backing PictureBuffers. This is the |
| 43 // format decoded frames in VASurfaces are converted into. | 43 // format decoded frames in VASurfaces are converted into. |
| 44 const gfx::BufferFormat kAllocatePictureFormat = gfx::BufferFormat::BGRA_8888; | 44 const gfx::BufferFormat kAllocatePictureFormat = |
| 45 gfx::BufferFormat::YUV_420_BIPLANAR; |
| 46 |
| 45 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420; | 47 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420; |
| 46 } | 48 } |
| 47 | 49 |
| 48 static void ReportToUMA(VAVDADecoderFailure failure) { | 50 static void ReportToUMA(VAVDADecoderFailure failure) { |
| 49 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure, | 51 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure, |
| 50 VAVDA_DECODER_FAILURES_MAX + 1); | 52 VAVDA_DECODER_FAILURES_MAX + 1); |
| 51 } | 53 } |
| 52 | 54 |
| 53 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ | 55 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ |
| 54 do { \ | 56 do { \ |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 693 |
| 692 static VideoPixelFormat BufferFormatToVideoPixelFormat( | 694 static VideoPixelFormat BufferFormatToVideoPixelFormat( |
| 693 gfx::BufferFormat format) { | 695 gfx::BufferFormat format) { |
| 694 switch (format) { | 696 switch (format) { |
| 695 case gfx::BufferFormat::BGRA_8888: | 697 case gfx::BufferFormat::BGRA_8888: |
| 696 return PIXEL_FORMAT_ARGB; | 698 return PIXEL_FORMAT_ARGB; |
| 697 | 699 |
| 698 case gfx::BufferFormat::YVU_420: | 700 case gfx::BufferFormat::YVU_420: |
| 699 return PIXEL_FORMAT_YV12; | 701 return PIXEL_FORMAT_YV12; |
| 700 | 702 |
| 703 case gfx::BufferFormat::YUV_420_BIPLANAR: |
| 704 return PIXEL_FORMAT_NV12; |
| 705 |
| 701 default: | 706 default: |
| 702 LOG(FATAL) << "Add more cases as needed"; | 707 LOG(FATAL) << "Add more cases as needed"; |
| 703 return PIXEL_FORMAT_UNKNOWN; | 708 return PIXEL_FORMAT_UNKNOWN; |
| 704 } | 709 } |
| 705 } | 710 } |
| 706 | 711 |
| 707 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { | 712 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { |
| 708 DCHECK(task_runner_->BelongsToCurrentThread()); | 713 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 709 | 714 |
| 710 if (!awaiting_va_surfaces_recycle_) | 715 if (!awaiting_va_surfaces_recycle_) |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 return vaapi_pic->dec_surface(); | 1908 return vaapi_pic->dec_surface(); |
| 1904 } | 1909 } |
| 1905 | 1910 |
| 1906 // static | 1911 // static |
| 1907 VideoDecodeAccelerator::SupportedProfiles | 1912 VideoDecodeAccelerator::SupportedProfiles |
| 1908 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1913 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1909 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1914 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1910 } | 1915 } |
| 1911 | 1916 |
| 1912 } // namespace media | 1917 } // namespace media |
| OLD | NEW |