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 "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 const media::BitstreamBuffer& bitstream_buffer) { | 440 const media::BitstreamBuffer& bitstream_buffer) { |
441 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 441 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
442 TRACE_EVENT1("Video Decoder", "MapAndQueueNewInputBuffer", "input_id", | 442 TRACE_EVENT1("Video Decoder", "MapAndQueueNewInputBuffer", "input_id", |
443 bitstream_buffer.id()); | 443 bitstream_buffer.id()); |
444 | 444 |
445 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() | 445 DVLOG(4) << "Mapping new input buffer id: " << bitstream_buffer.id() |
446 << " size: " << (int)bitstream_buffer.size(); | 446 << " size: " << (int)bitstream_buffer.size(); |
447 | 447 |
448 scoped_ptr<base::SharedMemory> shm( | 448 scoped_ptr<base::SharedMemory> shm( |
449 new base::SharedMemory(bitstream_buffer.handle(), true)); | 449 new base::SharedMemory(bitstream_buffer.handle(), true)); |
450 RETURN_AND_NOTIFY_ON_FAILURE(shm->Map(bitstream_buffer.size()), | 450 RETURN_AND_NOTIFY_ON_FAILURE( |
451 "Failed to map input buffer", UNREADABLE_INPUT,); | 451 shm->MapAt(bitstream_buffer.offset(), bitstream_buffer.size()), |
| 452 "Failed to map input buffer", UNREADABLE_INPUT, ); |
452 | 453 |
453 base::AutoLock auto_lock(lock_); | 454 base::AutoLock auto_lock(lock_); |
454 | 455 |
455 // Set up a new input buffer and queue it for later. | 456 // Set up a new input buffer and queue it for later. |
456 linked_ptr<InputBuffer> input_buffer(new InputBuffer()); | 457 linked_ptr<InputBuffer> input_buffer(new InputBuffer()); |
457 input_buffer->shm.reset(shm.release()); | 458 input_buffer->shm.reset(shm.release()); |
458 input_buffer->id = bitstream_buffer.id(); | 459 input_buffer->id = bitstream_buffer.id(); |
459 input_buffer->size = bitstream_buffer.size(); | 460 input_buffer->size = bitstream_buffer.size(); |
460 | 461 |
461 ++num_stream_bufs_at_decoder_; | 462 ++num_stream_bufs_at_decoder_; |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 return vaapi_pic->dec_surface(); | 1740 return vaapi_pic->dec_surface(); |
1740 } | 1741 } |
1741 | 1742 |
1742 // static | 1743 // static |
1743 media::VideoDecodeAccelerator::SupportedProfiles | 1744 media::VideoDecodeAccelerator::SupportedProfiles |
1744 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1745 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
1745 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1746 return VaapiWrapper::GetSupportedDecodeProfiles(); |
1746 } | 1747 } |
1747 | 1748 |
1748 } // namespace content | 1749 } // namespace content |
OLD | NEW |