| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 requested_pic_size_ = size; | 683 requested_pic_size_ = size; |
| 683 | 684 |
| 684 TryFinishSurfaceSetChange(); | 685 TryFinishSurfaceSetChange(); |
| 685 } | 686 } |
| 686 | 687 |
| 687 static VideoPixelFormat BufferFormatToVideoPixelFormat( | 688 static VideoPixelFormat BufferFormatToVideoPixelFormat( |
| 688 gfx::BufferFormat format) { | 689 gfx::BufferFormat format) { |
| 689 switch (format) { | 690 switch (format) { |
| 690 case gfx::BufferFormat::BGRA_8888: | 691 case gfx::BufferFormat::BGRA_8888: |
| 691 return PIXEL_FORMAT_ARGB; | 692 return PIXEL_FORMAT_ARGB; |
| 692 | |
| 693 case gfx::BufferFormat::YVU_420: | 693 case gfx::BufferFormat::YVU_420: |
| 694 return PIXEL_FORMAT_YV12; | 694 return PIXEL_FORMAT_YV12; |
| 695 | 695 case gfx::BufferFormat::YUYV_422: |
| 696 return PIXEL_FORMAT_YUY2; |
| 696 default: | 697 default: |
| 697 LOG(FATAL) << "Add more cases as needed"; | 698 LOG(FATAL) << "Add more cases as needed"; |
| 698 return PIXEL_FORMAT_UNKNOWN; | 699 return PIXEL_FORMAT_UNKNOWN; |
| 699 } | 700 } |
| 700 } | 701 } |
| 701 | 702 |
| 702 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { | 703 void VaapiVideoDecodeAccelerator::TryFinishSurfaceSetChange() { |
| 703 DCHECK(task_runner_->BelongsToCurrentThread()); | 704 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 704 | 705 |
| 705 if (!awaiting_va_surfaces_recycle_) | 706 if (!awaiting_va_surfaces_recycle_) |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 return vaapi_pic->dec_surface(); | 1898 return vaapi_pic->dec_surface(); |
| 1898 } | 1899 } |
| 1899 | 1900 |
| 1900 // static | 1901 // static |
| 1901 VideoDecodeAccelerator::SupportedProfiles | 1902 VideoDecodeAccelerator::SupportedProfiles |
| 1902 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1903 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
| 1903 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1904 return VaapiWrapper::GetSupportedDecodeProfiles(); |
| 1904 } | 1905 } |
| 1905 | 1906 |
| 1906 } // namespace media | 1907 } // namespace media |
| OLD | NEW |