| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/gpu/arc_gpu_video_decode_accelerator.h" | 5 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 DCHECK(thread_checker_.CalledOnValidThread()); | 297 DCHECK(thread_checker_.CalledOnValidThread()); |
| 298 if (!vda_) { | 298 if (!vda_) { |
| 299 DLOG(ERROR) << "VDA not initialized"; | 299 DLOG(ERROR) << "VDA not initialized"; |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 vda_->Flush(); | 302 vda_->Flush(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void ArcGpuVideoDecodeAccelerator::ProvidePictureBuffers( | 305 void ArcGpuVideoDecodeAccelerator::ProvidePictureBuffers( |
| 306 uint32_t requested_num_of_buffers, | 306 uint32_t requested_num_of_buffers, |
| 307 media::VideoPixelFormat output_pixel_format, | |
| 308 uint32_t textures_per_buffer, | 307 uint32_t textures_per_buffer, |
| 309 const gfx::Size& dimensions, | 308 const gfx::Size& dimensions, |
| 310 uint32_t texture_target) { | 309 uint32_t texture_target) { |
| 311 DVLOG(5) << "ProvidePictureBuffers(" | 310 DVLOG(5) << "ProvidePictureBuffers(" |
| 312 << "requested_num_of_buffers=" << requested_num_of_buffers | 311 << "requested_num_of_buffers=" << requested_num_of_buffers |
| 313 << ", dimensions=" << dimensions.ToString() << ")"; | 312 << ", dimensions=" << dimensions.ToString() << ")"; |
| 314 DCHECK(thread_checker_.CalledOnValidThread()); | 313 DCHECK(thread_checker_.CalledOnValidThread()); |
| 315 coded_size_ = dimensions; | 314 coded_size_ = dimensions; |
| 316 if ((output_pixel_format_ != media::PIXEL_FORMAT_UNKNOWN) && | 315 output_pixel_format_ = vda_->GetOutputFormat(); |
| 317 (output_pixel_format_ != output_pixel_format)) { | |
| 318 arc_client_->OnError(PLATFORM_FAILURE); | |
| 319 return; | |
| 320 } | |
| 321 output_pixel_format_ = output_pixel_format; | |
| 322 | 316 |
| 323 VideoFormat video_format; | 317 VideoFormat video_format; |
| 324 switch (output_pixel_format_) { | 318 switch (output_pixel_format_) { |
| 325 case media::PIXEL_FORMAT_I420: | 319 case media::PIXEL_FORMAT_I420: |
| 326 case media::PIXEL_FORMAT_YV12: | 320 case media::PIXEL_FORMAT_YV12: |
| 327 case media::PIXEL_FORMAT_NV12: | 321 case media::PIXEL_FORMAT_NV12: |
| 328 case media::PIXEL_FORMAT_NV21: | 322 case media::PIXEL_FORMAT_NV21: |
| 329 // HAL_PIXEL_FORMAT_YCbCr_420_888 is the flexible pixel format in Android | 323 // HAL_PIXEL_FORMAT_YCbCr_420_888 is the flexible pixel format in Android |
| 330 // which handles all 420 formats, with both orderings of chroma (CbCr and | 324 // which handles all 420 formats, with both orderings of chroma (CbCr and |
| 331 // CrCb) as well as planar and semi-planar layouts. | 325 // CrCb) as well as planar and semi-planar layouts. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 460 } |
| 467 return true; | 461 return true; |
| 468 default: | 462 default: |
| 469 DLOG(ERROR) << "Invalid port: " << port; | 463 DLOG(ERROR) << "Invalid port: " << port; |
| 470 return false; | 464 return false; |
| 471 } | 465 } |
| 472 } | 466 } |
| 473 | 467 |
| 474 } // namespace arc | 468 } // namespace arc |
| 475 } // namespace chromeos | 469 } // namespace chromeos |
| OLD | NEW |