Chromium Code Reviews| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 // limits::kMaxVideoFrames to fill up the GpuVideoDecode pipeline, | 129 // limits::kMaxVideoFrames to fill up the GpuVideoDecode pipeline, |
| 130 // and +1 for a frame in transit. | 130 // and +1 for a frame in transit. |
| 131 kDpbOutputBufferExtraCount = limits::kMaxVideoFrames + 1, | 131 kDpbOutputBufferExtraCount = limits::kMaxVideoFrames + 1, |
| 132 // Number of extra output buffers if image processor is used. | 132 // Number of extra output buffers if image processor is used. |
| 133 kDpbOutputBufferExtraCountForImageProcessor = 1, | 133 kDpbOutputBufferExtraCountForImageProcessor = 1, |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 // Internal state of the decoder. | 136 // Internal state of the decoder. |
| 137 enum State { | 137 enum State { |
| 138 kUninitialized, // Initialize() not yet called. | 138 kUninitialized, // Initialize() not yet called. |
| 139 kInitialized, // Initialize() returned true; ready to start decoding. | 139 kInitialized, // InitializeTask() succeeds; ready to start decoding. |
|
kcwu
2016/11/29 03:51:46
this is still "Initialize() returned true"
wuchengli
2016/11/29 05:18:22
Done.
| |
| 140 kDecoding, // DecodeBufferInitial() successful; decoding frames. | 140 kDecoding, // DecodeBufferInitial() successful; decoding frames. |
| 141 kResetting, // Presently resetting. | 141 kResetting, // Presently resetting. |
| 142 // Performing resolution change and waiting for image processor to return | 142 // Performing resolution change and waiting for image processor to return |
| 143 // all frames. | 143 // all frames. |
| 144 kChangingResolution, | 144 kChangingResolution, |
| 145 // Requested new PictureBuffers via ProvidePictureBuffers(), awaiting | 145 // Requested new PictureBuffers via ProvidePictureBuffers(), awaiting |
| 146 // AssignPictureBuffers(). | 146 // AssignPictureBuffers(). |
| 147 kAwaitingPictureBuffers, | 147 kAwaitingPictureBuffers, |
| 148 kError, // Error in kDecoding state. | 148 kError, // Error in kDecoding state. |
| 149 }; | 149 }; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 // Input fds of the processor. Exported from the decoder. | 195 // Input fds of the processor. Exported from the decoder. |
| 196 std::vector<base::ScopedFD> processor_input_fds; | 196 std::vector<base::ScopedFD> processor_input_fds; |
| 197 // Output fds of the processor. Used only when OutputMode is IMPORT. | 197 // Output fds of the processor. Used only when OutputMode is IMPORT. |
| 198 std::vector<base::ScopedFD> processor_output_fds; | 198 std::vector<base::ScopedFD> processor_output_fds; |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 // | 201 // |
| 202 // Decoding tasks, to be run on decode_thread_. | 202 // Decoding tasks, to be run on decode_thread_. |
| 203 // | 203 // |
| 204 | 204 |
| 205 // Task to finish initialization on decoder_thread_. | |
| 206 void InitializeTask(); | |
| 207 | |
| 205 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the | 208 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the |
| 206 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode | 209 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode |
| 207 // the buffer. | 210 // the buffer. |
| 208 void DecodeTask(const BitstreamBuffer& bitstream_buffer); | 211 void DecodeTask(const BitstreamBuffer& bitstream_buffer); |
| 209 | 212 |
| 210 // Decode from the buffers queued in decoder_input_queue_. Calls | 213 // Decode from the buffers queued in decoder_input_queue_. Calls |
| 211 // DecodeBufferInitial() or DecodeBufferContinue() as appropriate. | 214 // DecodeBufferInitial() or DecodeBufferContinue() as appropriate. |
| 212 void DecodeBufferTask(); | 215 void DecodeBufferTask(); |
| 213 // Advance to the next fragment that begins a frame. | 216 // Advance to the next fragment that begins a frame. |
| 214 bool AdvanceFrameFragment(const uint8_t* data, size_t size, size_t* endpos); | 217 bool AdvanceFrameFragment(const uint8_t* data, size_t size, size_t* endpos); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 | 579 |
| 577 // The WeakPtrFactory for |weak_this_|. | 580 // The WeakPtrFactory for |weak_this_|. |
| 578 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; | 581 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; |
| 579 | 582 |
| 580 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); | 583 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); |
| 581 }; | 584 }; |
| 582 | 585 |
| 583 } // namespace media | 586 } // namespace media |
| 584 | 587 |
| 585 #endif // MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ | 588 #endif // MEDIA_GPU_V4L2_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |