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

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

Issue 1745903002: Introduce GpuVideoDecodeAcceleratorFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (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 CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <d3d11.h> 8 #include <d3d11.h>
9 #include <d3d9.h> 9 #include <d3d9.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 11 matching lines...) Expand all
22 22
23 #include "base/compiler_specific.h" 23 #include "base/compiler_specific.h"
24 #include "base/macros.h" 24 #include "base/macros.h"
25 #include "base/memory/linked_ptr.h" 25 #include "base/memory/linked_ptr.h"
26 #include "base/memory/weak_ptr.h" 26 #include "base/memory/weak_ptr.h"
27 #include "base/synchronization/lock.h" 27 #include "base/synchronization/lock.h"
28 #include "base/threading/non_thread_safe.h" 28 #include "base/threading/non_thread_safe.h"
29 #include "base/threading/thread.h" 29 #include "base/threading/thread.h"
30 #include "base/win/scoped_comptr.h" 30 #include "base/win/scoped_comptr.h"
31 #include "content/common/content_export.h" 31 #include "content/common/content_export.h"
32 #include "content/public/common/gpu_video_decode_accelerator_helpers.h"
32 #include "media/video/video_decode_accelerator.h" 33 #include "media/video/video_decode_accelerator.h"
33 34
34 interface IMFSample; 35 interface IMFSample;
35 interface IDirect3DSurface9; 36 interface IDirect3DSurface9;
36 37
37 namespace gfx { 38 namespace gfx {
38 class GLContext; 39 class GLContext;
39 } 40 }
40 41
41 typedef HRESULT (WINAPI* CreateDXGIDeviceManager)( 42 typedef HRESULT (WINAPI* CreateDXGIDeviceManager)(
(...skipping 11 matching lines...) Expand all
53 public: 54 public:
54 enum State { 55 enum State {
55 kUninitialized, // un-initialized. 56 kUninitialized, // un-initialized.
56 kNormal, // normal playing state. 57 kNormal, // normal playing state.
57 kResetting, // upon received Reset(), before ResetDone() 58 kResetting, // upon received Reset(), before ResetDone()
58 kStopped, // upon output EOS received. 59 kStopped, // upon output EOS received.
59 kFlushing, // upon flush request received. 60 kFlushing, // upon flush request received.
60 }; 61 };
61 62
62 // Does not take ownership of |client| which must outlive |*this|. 63 // Does not take ownership of |client| which must outlive |*this|.
63 explicit DXVAVideoDecodeAccelerator( 64 DXVAVideoDecodeAccelerator(
64 const base::Callback<bool(void)>& make_context_current, 65 const gpu_vda_helpers::GetGLContextCb& get_gl_context_cb,
65 gfx::GLContext* gl_context); 66 const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb);
66 ~DXVAVideoDecodeAccelerator() override; 67 ~DXVAVideoDecodeAccelerator() override;
67 68
68 // media::VideoDecodeAccelerator implementation. 69 // media::VideoDecodeAccelerator implementation.
69 bool Initialize(const Config& config, Client* client) override; 70 bool Initialize(const Config& config, Client* client) override;
70 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; 71 void Decode(const media::BitstreamBuffer& bitstream_buffer) override;
71 void AssignPictureBuffers( 72 void AssignPictureBuffers(
72 const std::vector<media::PictureBuffer>& buffers) override; 73 const std::vector<media::PictureBuffer>& buffers) override;
73 void ReusePictureBuffer(int32_t picture_buffer_id) override; 74 void ReusePictureBuffer(int32_t picture_buffer_id) override;
74 void Flush() override; 75 void Flush() override;
75 void Reset() override; 76 void Reset() override;
76 void Destroy() override; 77 void Destroy() override;
77 bool CanDecodeOnIOThread() override; 78 bool TryInitializeDecodeOnSeparateThread(
79 const base::WeakPtr<Client>& decode_client,
80 const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner)
81 override;
78 GLenum GetSurfaceInternalFormat() const override; 82 GLenum GetSurfaceInternalFormat() const override;
79 83
80 static media::VideoDecodeAccelerator::SupportedProfiles 84 static media::VideoDecodeAccelerator::SupportedProfiles
81 GetSupportedProfiles(); 85 GetSupportedProfiles();
82 86
83 // Preload dlls required for decoding. 87 // Preload dlls required for decoding.
84 static void PreSandboxInitialization(); 88 static void PreSandboxInitialization();
85 89
86 private: 90 private:
87 typedef void* EGLConfig; 91 typedef void* EGLConfig;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 343
340 // Set to true when the drain message is sent to the decoder during a flush 344 // Set to true when the drain message is sent to the decoder during a flush
341 // operation. Used to ensure the message is only sent once after 345 // operation. Used to ensure the message is only sent once after
342 // |pending_input_buffers_| is drained. Protected by |decoder_lock_|. 346 // |pending_input_buffers_| is drained. Protected by |decoder_lock_|.
343 bool sent_drain_message_; 347 bool sent_drain_message_;
344 348
345 // List of input samples waiting to be processed. 349 // List of input samples waiting to be processed.
346 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs; 350 typedef std::list<base::win::ScopedComPtr<IMFSample>> PendingInputs;
347 PendingInputs pending_input_buffers_; 351 PendingInputs pending_input_buffers_;
348 352
353 // Callback to get current GLContext.
354 gpu_vda_helpers::GetGLContextCb get_gl_context_cb_;
349 // Callback to set the correct gl context. 355 // Callback to set the correct gl context.
350 base::Callback<bool(void)> make_context_current_; 356 gpu_vda_helpers::MakeGLContextCurrentCb make_context_current_cb_;
351 357
352 // Which codec we are decoding with hardware acceleration. 358 // Which codec we are decoding with hardware acceleration.
353 media::VideoCodec codec_; 359 media::VideoCodec codec_;
354 // Thread on which the decoder operations like passing input frames, 360 // Thread on which the decoder operations like passing input frames,
355 // getting output frames are performed. One instance of this thread 361 // getting output frames are performed. One instance of this thread
356 // is created per decoder instance. 362 // is created per decoder instance.
357 base::Thread decoder_thread_; 363 base::Thread decoder_thread_;
358 364
359 // Task runner to be used for posting tasks to the decoder thread. 365 // Task runner to be used for posting tasks to the decoder thread.
360 scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_; 366 scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_;
(...skipping 19 matching lines...) Expand all
380 bool use_dx11_; 386 bool use_dx11_;
381 387
382 // True if we should use DXGI keyed mutexes to synchronize between the two 388 // True if we should use DXGI keyed mutexes to synchronize between the two
383 // contexts. 389 // contexts.
384 bool use_keyed_mutex_; 390 bool use_keyed_mutex_;
385 391
386 // Set to true if the DX11 video format converter input media types need to 392 // Set to true if the DX11 video format converter input media types need to
387 // be initialized. Defaults to true. 393 // be initialized. Defaults to true.
388 bool dx11_video_format_converter_media_type_needs_init_; 394 bool dx11_video_format_converter_media_type_needs_init_;
389 395
390 // The GLContext to be used by the decoder.
391 scoped_refptr<gfx::GLContext> gl_context_;
392
393 // Set to true if we are sharing ANGLE's device. 396 // Set to true if we are sharing ANGLE's device.
394 bool using_angle_device_; 397 bool using_angle_device_;
395 398
396 // WeakPtrFactory for posting tasks back to |this|. 399 // WeakPtrFactory for posting tasks back to |this|.
397 base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_; 400 base::WeakPtrFactory<DXVAVideoDecodeAccelerator> weak_this_factory_;
398 401
399 // Function pointer for the MFCreateDXGIDeviceManager API. 402 // Function pointer for the MFCreateDXGIDeviceManager API.
400 static CreateDXGIDeviceManager create_dxgi_device_manager_; 403 static CreateDXGIDeviceManager create_dxgi_device_manager_;
401 404
402 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator); 405 DISALLOW_COPY_AND_ASSIGN(DXVAVideoDecodeAccelerator);
403 }; 406 };
404 407
405 } // namespace content 408 } // namespace content
406 409
407 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ 410 #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698