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

Side by Side Diff: media/filters/gpu_video_decoder.h

Issue 239893002: Allow multiple concurrent Decode() requests in VideoDecoder interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FILTERS_GPU_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // VideoDecoder implementation. 44 // VideoDecoder implementation.
45 virtual void Initialize(const VideoDecoderConfig& config, 45 virtual void Initialize(const VideoDecoderConfig& config,
46 const PipelineStatusCB& status_cb) OVERRIDE; 46 const PipelineStatusCB& status_cb) OVERRIDE;
47 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 47 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
48 const DecodeCB& decode_cb) OVERRIDE; 48 const DecodeCB& decode_cb) OVERRIDE;
49 virtual void Reset(const base::Closure& closure) OVERRIDE; 49 virtual void Reset(const base::Closure& closure) OVERRIDE;
50 virtual void Stop() OVERRIDE; 50 virtual void Stop() OVERRIDE;
51 virtual bool HasAlpha() const OVERRIDE; 51 virtual bool HasAlpha() const OVERRIDE;
52 virtual bool NeedsBitstreamConversion() const OVERRIDE; 52 virtual bool NeedsBitstreamConversion() const OVERRIDE;
53 virtual bool CanReadWithoutStalling() const OVERRIDE; 53 virtual bool CanReadWithoutStalling() const OVERRIDE;
54 virtual int GetMaxDecodeRequests() const OVERRIDE;
54 55
55 // VideoDecodeAccelerator::Client implementation. 56 // VideoDecodeAccelerator::Client implementation.
56 virtual void NotifyInitializeDone() OVERRIDE; 57 virtual void NotifyInitializeDone() OVERRIDE;
57 virtual void ProvidePictureBuffers(uint32 count, 58 virtual void ProvidePictureBuffers(uint32 count,
58 const gfx::Size& size, 59 const gfx::Size& size,
59 uint32 texture_target) OVERRIDE; 60 uint32 texture_target) OVERRIDE;
60 virtual void DismissPictureBuffer(int32 id) OVERRIDE; 61 virtual void DismissPictureBuffer(int32 id) OVERRIDE;
61 virtual void PictureReady(const media::Picture& picture) OVERRIDE; 62 virtual void PictureReady(const media::Picture& picture) OVERRIDE;
62 virtual void NotifyEndOfBitstreamBuffer(int32 id) OVERRIDE; 63 virtual void NotifyEndOfBitstreamBuffer(int32 id) OVERRIDE;
63 virtual void NotifyFlushDone() OVERRIDE; 64 virtual void NotifyFlushDone() OVERRIDE;
(...skipping 22 matching lines...) Expand all
86 // A SHMBuffer and the DecoderBuffer its data came from. 87 // A SHMBuffer and the DecoderBuffer its data came from.
87 struct BufferPair { 88 struct BufferPair {
88 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b); 89 BufferPair(SHMBuffer* s, const scoped_refptr<DecoderBuffer>& b);
89 ~BufferPair(); 90 ~BufferPair();
90 SHMBuffer* shm_buffer; 91 SHMBuffer* shm_buffer;
91 scoped_refptr<DecoderBuffer> buffer; 92 scoped_refptr<DecoderBuffer> buffer;
92 }; 93 };
93 94
94 typedef std::map<int32, PictureBuffer> PictureBufferMap; 95 typedef std::map<int32, PictureBuffer> PictureBufferMap;
95 96
96 // Return true if more decode work can be piled on to the VDA. 97 void DeliverFrame( const scoped_refptr<VideoFrame>& frame);
97 bool CanMoreDecodeWorkBeDone();
98
99 // Enqueue a frame for later delivery (or drop it on the floor if a
100 // vda->Reset() is in progress) and trigger out-of-line delivery of the oldest
101 // ready frame to the client if there is a pending read. A NULL |frame|
102 // merely triggers delivery, and requires the ready_video_frames_ queue not be
103 // empty.
104 void EnqueueFrameAndTriggerFrameDelivery(
105 const scoped_refptr<VideoFrame>& frame);
106 98
107 // Static method is to allow it to run even after GVD is deleted. 99 // Static method is to allow it to run even after GVD is deleted.
108 static void ReleaseMailbox( 100 static void ReleaseMailbox(
109 base::WeakPtr<GpuVideoDecoder> decoder, 101 base::WeakPtr<GpuVideoDecoder> decoder,
110 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories, 102 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories,
111 int64 picture_buffer_id, 103 int64 picture_buffer_id,
112 uint32 texture_id, 104 uint32 texture_id,
113 scoped_ptr<gpu::MailboxHolder> mailbox_holder); 105 scoped_ptr<gpu::MailboxHolder> mailbox_holder);
114 // Indicate the picture buffer can be reused by the decoder. 106 // Indicate the picture buffer can be reused by the decoder.
115 void ReusePictureBuffer(int64 picture_buffer_id); 107 void ReusePictureBuffer(int64 picture_buffer_id);
(...skipping 19 matching lines...) Expand all
135 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const; 127 void DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() const;
136 128
137 bool needs_bitstream_conversion_; 129 bool needs_bitstream_conversion_;
138 130
139 scoped_refptr<GpuVideoAcceleratorFactories> factories_; 131 scoped_refptr<GpuVideoAcceleratorFactories> factories_;
140 132
141 // Populated during Initialize() (on success) and unchanged until an error 133 // Populated during Initialize() (on success) and unchanged until an error
142 // occurs. 134 // occurs.
143 scoped_ptr<VideoDecodeAccelerator> vda_; 135 scoped_ptr<VideoDecodeAccelerator> vda_;
144 136
145 // Callbacks that are !is_null() only during their respective operation being 137 // Callbacks for the pending Decode requests (not more that
138 // GetMaxDecodeRequests()).
139 std::list<DecodeCB> pending_decode_callbacks_;
140
141 // Callback that is !is_null() only during their respective operation being
146 // asynchronously executed. 142 // asynchronously executed.
147 DecodeCB pending_decode_cb_;
148 base::Closure pending_reset_cb_; 143 base::Closure pending_reset_cb_;
149 144
150 State state_; 145 State state_;
151 146
152 VideoDecoderConfig config_; 147 VideoDecoderConfig config_;
153 148
154 // Shared-memory buffer pool. Since allocating SHM segments requires a 149 // Shared-memory buffer pool. Since allocating SHM segments requires a
155 // round-trip to the browser process, we keep allocation out of the 150 // round-trip to the browser process, we keep allocation out of the
156 // steady-state of the decoder. 151 // steady-state of the decoder.
157 std::vector<SHMBuffer*> available_shm_segments_; 152 std::vector<SHMBuffer*> available_shm_segments_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Bound to factories_->GetMessageLoop(). 189 // Bound to factories_->GetMessageLoop().
195 // NOTE: Weak pointers must be invalidated before all other member variables. 190 // NOTE: Weak pointers must be invalidated before all other member variables.
196 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_; 191 base::WeakPtrFactory<GpuVideoDecoder> weak_factory_;
197 192
198 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); 193 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder);
199 }; 194 };
200 195
201 } // namespace media 196 } // namespace media
202 197
203 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_ 198 #endif // MEDIA_FILTERS_GPU_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698