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

Side by Side Diff: content/renderer/gpu/gpu_video_service_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/renderer/gpu/gpu_video_service_host.h"
6
7 #include "content/common/gpu/gpu_messages.h"
8 #include "content/renderer/gpu/gpu_video_decode_accelerator_host.h"
9 #include "content/renderer/render_thread.h"
10 #include "media/video/video_decode_accelerator.h"
11
12 GpuVideoServiceHost::GpuVideoServiceHost()
13 : channel_(NULL),
14 next_decoder_host_id_(0) {
15 DCHECK(RenderThread::current());
16 DCHECK_EQ(RenderThread::current()->message_loop(), MessageLoop::current());
17 }
18
19 GpuVideoServiceHost::~GpuVideoServiceHost() {
20 }
21
22 void GpuVideoServiceHost::set_channel(IPC::SyncChannel* channel) {
23 DCHECK(CalledOnValidThread());
24 DCHECK(!channel_);
25 channel_ = channel;
26 if (!on_initialized_.is_null())
27 on_initialized_.Run();
28 }
29
30 bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) {
31 DCHECK(CalledOnValidThread());
32 if (!channel_)
33 return false;
34 switch (msg.type()) {
35 case AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed::ID:
36 case AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers::ID:
37 case AcceleratedVideoDecoderHostMsg_InitializeDone::ID:
38 case AcceleratedVideoDecoderHostMsg_DismissPictureBuffer::ID:
39 case AcceleratedVideoDecoderHostMsg_PictureReady::ID:
40 case AcceleratedVideoDecoderHostMsg_FlushDone::ID:
41 case AcceleratedVideoDecoderHostMsg_ResetDone::ID:
42 case AcceleratedVideoDecoderHostMsg_DestroyDone::ID:
43 case AcceleratedVideoDecoderHostMsg_EndOfStream::ID:
44 case AcceleratedVideoDecoderHostMsg_ErrorNotification::ID:
45 if (router_.RouteMessage(msg))
46 return true;
47 LOG(ERROR) << "AcceleratedVideoDecoderHostMsg cannot be dispatched.";
48 default:
49 return false;
50 }
51 }
52
53 void GpuVideoServiceHost::OnChannelError() {
54 DCHECK(CalledOnValidThread());
55 channel_ = NULL;
56 }
57
58 void GpuVideoServiceHost::SetOnInitialized(
59 const base::Closure& on_initialized) {
60 DCHECK(CalledOnValidThread());
61 DCHECK(on_initialized_.is_null());
62 on_initialized_ = on_initialized;
63 if (channel_)
64 on_initialized.Run();
65 }
66
67 GpuVideoDecodeAcceleratorHost* GpuVideoServiceHost::CreateVideoAccelerator(
68 media::VideoDecodeAccelerator::Client* client,
69 int32 command_buffer_route_id,
70 gpu::CommandBufferHelper* cmd_buffer_helper) {
71 DCHECK(CalledOnValidThread());
72 DCHECK(channel_);
73 return new GpuVideoDecodeAcceleratorHost(
74 &router_, channel_, next_decoder_host_id_++,
75 command_buffer_route_id, cmd_buffer_helper, client);
76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698