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

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

Issue 1832123002: Revert of Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/common/gpu/media/android_video_decode_accelerator.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
11 #include <map> 11 #include <map>
12 #include <queue> 12 #include <queue>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/threading/thread_checker.h" 17 #include "base/threading/thread_checker.h"
18 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "content/common/gpu/media/avda_state_provider.h" 20 #include "content/common/gpu/media/avda_state_provider.h"
21 #include "content/common/gpu/media/gpu_video_decode_accelerator_helpers.h"
22 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 21 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
23 #include "gpu/command_buffer/service/gpu_preferences.h" 22 #include "gpu/command_buffer/service/gpu_preferences.h"
24 #include "media/base/android/media_drm_bridge_cdm_context.h" 23 #include "media/base/android/media_drm_bridge_cdm_context.h"
25 #include "media/base/android/sdk_media_codec_bridge.h" 24 #include "media/base/android/sdk_media_codec_bridge.h"
26 #include "media/base/media_keys.h" 25 #include "media/base/media_keys.h"
27 #include "media/video/video_decode_accelerator.h" 26 #include "media/video/video_decode_accelerator.h"
28 #include "ui/gl/android/scoped_java_surface.h" 27 #include "ui/gl/android/scoped_java_surface.h"
29 28
30 namespace gfx { 29 namespace gfx {
31 class SurfaceTexture; 30 class SurfaceTexture;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Size may have changed due to resolution change since the last time this 103 // Size may have changed due to resolution change since the last time this
105 // PictureBuffer was used. Update the size of the picture buffer to 104 // PictureBuffer was used. Update the size of the picture buffer to
106 // |new_size| and also update any size-dependent state (e.g. size of 105 // |new_size| and also update any size-dependent state (e.g. size of
107 // associated texture). Callers should set the correct GL context prior to 106 // associated texture). Callers should set the correct GL context prior to
108 // calling. 107 // calling.
109 virtual void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, 108 virtual void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer,
110 const gfx::Size& new_size) = 0; 109 const gfx::Size& new_size) = 0;
111 }; 110 };
112 111
113 AndroidVideoDecodeAccelerator( 112 AndroidVideoDecodeAccelerator(
114 const MakeGLContextCurrentCallback& make_context_current_cb, 113 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
115 const GetGLES2DecoderCallback& get_gles2_decoder_cb); 114 const base::Callback<bool(void)>& make_context_current);
116 115
117 ~AndroidVideoDecodeAccelerator() override; 116 ~AndroidVideoDecodeAccelerator() override;
118 117
119 // media::VideoDecodeAccelerator implementation: 118 // media::VideoDecodeAccelerator implementation:
120 bool Initialize(const Config& config, Client* client) override; 119 bool Initialize(const Config& config, Client* client) override;
121 void SetCdm(int cdm_id) override; 120 void SetCdm(int cdm_id) override;
122 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; 121 void Decode(const media::BitstreamBuffer& bitstream_buffer) override;
123 void AssignPictureBuffers( 122 void AssignPictureBuffers(
124 const std::vector<media::PictureBuffer>& buffers) override; 123 const std::vector<media::PictureBuffer>& buffers) override;
125 void ReusePictureBuffer(int32_t picture_buffer_id) override; 124 void ReusePictureBuffer(int32_t picture_buffer_id) override;
126 void Flush() override; 125 void Flush() override;
127 void Reset() override; 126 void Reset() override;
128 void Destroy() override; 127 void Destroy() override;
129 bool TryToSetupDecodeOnSeparateThread( 128 bool CanDecodeOnIOThread() override;
130 const base::WeakPtr<Client>& decode_client,
131 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
132 override;
133 129
134 // AVDAStateProvider implementation: 130 // AVDAStateProvider implementation:
135 const gfx::Size& GetSize() const override; 131 const gfx::Size& GetSize() const override;
136 const base::ThreadChecker& ThreadChecker() const override; 132 const base::ThreadChecker& ThreadChecker() const override;
137 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; 133 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override;
138 gpu::gles2::TextureRef* GetTextureForPicture( 134 gpu::gles2::TextureRef* GetTextureForPicture(
139 const media::PictureBuffer& picture_buffer) override; 135 const media::PictureBuffer& picture_buffer) override;
140 void PostError(const ::tracked_objects::Location& from_here, 136 void PostError(const ::tracked_objects::Location& from_here,
141 media::VideoDecodeAccelerator::Error error) override; 137 media::VideoDecodeAccelerator::Error error) override;
142 138
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 static bool UseDeferredRenderingStrategy( 234 static bool UseDeferredRenderingStrategy(
239 const gpu::GpuPreferences& gpu_preferences); 235 const gpu::GpuPreferences& gpu_preferences);
240 236
241 // Used to DCHECK that we are called on the correct thread. 237 // Used to DCHECK that we are called on the correct thread.
242 base::ThreadChecker thread_checker_; 238 base::ThreadChecker thread_checker_;
243 239
244 // To expose client callbacks from VideoDecodeAccelerator. 240 // To expose client callbacks from VideoDecodeAccelerator.
245 Client* client_; 241 Client* client_;
246 242
247 // Callback to set the correct gl context. 243 // Callback to set the correct gl context.
248 MakeGLContextCurrentCallback make_context_current_cb_; 244 base::Callback<bool(void)> make_context_current_;
249
250 // Callback to get the GLES2Decoder instance.
251 GetGLES2DecoderCallback get_gles2_decoder_cb_;
252 245
253 // Codec type. Used when we configure media codec. 246 // Codec type. Used when we configure media codec.
254 media::VideoCodec codec_; 247 media::VideoCodec codec_;
255 248
256 // Whether the stream is encrypted. 249 // Whether the stream is encrypted.
257 bool is_encrypted_; 250 bool is_encrypted_;
258 251
259 // Whether encryption scheme requires to use protected surface. 252 // Whether encryption scheme requires to use protected surface.
260 bool needs_protected_surface_; 253 bool needs_protected_surface_;
261 254
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // A map of presentation timestamp to bitstream buffer id for the bitstream 292 // A map of presentation timestamp to bitstream buffer id for the bitstream
300 // buffers that have been submitted to the decoder but haven't yet produced an 293 // buffers that have been submitted to the decoder but haven't yet produced an
301 // output frame with the same timestamp. Note: there will only be one entry 294 // output frame with the same timestamp. Note: there will only be one entry
302 // for multiple bitstream buffers that have the same presentation timestamp. 295 // for multiple bitstream buffers that have the same presentation timestamp.
303 std::map<base::TimeDelta, int32_t> bitstream_buffers_in_decoder_; 296 std::map<base::TimeDelta, int32_t> bitstream_buffers_in_decoder_;
304 297
305 // Keeps track of bitstream ids notified to the client with 298 // Keeps track of bitstream ids notified to the client with
306 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. 299 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream.
307 std::list<int32_t> bitstreams_notified_in_advance_; 300 std::list<int32_t> bitstreams_notified_in_advance_;
308 301
302 // Owner of the GL context. Used to restore the context state.
303 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_;
304
309 // Backing strategy that we'll use to connect PictureBuffers to frames. 305 // Backing strategy that we'll use to connect PictureBuffers to frames.
310 scoped_ptr<BackingStrategy> strategy_; 306 scoped_ptr<BackingStrategy> strategy_;
311 307
312 // Helper class that manages asynchronous OnFrameAvailable callbacks. 308 // Helper class that manages asynchronous OnFrameAvailable callbacks.
313 class OnFrameAvailableHandler; 309 class OnFrameAvailableHandler;
314 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_; 310 scoped_refptr<OnFrameAvailableHandler> on_frame_available_handler_;
315 311
316 // Time at which we last did useful work on io_timer_. 312 // Time at which we last did useful work on io_timer_.
317 base::TimeTicks most_recent_work_; 313 base::TimeTicks most_recent_work_;
318 314
(...skipping 25 matching lines...) Expand all
344 340
345 // WeakPtrFactory for posting tasks back to |this|. 341 // WeakPtrFactory for posting tasks back to |this|.
346 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; 342 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;
347 343
348 friend class AndroidVideoDecodeAcceleratorTest; 344 friend class AndroidVideoDecodeAcceleratorTest;
349 }; 345 };
350 346
351 } // namespace content 347 } // namespace content
352 348
353 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 349 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/android_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698