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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.cc

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reuse VASurface Created 5 years, 7 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 #include "content/common/gpu/client/gpu_channel_host.h" 5 #include "content/common/gpu/client/gpu_channel_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/posix/eintr_wrapper.h" 12 #include "base/posix/eintr_wrapper.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "content/common/gpu/client/command_buffer_proxy_impl.h" 15 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
16 #include "content/common/gpu/client/gpu_jpeg_decode_accelerator_host.h"
16 #include "content/common/gpu/gpu_messages.h" 17 #include "content/common/gpu/gpu_messages.h"
17 #include "ipc/ipc_sync_message_filter.h" 18 #include "ipc/ipc_sync_message_filter.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 #if defined(OS_WIN) 21 #if defined(OS_WIN)
21 #include "content/public/common/sandbox_init.h" 22 #include "content/public/common/sandbox_init.h"
22 #endif 23 #endif
23 24
24 using base::AutoLock; 25 using base::AutoLock;
25 using base::MessageLoopProxy; 26 using base::MessageLoopProxy;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 250
250 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder( 251 scoped_ptr<media::VideoEncodeAccelerator> GpuChannelHost::CreateVideoEncoder(
251 int command_buffer_route_id) { 252 int command_buffer_route_id) {
252 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder"); 253 TRACE_EVENT0("gpu", "GpuChannelHost::CreateVideoEncoder");
253 AutoLock lock(context_lock_); 254 AutoLock lock(context_lock_);
254 ProxyMap::iterator it = proxies_.find(command_buffer_route_id); 255 ProxyMap::iterator it = proxies_.find(command_buffer_route_id);
255 DCHECK(it != proxies_.end()); 256 DCHECK(it != proxies_.end());
256 return it->second->CreateVideoEncoder(); 257 return it->second->CreateVideoEncoder();
257 } 258 }
258 259
260 scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder(
261 scoped_refptr<base::MessageLoopProxy> reply_loop) {
262 TRACE_EVENT0("gpu", "GpuChannelHost::CreateJpegDecoder");
263 // This function is called from GpuJpegDecoder's capture task thread, which is
wuchengli 2015/05/06 07:59:18 s/which is//
kcwu 2015/05/08 14:42:42 Acknowledged. Revised to use jpeg thread.
264 // not main thread.
265
266 int32 route_id = GenerateRouteID();
267 GpuJpegDecodeAcceleratorHost* decoder(new GpuJpegDecodeAcceleratorHost(
268 this, route_id, factory_->GetIOLoopProxy()));
269
270 // GpuJpegDecoder's capture task thread (i.e., device thread on Linux) is
271 // usually waiting for next frame, so decoder responses are sent to
272 // |reply_loop| directly.
273 scoped_refptr<base::MessageLoopProxy> io_loop = factory_->GetIOLoopProxy();
274 io_loop->PostTask(FROM_HERE,
275 base::Bind(&GpuChannelHost::MessageFilter::AddRoute,
276 channel_filter_.get(), route_id,
277 decoder->AsWeakPtr(), reply_loop));
278 return scoped_ptr<media::JpegDecodeAccelerator>(decoder);
279 }
280
259 void GpuChannelHost::DestroyCommandBuffer( 281 void GpuChannelHost::DestroyCommandBuffer(
260 CommandBufferProxyImpl* command_buffer) { 282 CommandBufferProxyImpl* command_buffer) {
261 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer"); 283 TRACE_EVENT0("gpu", "GpuChannelHost::DestroyCommandBuffer");
262 284
263 int route_id = command_buffer->GetRouteID(); 285 int route_id = command_buffer->GetRouteID();
264 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id)); 286 Send(new GpuChannelMsg_DestroyCommandBuffer(route_id));
265 RemoveRoute(route_id); 287 RemoveRoute(route_id);
266 288
267 AutoLock lock(context_lock_); 289 AutoLock lock(context_lock_);
268 proxies_.erase(route_id); 290 proxies_.erase(route_id);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 448
427 listeners_.clear(); 449 listeners_.clear();
428 } 450 }
429 451
430 bool GpuChannelHost::MessageFilter::IsLost() const { 452 bool GpuChannelHost::MessageFilter::IsLost() const {
431 AutoLock lock(lock_); 453 AutoLock lock(lock_);
432 return lost_; 454 return lost_;
433 } 455 }
434 456
435 } // namespace content 457 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698