| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/common/gpu/media/android_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 pending_bitstream_buffers_.front().first; | 215 pending_bitstream_buffers_.front().first; |
| 216 pending_bitstream_buffers_.pop(); | 216 pending_bitstream_buffers_.pop(); |
| 217 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", | 217 TRACE_COUNTER1("media", "AVDA::PendingBitstreamBufferCount", |
| 218 pending_bitstream_buffers_.size()); | 218 pending_bitstream_buffers_.size()); |
| 219 | 219 |
| 220 if (bitstream_buffer.id() == -1) { | 220 if (bitstream_buffer.id() == -1) { |
| 221 media_codec_->QueueEOS(input_buf_index); | 221 media_codec_->QueueEOS(input_buf_index); |
| 222 return true; | 222 return true; |
| 223 } | 223 } |
| 224 | 224 |
| 225 scoped_ptr<base::SharedMemory> shm( | 225 scoped_ptr<SharedMemoryRegion> shm( |
| 226 new base::SharedMemory(bitstream_buffer.handle(), true)); | 226 new SharedMemoryRegion(bitstream_buffer, true)); |
| 227 RETURN_ON_FAILURE(this, shm->Map(bitstream_buffer.size()), | 227 RETURN_ON_FAILURE(this, shm->Map(), "Failed to SharedMemoryRegion::Map()", |
| 228 "Failed to SharedMemory::Map()", UNREADABLE_INPUT, false); | 228 UNREADABLE_INPUT, false); |
| 229 | 229 |
| 230 const base::TimeDelta presentation_timestamp = | 230 const base::TimeDelta presentation_timestamp = |
| 231 bitstream_buffer.presentation_timestamp(); | 231 bitstream_buffer.presentation_timestamp(); |
| 232 DCHECK(presentation_timestamp != media::kNoTimestamp()) | 232 DCHECK(presentation_timestamp != media::kNoTimestamp()) |
| 233 << "Bitstream buffers must have valid presentation timestamps"; | 233 << "Bitstream buffers must have valid presentation timestamps"; |
| 234 | 234 |
| 235 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt | 235 // There may already be a bitstream buffer with this timestamp, e.g., VP9 alt |
| 236 // ref frames, but it's OK to overwrite it because we only expect a single | 236 // ref frames, but it's OK to overwrite it because we only expect a single |
| 237 // output frame to have that timestamp. AVDA clients only use the bitstream | 237 // output frame to have that timestamp. AVDA clients only use the bitstream |
| 238 // buffer id in the returned Pictures to map a bitstream buffer back to a | 238 // buffer id in the returned Pictures to map a bitstream buffer back to a |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 | 713 |
| 714 if (UseDeferredRenderingStrategy()) { | 714 if (UseDeferredRenderingStrategy()) { |
| 715 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 715 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 716 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; | 716 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; |
| 717 } | 717 } |
| 718 | 718 |
| 719 return capabilities; | 719 return capabilities; |
| 720 } | 720 } |
| 721 | 721 |
| 722 } // namespace content | 722 } // namespace content |
| OLD | NEW |