| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const base::Callback<bool(void)>& make_context_current, | 43 const base::Callback<bool(void)>& make_context_current, |
| 44 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); | 44 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 45 ~V4L2SliceVideoDecodeAccelerator() override; | 45 ~V4L2SliceVideoDecodeAccelerator() override; |
| 46 | 46 |
| 47 // media::VideoDecodeAccelerator implementation. | 47 // media::VideoDecodeAccelerator implementation. |
| 48 bool Initialize(const Config& config, Client* client) override; | 48 bool Initialize(const Config& config, Client* client) override; |
| 49 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 49 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 50 void AssignPictureBuffers( | 50 void AssignPictureBuffers( |
| 51 const std::vector<media::PictureBuffer>& buffers) override; | 51 const std::vector<media::PictureBuffer>& buffers) override; |
| 52 void ReusePictureBuffer(int32_t picture_buffer_id) override; | 52 void ReusePictureBuffer(int32_t picture_buffer_id) override; |
| 53 void Flush() override; | 53 void Flush(bool return_buffers) override; |
| 54 void Reset() override; | 54 void Reset() override; |
| 55 void Destroy() override; | 55 void Destroy() override; |
| 56 bool CanDecodeOnIOThread() override; | 56 bool CanDecodeOnIOThread() override; |
| 57 | 57 |
| 58 static media::VideoDecodeAccelerator::SupportedProfiles | 58 static media::VideoDecodeAccelerator::SupportedProfiles |
| 59 GetSupportedProfiles(); | 59 GetSupportedProfiles(); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 class V4L2H264Accelerator; | 62 class V4L2H264Accelerator; |
| 63 class V4L2VP8Accelerator; | 63 class V4L2VP8Accelerator; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 // Sets the state to kError and notifies client if needed. | 177 // Sets the state to kError and notifies client if needed. |
| 178 void SetErrorState(Error error); | 178 void SetErrorState(Error error); |
| 179 | 179 |
| 180 // Flush flow when requested by client. | 180 // Flush flow when requested by client. |
| 181 // When Flush() is called, it posts a FlushTask, which checks the input queue. | 181 // When Flush() is called, it posts a FlushTask, which checks the input queue. |
| 182 // If nothing is pending for decode on decoder_input_queue_, we call | 182 // If nothing is pending for decode on decoder_input_queue_, we call |
| 183 // InitiateFlush() directly. Otherwise, we push a dummy BitstreamBufferRef | 183 // InitiateFlush() directly. Otherwise, we push a dummy BitstreamBufferRef |
| 184 // onto the decoder_input_queue_ to schedule a flush. When we reach it later | 184 // onto the decoder_input_queue_ to schedule a flush. When we reach it later |
| 185 // on, we call InitiateFlush() to perform it at the correct time. | 185 // on, we call InitiateFlush() to perform it at the correct time. |
| 186 void FlushTask(); | 186 void FlushTask(bool return_buffers); |
| 187 // Tell the decoder to flush all frames, reset it and mark us as scheduled | 187 // Tell the decoder to flush all frames, reset it and mark us as scheduled |
| 188 // for flush, so that we can finish it once all pending decodes are finished. | 188 // for flush, so that we can finish it once all pending decodes are finished. |
| 189 void InitiateFlush(); | 189 void InitiateFlush(); |
| 190 // To be called if decoder_flushing_ is true. If not all pending frames are | 190 // To be called if decoder_flushing_ is true. If not all pending frames are |
| 191 // decoded, return false, requesting the caller to try again later. | 191 // decoded, return false, requesting the caller to try again later. |
| 192 // Otherwise perform flush by sending all pending pictures to the client, | 192 // Otherwise perform flush by sending all pending pictures to the client, |
| 193 // notify it that flush is finished and return true, informing the caller | 193 // notify it that flush is finished and return true, informing the caller |
| 194 // that further progress can be made. | 194 // that further progress can be made. |
| 195 bool FinishFlush(); | 195 bool FinishFlush(); |
| 196 | 196 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // Decoder state. | 365 // Decoder state. |
| 366 State state_; | 366 State state_; |
| 367 | 367 |
| 368 // If any of these are true, we are waiting for the device to finish decoding | 368 // If any of these are true, we are waiting for the device to finish decoding |
| 369 // all previously-queued frames, so we can finish the flush/reset/surface | 369 // all previously-queued frames, so we can finish the flush/reset/surface |
| 370 // change flows. These can stack. | 370 // change flows. These can stack. |
| 371 bool decoder_flushing_; | 371 bool decoder_flushing_; |
| 372 bool decoder_resetting_; | 372 bool decoder_resetting_; |
| 373 bool surface_set_change_pending_; | 373 bool surface_set_change_pending_; |
| 374 | 374 |
| 375 // When flushing, if true, indicates that we were requested to return all |
| 376 // output buffers, not only those containing pictures produced during flush. |
| 377 bool flush_return_all_buffers_; |
| 378 |
| 375 // Hardware accelerators. | 379 // Hardware accelerators. |
| 376 // TODO(posciak): Try to have a superclass here if possible. | 380 // TODO(posciak): Try to have a superclass here if possible. |
| 377 scoped_ptr<V4L2H264Accelerator> h264_accelerator_; | 381 scoped_ptr<V4L2H264Accelerator> h264_accelerator_; |
| 378 scoped_ptr<V4L2VP8Accelerator> vp8_accelerator_; | 382 scoped_ptr<V4L2VP8Accelerator> vp8_accelerator_; |
| 379 | 383 |
| 380 // Codec-specific software decoder in use. | 384 // Codec-specific software decoder in use. |
| 381 scoped_ptr<AcceleratedVideoDecoder> decoder_; | 385 scoped_ptr<AcceleratedVideoDecoder> decoder_; |
| 382 | 386 |
| 383 // Surfaces queued to device to keep references to them while decoded. | 387 // Surfaces queued to device to keep references to them while decoded. |
| 384 using V4L2DecodeSurfaceByOutputId = | 388 using V4L2DecodeSurfaceByOutputId = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 410 | 414 |
| 411 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); | 415 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); |
| 412 }; | 416 }; |
| 413 | 417 |
| 414 class V4L2H264Picture; | 418 class V4L2H264Picture; |
| 415 class V4L2VP8Picture; | 419 class V4L2VP8Picture; |
| 416 | 420 |
| 417 } // namespace content | 421 } // namespace content |
| 418 | 422 |
| 419 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 423 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |