| 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 = gfx::BufferFormat::YUYV_422; |
| 45 |
| 45 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420; | 46 const gfx::BufferFormat kImportPictureFormat = gfx::BufferFormat::YVU_420; |
| 46 } | 47 } |
| 47 | 48 |
| 48 static void ReportToUMA(VAVDADecoderFailure failure) { | 49 static void ReportToUMA(VAVDADecoderFailure failure) { |
| 49 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure, | 50 UMA_HISTOGRAM_ENUMERATION("Media.VAVDA.DecoderFailure", failure, |
| 50 VAVDA_DECODER_FAILURES_MAX + 1); | 51 VAVDA_DECODER_FAILURES_MAX + 1); |
| 51 } | 52 } |
| 52 | 53 |
| 53 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ | 54 #define RETURN_AND_NOTIFY_ON_FAILURE(result, log, error_code, ret) \ |
| 54 do { \ | 55 do { \ |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 requested_pic_size_ = size; | 658 requested_pic_size_ = size; |
| 658 | 659 |
| 659 TryFinishSurfaceSetChange(); | 660 TryFinishSurfaceSetChange(); |
| 660 } | 661 } |
| 661 | 662 |
| 662 static VideoPixelFormat BufferFormatToVideoPixelFormat( | 663 static VideoPixelFormat BufferFormatToVideoPixelFormat( |
| 663 gfx::BufferFormat format) { | 664 gfx::BufferFormat format) { |
| 664 switch (format) { | 665 switch (format) { |
| 665 case gfx::BufferFormat::BGRA_8888: | 666 case gfx::BufferFormat::BGRA_8888: |
| 666 return PIXEL_FORMAT_ARGB; | 667 return PIXEL_FORMAT_ARGB; |
| 667 | |
| 668 case gfx::BufferFormat::YVU_420: | 668 case gfx::BufferFormat::YVU_420: |
| 669 return PIXEL_FORMAT_YV12; | 669 return PIXEL_FORMAT_YV12; |
| 670 | 670 case gfx::BufferFormat::YUYV_422: |
| 671 return PIXEL_FORMAT_YUY2; |
| 671 default: | 672 default: |
| 672 LOG(FATAL) << "Add more cases as needed"; | 673 LOG(FATAL) << "Add more cases as needed"; |
| 673 return PIXEL_FORMAT_UNKNOWN; | 674 return PIXEL_FORMAT_UNKNOWN; |
| 674 } | 675 } |
| 675 } | 676 } |
| 676 | 677 |
| 677 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { | 678 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { |
| 678 DCHECK(task_runner_->BelongsToCurrentThread()); | 679 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 679 | 680 |
| 680 if (!awaiting_va_surfaces_recycle_) | 681 if (!awaiting_va_surfaces_recycle_) |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 return vaapi_pic->dec_surface(); | 1881 return vaapi_pic->dec_surface(); |
| 1881 } | 1882 } |
| 1882 | 1883 |
| 1883 // static | 1884 // static |
| 1884 VideoDecodeAccelerator::SupportedProfiles | 1885 VideoDecodeAccelerator::SupportedProfiles |
| 1885 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1886 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1886 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1887 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1887 } | 1888 } |
| 1888 | 1889 |
| 1889 } // namespace media | 1890 } // namespace media |
| OLD | NEW |