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

Side by Side Diff: content/common/gpu/media/vt_video_decode_accelerator.h

Issue 491163002: Implement flushing in VTVideoDecodeAccelerator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
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 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 private: 58 private:
59 struct DecodedFrame { 59 struct DecodedFrame {
60 DecodedFrame(int32_t bitstream_id, CVImageBufferRef image_buffer); 60 DecodedFrame(int32_t bitstream_id, CVImageBufferRef image_buffer);
61 ~DecodedFrame(); 61 ~DecodedFrame();
62 62
63 int32_t bitstream_id; 63 int32_t bitstream_id;
64 base::ScopedCFTypeRef<CVImageBufferRef> image_buffer; 64 base::ScopedCFTypeRef<CVImageBufferRef> image_buffer;
65 }; 65 };
66 66
67 enum State {
68 // TODO(sandersd): Size changing state.
69 NORMAL,
70 FLUSHING,
71 RESETTING,
72 DESTROYING,
73 };
74
67 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|. 75 // Methods for interacting with VideoToolbox. Run on |decoder_thread_|.
68 void ConfigureDecoder( 76 void ConfigureDecoder(
69 const std::vector<const uint8_t*>& nalu_data_ptrs, 77 const std::vector<const uint8_t*>& nalu_data_ptrs,
70 const std::vector<size_t>& nalu_data_sizes); 78 const std::vector<size_t>& nalu_data_sizes);
71 void DecodeTask(const media::BitstreamBuffer); 79 void DecodeTask(const media::BitstreamBuffer);
80 void FlushTask();
72 81
73 // Methods for interacting with |client_|. Run on |gpu_task_runner_|. 82 // Methods for interacting with |client_|. Run on |gpu_task_runner_|.
74 void OutputTask(DecodedFrame frame); 83 void OutputTask(DecodedFrame frame);
75 void SizeChangedTask(gfx::Size coded_size); 84 void SizeChangedTask(gfx::Size coded_size);
76 void SendPictures(); 85 void SendPictures();
86 void FlushStart(State state);
87 void FlushDone();
77 88
78 // 89 //
79 // GPU thread state. 90 // GPU thread state.
80 // 91 //
81 CGLContextObj cgl_context_; 92 CGLContextObj cgl_context_;
82 media::VideoDecodeAccelerator::Client* client_; 93 media::VideoDecodeAccelerator::Client* client_;
83 gfx::Size texture_size_; 94 gfx::Size texture_size_;
95 State state_;
96 int32_t frames_pending_decode_;
84 97
85 // Texture IDs of pictures. 98 // Texture IDs of pictures.
86 // TODO(sandersd): A single map of structs holding picture data. 99 // TODO(sandersd): A single map of structs holding picture data.
87 std::map<int32_t, uint32_t> texture_ids_; 100 std::map<int32_t, uint32_t> texture_ids_;
88 101
89 // Pictures ready to be rendered to. 102 // Pictures ready to be rendered to.
90 std::queue<int32_t> available_picture_ids_; 103 std::queue<int32_t> available_picture_ids_;
91 104
92 // Decoded frames ready to render. 105 // Decoded frames ready to render.
93 std::queue<DecodedFrame> decoded_frames_; 106 std::queue<DecodedFrame> decoded_frames_;
(...skipping 22 matching lines...) Expand all
116 // Declared last to ensure that all decoder thread tasks complete before any 129 // Declared last to ensure that all decoder thread tasks complete before any
117 // state is destructed. 130 // state is destructed.
118 base::Thread decoder_thread_; 131 base::Thread decoder_thread_;
119 132
120 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator); 133 DISALLOW_COPY_AND_ASSIGN(VTVideoDecodeAccelerator);
121 }; 134 };
122 135
123 } // namespace content 136 } // namespace content
124 137
125 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_ 138 #endif // CONTENT_COMMON_GPU_MEDIA_VT_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698