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, |
307 uint32_t textures_per_buffer, | 308 uint32_t textures_per_buffer, |
308 const gfx::Size& dimensions, | 309 const gfx::Size& dimensions, |
309 uint32_t texture_target) { | 310 uint32_t texture_target) { |
310 DVLOG(5) << "ProvidePictureBuffers(" | 311 DVLOG(5) << "ProvidePictureBuffers(" |
311 << "requested_num_of_buffers=" << requested_num_of_buffers | 312 << "requested_num_of_buffers=" << requested_num_of_buffers |
312 << ", dimensions=" << dimensions.ToString() << ")"; | 313 << ", dimensions=" << dimensions.ToString() << ")"; |
313 DCHECK(thread_checker_.CalledOnValidThread()); | 314 DCHECK(thread_checker_.CalledOnValidThread()); |
314 coded_size_ = dimensions; | 315 coded_size_ = dimensions; |
315 output_pixel_format_ = vda_->GetOutputFormat(); | 316 if ((output_pixel_format_ != media::PIXEL_FORMAT_UNKNOWN) && |
| 317 (output_pixel_format_ != output_pixel_format)) { |
| 318 arc_client_->OnError(PLATFORM_FAILURE); |
| 319 return; |
| 320 } |
| 321 output_pixel_format_ = output_pixel_format; |
316 | 322 |
317 VideoFormat video_format; | 323 VideoFormat video_format; |
318 switch (output_pixel_format_) { | 324 switch (output_pixel_format_) { |
319 case media::PIXEL_FORMAT_I420: | 325 case media::PIXEL_FORMAT_I420: |
320 case media::PIXEL_FORMAT_YV12: | 326 case media::PIXEL_FORMAT_YV12: |
321 case media::PIXEL_FORMAT_NV12: | 327 case media::PIXEL_FORMAT_NV12: |
322 case media::PIXEL_FORMAT_NV21: | 328 case media::PIXEL_FORMAT_NV21: |
323 // HAL_PIXEL_FORMAT_YCbCr_420_888 is the flexible pixel format in Android | 329 // HAL_PIXEL_FORMAT_YCbCr_420_888 is the flexible pixel format in Android |
324 // which handles all 420 formats, with both orderings of chroma (CbCr and | 330 // which handles all 420 formats, with both orderings of chroma (CbCr and |
325 // CrCb) as well as planar and semi-planar layouts. | 331 // CrCb) as well as planar and semi-planar layouts. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 466 } |
461 return true; | 467 return true; |
462 default: | 468 default: |
463 DLOG(ERROR) << "Invalid port: " << port; | 469 DLOG(ERROR) << "Invalid port: " << port; |
464 return false; | 470 return false; |
465 } | 471 } |
466 } | 472 } |
467 | 473 |
468 } // namespace arc | 474 } // namespace arc |
469 } // namespace chromeos | 475 } // namespace chromeos |
OLD | NEW |