| 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 17 matching lines...) Expand all Loading... |
| 28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
| 29 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 30 #include "base/trace_event/memory_allocator_dump.h" | 30 #include "base/trace_event/memory_allocator_dump.h" |
| 31 #include "base/trace_event/memory_dump_manager.h" | 31 #include "base/trace_event/memory_dump_manager.h" |
| 32 #include "base/trace_event/memory_dump_provider.h" | 32 #include "base/trace_event/memory_dump_provider.h" |
| 33 #include "base/trace_event/process_memory_dump.h" | 33 #include "base/trace_event/process_memory_dump.h" |
| 34 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 35 #include "media/base/bind_to_current_loop.h" | 35 #include "media/base/bind_to_current_loop.h" |
| 36 #include "media/base/decoder_buffer.h" | 36 #include "media/base/decoder_buffer.h" |
| 37 #include "media/base/media_switches.h" | 37 #include "media/base/media_switches.h" |
| 38 #include "media/base/video_frame_provider.h" |
| 38 | 39 |
| 39 // Include libvpx header files. | 40 // Include libvpx header files. |
| 40 // VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide | 41 // VPX_CODEC_DISABLE_COMPAT excludes parts of the libvpx API that provide |
| 41 // backwards compatibility for legacy applications using the library. | 42 // backwards compatibility for legacy applications using the library. |
| 42 #define VPX_CODEC_DISABLE_COMPAT 1 | 43 #define VPX_CODEC_DISABLE_COMPAT 1 |
| 43 extern "C" { | 44 extern "C" { |
| 44 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" | 45 #include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" |
| 45 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h" | 46 #include "third_party/libvpx/source/libvpx/vpx/vpx_decoder.h" |
| 46 #include "third_party/libvpx/source/libvpx/vpx/vpx_frame_buffer.h" | 47 #include "third_party/libvpx/source/libvpx/vpx/vpx_frame_buffer.h" |
| 47 } | 48 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 void VpxVideoDecoder::MemoryPool::OnVideoFrameDestroyed( | 335 void VpxVideoDecoder::MemoryPool::OnVideoFrameDestroyed( |
| 335 VP9FrameBuffer* frame_buffer) { | 336 VP9FrameBuffer* frame_buffer) { |
| 336 --frame_buffer->ref_cnt; | 337 --frame_buffer->ref_cnt; |
| 337 } | 338 } |
| 338 | 339 |
| 339 VpxVideoDecoder::VpxVideoDecoder() | 340 VpxVideoDecoder::VpxVideoDecoder() |
| 340 : state_(kUninitialized), vpx_codec_(nullptr), vpx_codec_alpha_(nullptr) { | 341 : state_(kUninitialized), vpx_codec_(nullptr), vpx_codec_alpha_(nullptr) { |
| 341 thread_checker_.DetachFromThread(); | 342 thread_checker_.DetachFromThread(); |
| 342 } | 343 } |
| 343 | 344 |
| 345 VpxVideoDecoder::VpxVideoDecoder( |
| 346 std::unique_ptr<VideoFrameProvider> video_frame_provider) |
| 347 : state_(kUninitialized), |
| 348 vpx_codec_(nullptr), |
| 349 vpx_codec_alpha_(nullptr), |
| 350 frame_pool_(std::move(video_frame_provider)) { |
| 351 thread_checker_.DetachFromThread(); |
| 352 } |
| 353 |
| 344 VpxVideoDecoder::~VpxVideoDecoder() { | 354 VpxVideoDecoder::~VpxVideoDecoder() { |
| 345 DCHECK(thread_checker_.CalledOnValidThread()); | 355 DCHECK(thread_checker_.CalledOnValidThread()); |
| 346 CloseDecoder(); | 356 CloseDecoder(); |
| 347 // Ensure CloseDecoder() released the offload thread. | 357 // Ensure CloseDecoder() released the offload thread. |
| 348 DCHECK(!offload_task_runner_); | 358 DCHECK(!offload_task_runner_); |
| 349 } | 359 } |
| 350 | 360 |
| 351 std::string VpxVideoDecoder::GetDisplayName() const { | 361 std::string VpxVideoDecoder::GetDisplayName() const { |
| 352 return "VpxVideoDecoder"; | 362 return "VpxVideoDecoder"; |
| 353 } | 363 } |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 (*video_frame)->visible_data(VideoFrame::kUPlane), | 857 (*video_frame)->visible_data(VideoFrame::kUPlane), |
| 848 (*video_frame)->stride(VideoFrame::kUPlane), | 858 (*video_frame)->stride(VideoFrame::kUPlane), |
| 849 (*video_frame)->visible_data(VideoFrame::kVPlane), | 859 (*video_frame)->visible_data(VideoFrame::kVPlane), |
| 850 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), | 860 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), |
| 851 coded_size.height()); | 861 coded_size.height()); |
| 852 | 862 |
| 853 return true; | 863 return true; |
| 854 } | 864 } |
| 855 | 865 |
| 856 } // namespace media | 866 } // namespace media |
| OLD | NEW |