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

Side by Side Diff: content/common/gpu/client/gpu_video_decode_accelerator_host.h

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: f2a9ccb5 Rebase, posciak@ comments. Created 6 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 | 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 CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
12 #include "content/common/gpu/client/command_buffer_proxy_impl.h" 12 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
13 #include "ipc/ipc_listener.h" 13 #include "ipc/ipc_listener.h"
14 #include "media/video/video_decode_accelerator.h" 14 #include "media/video/video_decode_accelerator.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 16
17 namespace content { 17 namespace content {
18 class GpuChannelHost; 18 class GpuChannelHost;
19 19
20 // This class is used to talk to VideoDecodeAccelerator in the Gpu process 20 // This class is used to talk to VideoDecodeAccelerator in the Gpu process
21 // through IPC messages. 21 // through IPC messages.
22 class GpuVideoDecodeAcceleratorHost 22 class GpuVideoDecodeAcceleratorHost
23 : public IPC::Listener, 23 : public IPC::Listener,
24 public media::VideoDecodeAccelerator, 24 public media::VideoDecodeAccelerator,
25 public CommandBufferProxyImpl::DeletionObserver, 25 public CommandBufferProxyImpl::DeletionObserver,
26 public base::NonThreadSafe { 26 public base::NonThreadSafe {
27 public: 27 public:
28 // |channel| is used to send IPC messages to GPU process. 28 // Both |channel| and |impl| are guaranteed to outlive |this|. (See comments
29 // for |channel_| and |impl_|.)
29 GpuVideoDecodeAcceleratorHost(GpuChannelHost* channel, 30 GpuVideoDecodeAcceleratorHost(GpuChannelHost* channel,
30 int32 decoder_route_id,
31 CommandBufferProxyImpl* impl); 31 CommandBufferProxyImpl* impl);
32 32
33 // IPC::Listener implementation. 33 // IPC::Listener implementation.
34 virtual void OnChannelError() OVERRIDE; 34 virtual void OnChannelError() OVERRIDE;
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
36 36
37 // media::VideoDecodeAccelerator implementation. 37 // media::VideoDecodeAccelerator implementation.
38 virtual bool Initialize(media::VideoCodecProfile profile, 38 virtual bool Initialize(media::VideoCodecProfile profile,
39 Client* client) OVERRIDE; 39 Client* client) OVERRIDE;
40 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 40 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
41 virtual void AssignPictureBuffers( 41 virtual void AssignPictureBuffers(
42 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 42 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
43 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 43 virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
44 virtual void Flush() OVERRIDE; 44 virtual void Flush() OVERRIDE;
45 virtual void Reset() OVERRIDE; 45 virtual void Reset() OVERRIDE;
46 virtual void Destroy() OVERRIDE; 46 virtual void Destroy() OVERRIDE;
47 47
48 // CommandBufferProxyImpl::DeletionObserver implemetnation. 48 // CommandBufferProxyImpl::DeletionObserver implemetnation.
49 virtual void OnWillDeleteImpl() OVERRIDE; 49 virtual void OnWillDeleteImpl() OVERRIDE;
50 50
51 private: 51 private:
52 // Only Destroy() should be deleting |this|. 52 // Only Destroy() should be deleting |this|.
53 virtual ~GpuVideoDecodeAcceleratorHost(); 53 virtual ~GpuVideoDecodeAcceleratorHost();
54 54
55 // Notify |client_| of an error. Posts a task to avoid re-entrancy.
56 void PostNotifyError(Error);
57
55 void Send(IPC::Message* message); 58 void Send(IPC::Message* message);
56 59
60 // IPC handlers, proxying media::VideoDecodeAccelerator::Client for the GPU
61 // process. Should not be called directly.
57 void OnBitstreamBufferProcessed(int32 bitstream_buffer_id); 62 void OnBitstreamBufferProcessed(int32 bitstream_buffer_id);
58 void OnProvidePictureBuffer(uint32 num_requested_buffers, 63 void OnProvidePictureBuffer(uint32 num_requested_buffers,
59 const gfx::Size& dimensions, 64 const gfx::Size& dimensions,
60 uint32 texture_target); 65 uint32 texture_target);
61 void OnDismissPictureBuffer(int32 picture_buffer_id); 66 void OnDismissPictureBuffer(int32 picture_buffer_id);
62 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id); 67 void OnPictureReady(int32 picture_buffer_id, int32 bitstream_buffer_id);
63 void OnFlushDone(); 68 void OnFlushDone();
64 void OnResetDone(); 69 void OnResetDone();
65 void OnErrorNotification(uint32 error); 70 void OnNotifyError(uint32 error);
66 71
67 // Sends IPC messages to the Gpu process. 72 // Unowned reference to the GpuChannelHost to send IPC messages to the GPU
73 // process. |channel_| outlives |impl_|, so |channel_| also outlives |this|.
68 GpuChannelHost* channel_; 74 GpuChannelHost* channel_;
69 75
70 // Route ID for the associated decoder in the GPU process. 76 // Route ID for the associated decoder in the GPU process.
71 int32 decoder_route_id_; 77 int32 decoder_route_id_;
72 78
73 // The client that will receive callbacks from the decoder. 79 // The client that will receive callbacks from the decoder.
74 Client* client_; 80 Client* client_;
75 81
76 // Unowned reference to the CommandBufferProxyImpl that created us. 82 // Unowned reference to the CommandBufferProxyImpl that created us. |this|
83 // registers as a DeletionObserver of |impl_|, so |impl_| outlives |this|.
77 CommandBufferProxyImpl* impl_; 84 CommandBufferProxyImpl* impl_;
78 85
79 // Requested dimensions of the buffer, from ProvidePictureBuffers(). 86 // Requested dimensions of the buffer, from ProvidePictureBuffers().
80 gfx::Size picture_buffer_dimensions_; 87 gfx::Size picture_buffer_dimensions_;
81 88
89 // weak_ptr factory for posting tasks back to itself.
90 base::WeakPtrFactory<GpuVideoDecodeAcceleratorHost> weak_this_factory_;
Ami GONE FROM CHROMIUM 2014/03/17 03:17:54 s/weak_ptr/WeakPtr/
sheu 2014/03/18 22:38:35 Done.
91
82 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost); 92 DISALLOW_COPY_AND_ASSIGN(GpuVideoDecodeAcceleratorHost);
83 }; 93 };
84 94
85 } // namespace content 95 } // namespace content
86 96
87 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_ 97 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_VIDEO_DECODE_ACCELERATOR_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698