Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: media/gpu/vt_video_decode_accelerator_mac.h

Issue 2061823003: media: Drop "media::" in media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work around clang format by adding an empty line Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/vp9_picture.h ('k') | media/gpu/vt_video_decode_accelerator_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_ 5 #ifndef MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_
6 #define MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_ 6 #define MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 17 matching lines...) Expand all
28 #include "ui/gl/gl_context_cgl.h" 28 #include "ui/gl/gl_context_cgl.h"
29 #include "ui/gl/gl_image_io_surface.h" 29 #include "ui/gl/gl_image_io_surface.h"
30 30
31 namespace media { 31 namespace media {
32 32
33 // Preload VideoToolbox libraries, needed for sandbox warmup. 33 // Preload VideoToolbox libraries, needed for sandbox warmup.
34 MEDIA_GPU_EXPORT bool InitializeVideoToolbox(); 34 MEDIA_GPU_EXPORT bool InitializeVideoToolbox();
35 35
36 // VideoToolbox.framework implementation of the VideoDecodeAccelerator 36 // VideoToolbox.framework implementation of the VideoDecodeAccelerator
37 // interface for Mac OS X (currently limited to 10.9+). 37 // interface for Mac OS X (currently limited to 10.9+).
38 class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator { 38 class VTVideoDecodeAccelerator : public VideoDecodeAccelerator {
39 public: 39 public:
40 explicit VTVideoDecodeAccelerator( 40 explicit VTVideoDecodeAccelerator(
41 const MakeGLContextCurrentCallback& make_context_current_cb, 41 const MakeGLContextCurrentCallback& make_context_current_cb,
42 const BindGLImageCallback& bind_image_cb); 42 const BindGLImageCallback& bind_image_cb);
43 43
44 ~VTVideoDecodeAccelerator() override; 44 ~VTVideoDecodeAccelerator() override;
45 45
46 // VideoDecodeAccelerator implementation. 46 // VideoDecodeAccelerator implementation.
47 bool Initialize(const Config& config, Client* client) override; 47 bool Initialize(const Config& config, Client* client) override;
48 void Decode(const media::BitstreamBuffer& bitstream) override; 48 void Decode(const BitstreamBuffer& bitstream) override;
49 void AssignPictureBuffers( 49 void AssignPictureBuffers(
50 const std::vector<media::PictureBuffer>& pictures) override; 50 const std::vector<PictureBuffer>& pictures) override;
51 void ReusePictureBuffer(int32_t picture_id) override; 51 void ReusePictureBuffer(int32_t picture_id) override;
52 void Flush() override; 52 void Flush() override;
53 void Reset() override; 53 void Reset() override;
54 void Destroy() override; 54 void Destroy() override;
55 bool TryToSetupDecodeOnSeparateThread( 55 bool TryToSetupDecodeOnSeparateThread(
56 const base::WeakPtr<Client>& decode_client, 56 const base::WeakPtr<Client>& decode_client,
57 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) 57 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
58 override; 58 override;
59 59
60 // Called by OutputThunk() when VideoToolbox finishes decoding a frame. 60 // Called by OutputThunk() when VideoToolbox finishes decoding a frame.
61 void Output(void* source_frame_refcon, 61 void Output(void* source_frame_refcon,
62 OSStatus status, 62 OSStatus status,
63 CVImageBufferRef image_buffer); 63 CVImageBufferRef image_buffer);
64 64
65 static media::VideoDecodeAccelerator::SupportedProfiles 65 static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles();
66 GetSupportedProfiles();
67 66
68 private: 67 private:
69 // Logged to UMA, so never reuse values. Make sure to update 68 // Logged to UMA, so never reuse values. Make sure to update
70 // VTVDASessionFailureType in histograms.xml to match. 69 // VTVDASessionFailureType in histograms.xml to match.
71 enum VTVDASessionFailureType { 70 enum VTVDASessionFailureType {
72 SFT_SUCCESSFULLY_INITIALIZED = 0, 71 SFT_SUCCESSFULLY_INITIALIZED = 0,
73 SFT_PLATFORM_ERROR = 1, 72 SFT_PLATFORM_ERROR = 1,
74 SFT_INVALID_STREAM = 2, 73 SFT_INVALID_STREAM = 2,
75 SFT_UNSUPPORTED_STREAM_PARAMETERS = 3, 74 SFT_UNSUPPORTED_STREAM_PARAMETERS = 3,
76 SFT_DECODE_ERROR = 4, 75 SFT_DECODE_ERROR = 4,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 private: 144 private:
146 DISALLOW_COPY_AND_ASSIGN(PictureInfo); 145 DISALLOW_COPY_AND_ASSIGN(PictureInfo);
147 }; 146 };
148 147
149 // 148 //
150 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|. 149 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|.
151 // 150 //
152 151
153 // Compute the |pic_order_cnt| for a frame. Returns true or calls 152 // Compute the |pic_order_cnt| for a frame. Returns true or calls
154 // NotifyError() before returning false. 153 // NotifyError() before returning false.
155 bool ComputePicOrderCnt(const media::H264SPS* sps, 154 bool ComputePicOrderCnt(const H264SPS* sps,
156 const media::H264SliceHeader& slice_hdr, 155 const H264SliceHeader& slice_hdr,
157 Frame* frame); 156 Frame* frame);
158 157
159 // Set up VideoToolbox using the current SPS and PPS. Returns true or calls 158 // Set up VideoToolbox using the current SPS and PPS. Returns true or calls
160 // NotifyError() before returning false. 159 // NotifyError() before returning false.
161 bool ConfigureDecoder(); 160 bool ConfigureDecoder();
162 161
163 // Wait for VideoToolbox to output all pending frames. Returns true or calls 162 // Wait for VideoToolbox to output all pending frames. Returns true or calls
164 // NotifyError() before returning false. 163 // NotifyError() before returning false.
165 bool FinishDelayedFrames(); 164 bool FinishDelayedFrames();
166 165
167 // |frame| is owned by |pending_frames_|. 166 // |frame| is owned by |pending_frames_|.
168 void DecodeTask(const media::BitstreamBuffer&, Frame* frame); 167 void DecodeTask(const BitstreamBuffer&, Frame* frame);
169 void DecodeDone(Frame* frame); 168 void DecodeDone(Frame* frame);
170 169
171 // 170 //
172 // Methods for interacting with |client_|. Run on |gpu_task_runner_|. 171 // Methods for interacting with |client_|. Run on |gpu_task_runner_|.
173 // 172 //
174 void NotifyError(Error vda_error_type, 173 void NotifyError(Error vda_error_type,
175 VTVDASessionFailureType session_failure_type); 174 VTVDASessionFailureType session_failure_type);
176 175
177 // |type| is the type of task that the flush will complete, one of TASK_FLUSH, 176 // |type| is the type of task that the flush will complete, one of TASK_FLUSH,
178 // TASK_RESET, or TASK_DESTROY. 177 // TASK_RESET, or TASK_DESTROY.
(...skipping 10 matching lines...) Expand all
189 bool ProcessReorderQueue(); 188 bool ProcessReorderQueue();
190 bool ProcessFrame(const Frame& frame); 189 bool ProcessFrame(const Frame& frame);
191 bool SendFrame(const Frame& frame); 190 bool SendFrame(const Frame& frame);
192 191
193 // 192 //
194 // GPU thread state. 193 // GPU thread state.
195 // 194 //
196 MakeGLContextCurrentCallback make_context_current_cb_; 195 MakeGLContextCurrentCallback make_context_current_cb_;
197 BindGLImageCallback bind_image_cb_; 196 BindGLImageCallback bind_image_cb_;
198 197
199 media::VideoDecodeAccelerator::Client* client_; 198 VideoDecodeAccelerator::Client* client_;
200 State state_; 199 State state_;
201 200
202 // Queue of pending flush tasks. This is used to drop frames when a reset 201 // Queue of pending flush tasks. This is used to drop frames when a reset
203 // is pending. 202 // is pending.
204 std::queue<TaskType> pending_flush_tasks_; 203 std::queue<TaskType> pending_flush_tasks_;
205 204
206 // Queue of tasks to complete in the GPU thread. 205 // Queue of tasks to complete in the GPU thread.
207 std::queue<Task> task_queue_; 206 std::queue<Task> task_queue_;
208 207
209 // Utility class to define the order of frames in the reorder queue. 208 // Utility class to define the order of frames in the reorder queue.
(...skipping 28 matching lines...) Expand all
238 237
239 // Pictures ready to be rendered to. 238 // Pictures ready to be rendered to.
240 std::vector<int32_t> available_picture_ids_; 239 std::vector<int32_t> available_picture_ids_;
241 240
242 // 241 //
243 // Decoder thread state. 242 // Decoder thread state.
244 // 243 //
245 VTDecompressionOutputCallbackRecord callback_; 244 VTDecompressionOutputCallbackRecord callback_;
246 base::ScopedCFTypeRef<CMFormatDescriptionRef> format_; 245 base::ScopedCFTypeRef<CMFormatDescriptionRef> format_;
247 base::ScopedCFTypeRef<VTDecompressionSessionRef> session_; 246 base::ScopedCFTypeRef<VTDecompressionSessionRef> session_;
248 media::H264Parser parser_; 247 H264Parser parser_;
249 gfx::Size coded_size_; 248 gfx::Size coded_size_;
250 249
251 int last_sps_id_; 250 int last_sps_id_;
252 std::vector<uint8_t> last_sps_; 251 std::vector<uint8_t> last_sps_;
253 std::vector<uint8_t> last_spsext_; 252 std::vector<uint8_t> last_spsext_;
254 int last_pps_id_; 253 int last_pps_id_;
255 std::vector<uint8_t> last_pps_; 254 std::vector<uint8_t> last_pps_;
256 bool config_changed_; 255 bool config_changed_;
257 bool waiting_for_idr_; 256 bool waiting_for_idr_;
258 bool missing_idr_logged_; 257 bool missing_idr_logged_;
259 media::H264POC poc_; 258 H264POC poc_;
260 259
261 // 260 //
262 // Shared state (set up and torn down on GPU thread). 261 // Shared state (set up and torn down on GPU thread).
263 // 262 //
264 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_; 263 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
265 base::ThreadChecker gpu_thread_checker_; 264 base::ThreadChecker gpu_thread_checker_;
266 base::WeakPtr<VTVideoDecodeAccelerator> weak_this_; 265 base::WeakPtr<VTVideoDecodeAccelerator> weak_this_;
267 base::Thread decoder_thread_; 266 base::Thread decoder_thread_;
268 267
269 // Declared last to ensure that all weak pointers are invalidated before 268 // Declared last to ensure that all weak pointers are invalidated before
270 // other destructors run. 269 // other destructors run.
271 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_; 270 base::WeakPtrFactory<VTVideoDecodeAccelerator> weak_this_factory_;
272 271
273 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); 272 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator);
274 }; 273 };
275 274
276 } // namespace media 275 } // namespace media
277 276
278 #endif // MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_ 277 #endif // MEDIA_GPU_VT_VIDEO_DECODE_ACCELERATOR_MAC_H_
OLDNEW
« no previous file with comments | « media/gpu/vp9_picture.h ('k') | media/gpu/vt_video_decode_accelerator_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698