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

Side by Side Diff: content/renderer/gpu/gpu_video_decode_accelerator_host.cc

Issue 7361010: Enable fire-and-forget Destroy of HW video decoder, and misc other improvements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vrk CR responses. Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h" 5 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers, 52 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
53 OnProvidePictureBuffer) 53 OnProvidePictureBuffer)
54 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializeDone, 54 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializeDone,
55 OnInitializeDone) 55 OnInitializeDone)
56 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady, 56 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady,
57 OnPictureReady) 57 OnPictureReady)
58 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone, 58 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone,
59 OnFlushDone) 59 OnFlushDone)
60 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ResetDone, 60 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ResetDone,
61 OnResetDone) 61 OnResetDone)
62 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_DestroyDone,
63 OnDestroyDone)
64 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_EndOfStream, 62 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_EndOfStream,
65 OnEndOfStream) 63 OnEndOfStream)
66 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification, 64 IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_ErrorNotification,
67 OnErrorNotification) 65 OnErrorNotification)
68 IPC_MESSAGE_UNHANDLED(handled = false) 66 IPC_MESSAGE_UNHANDLED(handled = false)
69 IPC_END_MESSAGE_MAP() 67 IPC_END_MESSAGE_MAP()
70 DCHECK(handled); 68 DCHECK(handled);
71 return handled; 69 return handled;
72 } 70 }
73 71
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 128 }
131 129
132 void GpuVideoDecodeAcceleratorHost::Flush() { 130 void GpuVideoDecodeAcceleratorHost::Flush() {
133 DCHECK(CalledOnValidThread()); 131 DCHECK(CalledOnValidThread());
134 Send(new AcceleratedVideoDecoderMsg_Flush( 132 Send(new AcceleratedVideoDecoderMsg_Flush(
135 command_buffer_route_id_, SyncTokens())); 133 command_buffer_route_id_, SyncTokens()));
136 } 134 }
137 135
138 void GpuVideoDecodeAcceleratorHost::Reset() { 136 void GpuVideoDecodeAcceleratorHost::Reset() {
139 DCHECK(CalledOnValidThread()); 137 DCHECK(CalledOnValidThread());
140 if (!ipc_sender_->Send(new AcceleratedVideoDecoderMsg_Reset( 138 Send(new AcceleratedVideoDecoderMsg_Reset(
141 command_buffer_route_id_, SyncTokens()))) { 139 command_buffer_route_id_, SyncTokens()));
142 LOG(ERROR) << "Send(AcceleratedVideoDecoderMsg_Reset) failed";
143 // TODO(fischman/vrk): signal error to client.
144 return;
145 }
146 } 140 }
147 141
148 void GpuVideoDecodeAcceleratorHost::Destroy() { 142 void GpuVideoDecodeAcceleratorHost::Destroy() {
149 DCHECK(CalledOnValidThread()); 143 DCHECK(CalledOnValidThread());
150 Send(new AcceleratedVideoDecoderMsg_Destroy( 144 Send(new AcceleratedVideoDecoderMsg_Destroy(
151 command_buffer_route_id_, SyncTokens())); 145 command_buffer_route_id_, SyncTokens()));
152 } 146 }
153 147
154 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) { 148 void GpuVideoDecodeAcceleratorHost::Send(IPC::Message* message) {
155 // After OnChannelError is called, the client should no longer send 149 // After OnChannelError is called, the client should no longer send
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { 196 void GpuVideoDecodeAcceleratorHost::OnFlushDone() {
203 DCHECK(CalledOnValidThread()); 197 DCHECK(CalledOnValidThread());
204 client_->NotifyFlushDone(); 198 client_->NotifyFlushDone();
205 } 199 }
206 200
207 void GpuVideoDecodeAcceleratorHost::OnResetDone() { 201 void GpuVideoDecodeAcceleratorHost::OnResetDone() {
208 DCHECK(CalledOnValidThread()); 202 DCHECK(CalledOnValidThread());
209 client_->NotifyResetDone(); 203 client_->NotifyResetDone();
210 } 204 }
211 205
212 void GpuVideoDecodeAcceleratorHost::OnDestroyDone() {
213 DCHECK(CalledOnValidThread());
214 client_->NotifyDestroyDone();
215 }
216
217 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() { 206 void GpuVideoDecodeAcceleratorHost::OnEndOfStream() {
218 DCHECK(CalledOnValidThread()); 207 DCHECK(CalledOnValidThread());
219 client_->NotifyEndOfStream(); 208 client_->NotifyEndOfStream();
220 } 209 }
221 210
222 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) { 211 void GpuVideoDecodeAcceleratorHost::OnErrorNotification(uint32 error) {
223 DCHECK(CalledOnValidThread()); 212 DCHECK(CalledOnValidThread());
224 client_->NotifyError( 213 client_->NotifyError(
225 static_cast<media::VideoDecodeAccelerator::Error>(error)); 214 static_cast<media::VideoDecodeAccelerator::Error>(error));
226 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698