| 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/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER); | 492 VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER); |
| 493 | 493 |
| 494 // Move high resolution vp9 decodes off of the main media thread (otherwise | 494 // Move high resolution vp9 decodes off of the main media thread (otherwise |
| 495 // decode may block audio decoding, demuxing, and other control activities). | 495 // decode may block audio decoding, demuxing, and other control activities). |
| 496 if (config.coded_size().width() >= 1024) { | 496 if (config.coded_size().width() >= 1024) { |
| 497 offload_task_runner_ = | 497 offload_task_runner_ = |
| 498 g_vpx_offload_thread.Pointer()->RequestOffloadThread(); | 498 g_vpx_offload_thread.Pointer()->RequestOffloadThread(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 DCHECK(!memory_pool_); | 501 DCHECK(!memory_pool_); |
| 502 |
| 503 // TODO(j.isorce): mojify MemoryPool::VP9FrameBuffer |
| 504 #if 1 |
| 505 memory_pool_ = nullptr; |
| 506 #else |
| 502 memory_pool_ = new MemoryPool(); | 507 memory_pool_ = new MemoryPool(); |
| 503 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 508 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 504 memory_pool_.get(), "VpxVideoDecoder", | 509 memory_pool_.get(), "VpxVideoDecoder", |
| 505 base::ThreadTaskRunnerHandle::Get()); | 510 base::ThreadTaskRunnerHandle::Get()); |
| 506 | 511 |
| 507 if (vpx_codec_set_frame_buffer_functions(vpx_codec_, | 512 if (vpx_codec_set_frame_buffer_functions(vpx_codec_, |
| 508 &MemoryPool::GetVP9FrameBuffer, | 513 &MemoryPool::GetVP9FrameBuffer, |
| 509 &MemoryPool::ReleaseVP9FrameBuffer, | 514 &MemoryPool::ReleaseVP9FrameBuffer, |
| 510 memory_pool_.get())) { | 515 memory_pool_.get())) { |
| 511 DLOG(ERROR) << "Failed to configure external buffers. " | 516 DLOG(ERROR) << "Failed to configure external buffers. " |
| 512 << vpx_codec_error(vpx_codec_); | 517 << vpx_codec_error(vpx_codec_); |
| 513 return false; | 518 return false; |
| 514 } | 519 } |
| 520 #endif |
| 515 } | 521 } |
| 516 | 522 |
| 517 if (config.format() != PIXEL_FORMAT_YV12A) | 523 if (config.format() != PIXEL_FORMAT_YV12A) |
| 518 return true; | 524 return true; |
| 519 | 525 |
| 520 vpx_codec_alpha_ = InitializeVpxContext(vpx_codec_alpha_, config); | 526 vpx_codec_alpha_ = InitializeVpxContext(vpx_codec_alpha_, config); |
| 521 return !!vpx_codec_alpha_; | 527 return !!vpx_codec_alpha_; |
| 522 } | 528 } |
| 523 | 529 |
| 524 void VpxVideoDecoder::CloseDecoder() { | 530 void VpxVideoDecoder::CloseDecoder() { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 (*video_frame)->visible_data(VideoFrame::kUPlane), | 863 (*video_frame)->visible_data(VideoFrame::kUPlane), |
| 858 (*video_frame)->stride(VideoFrame::kUPlane), | 864 (*video_frame)->stride(VideoFrame::kUPlane), |
| 859 (*video_frame)->visible_data(VideoFrame::kVPlane), | 865 (*video_frame)->visible_data(VideoFrame::kVPlane), |
| 860 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), | 866 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), |
| 861 coded_size.height()); | 867 coded_size.height()); |
| 862 | 868 |
| 863 return true; | 869 return true; |
| 864 } | 870 } |
| 865 | 871 |
| 866 } // namespace media | 872 } // namespace media |
| OLD | NEW |