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 #ifndef CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // sent, a particular |action| should be completed at. | 76 // sent, a particular |action| should be completed at. |
77 struct PendingAction { | 77 struct PendingAction { |
78 PendingAction(Action action, int32_t bitstream_id); | 78 PendingAction(Action action, int32_t bitstream_id); |
79 ~PendingAction(); | 79 ~PendingAction(); |
80 | 80 |
81 Action action; | 81 Action action; |
82 int32_t bitstream_id; | 82 int32_t bitstream_id; |
83 }; | 83 }; |
84 | 84 |
85 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|. | 85 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|. |
86 void ConfigureDecoder( | 86 bool ConfigureDecoder( |
87 const std::vector<const uint8_t*>& nalu_data_ptrs, | 87 const std::vector<const uint8_t*>& nalu_data_ptrs, |
88 const std::vector<size_t>& nalu_data_sizes); | 88 const std::vector<size_t>& nalu_data_sizes); |
89 void DecodeTask(const media::BitstreamBuffer); | 89 void DecodeTask(const media::BitstreamBuffer&); |
90 void FlushTask(); | 90 void FlushTask(); |
| 91 void DropBitstream(int32_t bitstream_id); |
91 | 92 |
92 // Methods for interacting with |client_|. Run on |gpu_task_runner_|. | 93 // Methods for interacting with |client_|. Run on |gpu_task_runner_|. |
93 void OutputTask(DecodedFrame frame); | 94 void OutputTask(DecodedFrame frame); |
94 void SizeChangedTask(gfx::Size coded_size); | 95 void SizeChangedTask(gfx::Size coded_size); |
| 96 void NotifyError(Error error); |
95 | 97 |
96 // Send decoded frames up to and including |up_to_bitstream_id|, and return | 98 // Send decoded frames up to and including |up_to_bitstream_id|, and return |
97 // the last sent |bitstream_id|. | 99 // the last sent |bitstream_id|. |
98 int32_t SendPictures(int32_t up_to_bitstream_id); | 100 int32_t SendPictures(int32_t up_to_bitstream_id); |
99 | 101 |
100 // Since VideoToolbox has no reset feature (only flush), and the VDA API | 102 // Since VideoToolbox has no reset feature (only flush), and the VDA API |
101 // allows Decode() and Flush() calls during a reset operation, it's possible | 103 // allows Decode() and Flush() calls during a reset operation, it's possible |
102 // to have multiple pending actions at once. We handle the fully general case | 104 // to have multiple pending actions at once. We handle the fully general case |
103 // of an arbitrary sequence of pending actions (in reality, there should | 105 // of an arbitrary sequence of pending actions (in reality, there should |
104 // probably be at most one reset and one flush at a time). | 106 // probably be at most one reset and one flush at a time). |
(...skipping 10 matching lines...) Expand all Loading... |
115 | 117 |
116 // Complete all actions pending for a particular |bitstream_id|. | 118 // Complete all actions pending for a particular |bitstream_id|. |
117 // Warning: Do not call if there is a pending ACTION_DESTROY. | 119 // Warning: Do not call if there is a pending ACTION_DESTROY. |
118 void CompleteActions(int32_t bitstream_id); | 120 void CompleteActions(int32_t bitstream_id); |
119 | 121 |
120 // | 122 // |
121 // GPU thread state. | 123 // GPU thread state. |
122 // | 124 // |
123 CGLContextObj cgl_context_; | 125 CGLContextObj cgl_context_; |
124 media::VideoDecodeAccelerator::Client* client_; | 126 media::VideoDecodeAccelerator::Client* client_; |
| 127 bool has_error_; // client_->NotifyError() called. |
125 gfx::Size texture_size_; | 128 gfx::Size texture_size_; |
126 std::queue<PendingAction> pending_actions_; | 129 std::queue<PendingAction> pending_actions_; |
127 std::queue<int32_t> pending_bitstream_ids_; | 130 std::queue<int32_t> pending_bitstream_ids_; |
128 | 131 |
129 // Texture IDs of pictures. | 132 // Texture IDs of pictures. |
130 // TODO(sandersd): A single map of structs holding picture data. | 133 // TODO(sandersd): A single map of structs holding picture data. |
131 std::map<int32_t, uint32_t> texture_ids_; | 134 std::map<int32_t, uint32_t> texture_ids_; |
132 | 135 |
133 // Pictures ready to be rendered to. | 136 // Pictures ready to be rendered to. |
134 std::queue<int32_t> available_picture_ids_; | 137 std::queue<int32_t> available_picture_ids_; |
(...skipping 25 matching lines...) Expand all Loading... |
160 // Declared last to ensure that all decoder thread tasks complete before any | 163 // Declared last to ensure that all decoder thread tasks complete before any |
161 // state is destructed. | 164 // state is destructed. |
162 base::Thread decoder_thread_; | 165 base::Thread decoder_thread_; |
163 | 166 |
164 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); | 167 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); |
165 }; | 168 }; |
166 | 169 |
167 } // namespace content | 170 } // namespace content |
168 | 171 |
169 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ | 172 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |