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

Side by Side Diff: content/common/gpu/media/gpu_video_encode_accelerator.cc

Issue 1846253003: Revert of Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media/gpu_video_encode_accelerator.h" 5 #include "content/common/gpu/media/gpu_video_encode_accelerator.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/numerics/safe_math.h" 11 #include "base/numerics/safe_math.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/common/gpu/gpu_channel.h"
15 #include "content/common/gpu/gpu_channel_manager.h"
14 #include "content/common/gpu/media/gpu_video_accelerator_util.h" 16 #include "content/common/gpu/media/gpu_video_accelerator_util.h"
15 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" 17 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
16 #include "gpu/ipc/service/gpu_channel.h"
17 #include "gpu/ipc/service/gpu_channel_manager.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 #include "media/base/bind_to_current_loop.h" 19 #include "media/base/bind_to_current_loop.h"
20 #include "media/base/limits.h" 20 #include "media/base/limits.h"
21 #include "media/base/video_frame.h" 21 #include "media/base/video_frame.h"
22 #include "media/gpu/ipc/common/media_messages.h" 22 #include "media/gpu/ipc/common/media_messages.h"
23 23
24 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
25 #if defined(USE_V4L2_CODEC) 25 #if defined(USE_V4L2_CODEC)
26 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" 26 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
27 #endif 27 #endif
(...skipping 10 matching lines...) Expand all
38 38
39 namespace { 39 namespace {
40 40
41 // Allocation and destruction of buffer are done on the Browser process, so we 41 // Allocation and destruction of buffer are done on the Browser process, so we
42 // don't need to handle synchronization here. 42 // don't need to handle synchronization here.
43 void DestroyGpuMemoryBuffer(const gpu::SyncToken& sync_token) {} 43 void DestroyGpuMemoryBuffer(const gpu::SyncToken& sync_token) {}
44 44
45 } // namespace 45 } // namespace
46 46
47 static bool MakeDecoderContextCurrent( 47 static bool MakeDecoderContextCurrent(
48 const base::WeakPtr<gpu::GpuCommandBufferStub> stub) { 48 const base::WeakPtr<GpuCommandBufferStub> stub) {
49 if (!stub) { 49 if (!stub) {
50 DLOG(ERROR) << "Stub is gone; won't MakeCurrent()."; 50 DLOG(ERROR) << "Stub is gone; won't MakeCurrent().";
51 return false; 51 return false;
52 } 52 }
53 53
54 if (!stub->decoder()->MakeCurrent()) { 54 if (!stub->decoder()->MakeCurrent()) {
55 DLOG(ERROR) << "Failed to MakeCurrent()"; 55 DLOG(ERROR) << "Failed to MakeCurrent()";
56 return false; 56 return false;
57 } 57 }
58 58
59 return true; 59 return true;
60 } 60 }
61 61
62 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator( 62 GpuVideoEncodeAccelerator::GpuVideoEncodeAccelerator(int32_t host_route_id,
63 int32_t host_route_id, 63 GpuCommandBufferStub* stub)
64 gpu::GpuCommandBufferStub* stub)
65 : host_route_id_(host_route_id), 64 : host_route_id_(host_route_id),
66 stub_(stub), 65 stub_(stub),
67 input_format_(media::PIXEL_FORMAT_UNKNOWN), 66 input_format_(media::PIXEL_FORMAT_UNKNOWN),
68 output_buffer_size_(0), 67 output_buffer_size_(0),
69 weak_this_factory_(this) { 68 weak_this_factory_(this) {
70 stub_->AddDestructionObserver(this); 69 stub_->AddDestructionObserver(this);
71 make_context_current_ = 70 make_context_current_ =
72 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); 71 base::Bind(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
73 } 72 }
74 73
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_, 467 Send(new AcceleratedVideoEncoderHostMsg_NotifyInputDone(host_route_id_,
469 frame_id)); 468 frame_id));
470 // Just let |buffers| fall out of scope. 469 // Just let |buffers| fall out of scope.
471 } 470 }
472 471
473 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) { 472 void GpuVideoEncodeAccelerator::Send(IPC::Message* message) {
474 stub_->channel()->Send(message); 473 stub_->channel()->Send(message);
475 } 474 }
476 475
477 } // namespace content 476 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_encode_accelerator.h ('k') | content/common/gpu/media/media_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698