| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file contains an implementation of VideoDecodeAccelerator | 5 // This file contains an implementation of VideoDecodeAccelerator |
| 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API | 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API |
| 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). | 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). |
| 8 | 8 |
| 9 #ifndef MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 9 #ifndef MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| 10 #define MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 10 #define MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 std::unique_ptr<EGLSyncKHRRef> egl_sync_ref); | 283 std::unique_ptr<EGLSyncKHRRef> egl_sync_ref); |
| 284 | 284 |
| 285 // Flush() task. Child thread should not submit any more buffers until it | 285 // Flush() task. Child thread should not submit any more buffers until it |
| 286 // receives the NotifyFlushDone callback. This task will schedule an empty | 286 // receives the NotifyFlushDone callback. This task will schedule an empty |
| 287 // BitstreamBufferRef (with input_id == kFlushBufferId) to perform the flush. | 287 // BitstreamBufferRef (with input_id == kFlushBufferId) to perform the flush. |
| 288 void FlushTask(); | 288 void FlushTask(); |
| 289 // Notify the client of a flush completion, if required. This should be | 289 // Notify the client of a flush completion, if required. This should be |
| 290 // called any time a relevant queue could potentially be emptied: see | 290 // called any time a relevant queue could potentially be emptied: see |
| 291 // function definition. | 291 // function definition. |
| 292 void NotifyFlushDoneIfNeeded(); | 292 void NotifyFlushDoneIfNeeded(); |
| 293 // Returns true if V4L2_DEC_CMD_STOP are supported. |
| 294 bool IsDecoderCmdSupported(); |
| 293 | 295 |
| 294 // Reset() task. Drop all input buffers. If V4L2VDA is not doing resolution | 296 // Reset() task. Drop all input buffers. If V4L2VDA is not doing resolution |
| 295 // change or waiting picture buffers, call FinishReset. | 297 // change or waiting picture buffers, call FinishReset. |
| 296 void ResetTask(); | 298 void ResetTask(); |
| 297 // This will schedule a ResetDoneTask() that will send the NotifyResetDone | 299 // This will schedule a ResetDoneTask() that will send the NotifyResetDone |
| 298 // callback, then set the decoder state to kResetting so that all intervening | 300 // callback, then set the decoder state to kResetting so that all intervening |
| 299 // tasks will drain. | 301 // tasks will drain. |
| 300 void FinishReset(); | 302 void FinishReset(); |
| 301 void ResetDoneTask(); | 303 void ResetDoneTask(); |
| 302 | 304 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // delay these buffers until after the flush or reset completes. | 444 // delay these buffers until after the flush or reset completes. |
| 443 int decoder_delay_bitstream_buffer_id_; | 445 int decoder_delay_bitstream_buffer_id_; |
| 444 // Input buffer we're presently filling. | 446 // Input buffer we're presently filling. |
| 445 int decoder_current_input_buffer_; | 447 int decoder_current_input_buffer_; |
| 446 // We track the number of buffer decode tasks we have scheduled, since each | 448 // We track the number of buffer decode tasks we have scheduled, since each |
| 447 // task execution should complete one buffer. If we fall behind (due to | 449 // task execution should complete one buffer. If we fall behind (due to |
| 448 // resource backpressure, etc.), we'll have to schedule more to catch up. | 450 // resource backpressure, etc.), we'll have to schedule more to catch up. |
| 449 int decoder_decode_buffer_tasks_scheduled_; | 451 int decoder_decode_buffer_tasks_scheduled_; |
| 450 // Picture buffers held by the client. | 452 // Picture buffers held by the client. |
| 451 int decoder_frames_at_client_; | 453 int decoder_frames_at_client_; |
| 454 |
| 452 // Are we flushing? | 455 // Are we flushing? |
| 453 bool decoder_flushing_; | 456 bool decoder_flushing_; |
| 457 // True if V4L2_DEC_CMD_STOP are supported. |
| 458 bool decoder_cmd_supported_; |
| 459 // True if flushing is waiting for last output buffer. |
| 460 bool flush_waiting_last_output_buffer_; |
| 461 |
| 454 // Got a reset request while we were performing resolution change or waiting | 462 // Got a reset request while we were performing resolution change or waiting |
| 455 // picture buffers. | 463 // picture buffers. |
| 456 bool reset_pending_; | 464 bool reset_pending_; |
| 457 // Input queue for decoder_thread_: BitstreamBuffers in. | 465 // Input queue for decoder_thread_: BitstreamBuffers in. |
| 458 std::queue<linked_ptr<BitstreamBufferRef>> decoder_input_queue_; | 466 std::queue<linked_ptr<BitstreamBufferRef>> decoder_input_queue_; |
| 459 // For H264 decode, hardware requires that we send it frame-sized chunks. | 467 // For H264 decode, hardware requires that we send it frame-sized chunks. |
| 460 // We'll need to parse the stream. | 468 // We'll need to parse the stream. |
| 461 std::unique_ptr<H264Parser> decoder_h264_parser_; | 469 std::unique_ptr<H264Parser> decoder_h264_parser_; |
| 462 // Set if the decoder has a pending incomplete frame in an input buffer. | 470 // Set if the decoder has a pending incomplete frame in an input buffer. |
| 463 bool decoder_partial_frame_pending_; | 471 bool decoder_partial_frame_pending_; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 566 |
| 559 // The WeakPtrFactory for |weak_this_|. | 567 // The WeakPtrFactory for |weak_this_|. |
| 560 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 568 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |
| 561 | 569 |
| 562 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 570 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 563 }; | 571 }; |
| 564 | 572 |
| 565 } // namespace media | 573 } // namespace media |
| 566 | 574 |
| 567 #endif // MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 575 #endif // MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |