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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 picture_id(-1) { | 198 picture_id(-1) { |
199 } | 199 } |
200 | 200 |
201 ExynosVideoDecodeAccelerator::GscOutputRecord::~GscOutputRecord() { | 201 ExynosVideoDecodeAccelerator::GscOutputRecord::~GscOutputRecord() { |
202 } | 202 } |
203 | 203 |
204 ExynosVideoDecodeAccelerator::ExynosVideoDecodeAccelerator( | 204 ExynosVideoDecodeAccelerator::ExynosVideoDecodeAccelerator( |
205 EGLDisplay egl_display, | 205 EGLDisplay egl_display, |
206 EGLContext egl_context, | 206 EGLContext egl_context, |
207 Client* client, | 207 Client* client, |
208 const base::Callback<bool(void)>& make_context_current) | 208 const base::Callback<bool(void)>& make_context_current, |
209 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) | |
209 : child_message_loop_proxy_(base::MessageLoopProxy::current()), | 210 : child_message_loop_proxy_(base::MessageLoopProxy::current()), |
211 io_message_loop_proxy_(io_message_loop_proxy), | |
210 weak_this_(base::AsWeakPtr(this)), | 212 weak_this_(base::AsWeakPtr(this)), |
211 client_ptr_factory_(client), | 213 client_ptr_factory_(client), |
212 client_(client_ptr_factory_.GetWeakPtr()), | 214 client_(client_ptr_factory_.GetWeakPtr()), |
213 decoder_thread_("ExynosDecoderThread"), | 215 decoder_thread_("ExynosDecoderThread"), |
214 decoder_state_(kUninitialized), | 216 decoder_state_(kUninitialized), |
215 decoder_delay_bitstream_buffer_id_(-1), | 217 decoder_delay_bitstream_buffer_id_(-1), |
216 decoder_current_input_buffer_(-1), | 218 decoder_current_input_buffer_(-1), |
217 decoder_decode_buffer_tasks_scheduled_(0), | 219 decoder_decode_buffer_tasks_scheduled_(0), |
218 decoder_frames_at_client_(0), | 220 decoder_frames_at_client_(0), |
219 decoder_flushing_(false), | 221 decoder_flushing_(false), |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 | 410 |
409 child_message_loop_proxy_->PostTask(FROM_HERE, base::Bind( | 411 child_message_loop_proxy_->PostTask(FROM_HERE, base::Bind( |
410 &Client::NotifyInitializeDone, client_)); | 412 &Client::NotifyInitializeDone, client_)); |
411 return true; | 413 return true; |
412 } | 414 } |
413 | 415 |
414 void ExynosVideoDecodeAccelerator::Decode( | 416 void ExynosVideoDecodeAccelerator::Decode( |
415 const media::BitstreamBuffer& bitstream_buffer) { | 417 const media::BitstreamBuffer& bitstream_buffer) { |
416 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() | 418 DVLOG(1) << "Decode(): input_id=" << bitstream_buffer.id() |
417 << ", size=" << bitstream_buffer.size(); | 419 << ", size=" << bitstream_buffer.size(); |
418 DCHECK(child_message_loop_proxy_->BelongsToCurrentThread()); | 420 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); |
419 | 421 |
420 scoped_ptr<BitstreamBufferRef> bitstream_record(new BitstreamBufferRef( | 422 scoped_ptr<BitstreamBufferRef> bitstream_record(new BitstreamBufferRef( |
421 client_, child_message_loop_proxy_, | 423 client_, child_message_loop_proxy_, |
422 new base::SharedMemory(bitstream_buffer.handle(), true), | 424 new base::SharedMemory(bitstream_buffer.handle(), true), |
423 bitstream_buffer.size(), bitstream_buffer.id())); | 425 bitstream_buffer.size(), bitstream_buffer.id())); |
424 if (!bitstream_record->shm->Map(bitstream_buffer.size())) { | 426 if (!bitstream_record->shm->Map(bitstream_buffer.size())) { |
piman
2013/08/27 04:01:20
This can take a non-0 time. Can you move it to the
wuchengli
2013/08/27 12:32:24
Done.
| |
425 DLOG(ERROR) << "Decode(): could not map bitstream_buffer"; | 427 DLOG(ERROR) << "Decode(): could not map bitstream_buffer"; |
426 NOTIFY_ERROR(UNREADABLE_INPUT); | 428 NOTIFY_ERROR(UNREADABLE_INPUT); |
427 return; | 429 return; |
428 } | 430 } |
429 DVLOG(3) << "Decode(): mapped to addr=" << bitstream_record->shm->memory(); | 431 DVLOG(3) << "Decode(): mapped to addr=" << bitstream_record->shm->memory(); |
430 | 432 |
431 // DecodeTask() will take care of running a DecodeBufferTask(). | 433 // DecodeTask() will take care of running a DecodeBufferTask(). |
432 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 434 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
433 &ExynosVideoDecodeAccelerator::DecodeTask, base::Unretained(this), | 435 &ExynosVideoDecodeAccelerator::DecodeTask, base::Unretained(this), |
434 base::Passed(&bitstream_record))); | 436 base::Passed(&bitstream_record))); |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2443 DestroyGscOutputBuffers(); | 2445 DestroyGscOutputBuffers(); |
2444 DestroyMfcOutputBuffers(); | 2446 DestroyMfcOutputBuffers(); |
2445 | 2447 |
2446 // Finish resolution change on decoder thread. | 2448 // Finish resolution change on decoder thread. |
2447 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( | 2449 decoder_thread_.message_loop()->PostTask(FROM_HERE, base::Bind( |
2448 &ExynosVideoDecodeAccelerator::FinishResolutionChange, | 2450 &ExynosVideoDecodeAccelerator::FinishResolutionChange, |
2449 base::Unretained(this))); | 2451 base::Unretained(this))); |
2450 } | 2452 } |
2451 | 2453 |
2452 } // namespace content | 2454 } // namespace content |
OLD | NEW |