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

Side by Side Diff: content/renderer/media/video_capture_message_filter.cc

Issue 1267883002: Pass GpuMemoryBuffer backed VideoFrame from browser to renderer processes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmbtracker-multiple
Patch Set: reveman@ comment: remove multiple textures. Created 5 years, 4 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/renderer/media/video_capture_message_filter.h" 5 #include "content/renderer/media/video_capture_message_filter.h"
6 6
7 #include "content/common/media/video_capture_messages.h" 7 #include "content/common/media/video_capture_messages.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 return sender_->Send(message); 55 return sender_->Send(message);
56 } 56 }
57 57
58 bool VideoCaptureMessageFilter::OnMessageReceived(const IPC::Message& message) { 58 bool VideoCaptureMessageFilter::OnMessageReceived(const IPC::Message& message) {
59 bool handled = true; 59 bool handled = true;
60 IPC_BEGIN_MESSAGE_MAP(VideoCaptureMessageFilter, message) 60 IPC_BEGIN_MESSAGE_MAP(VideoCaptureMessageFilter, message)
61 IPC_MESSAGE_HANDLER(VideoCaptureMsg_BufferReady, OnBufferReceived) 61 IPC_MESSAGE_HANDLER(VideoCaptureMsg_BufferReady, OnBufferReceived)
62 IPC_MESSAGE_HANDLER(VideoCaptureMsg_StateChanged, OnDeviceStateChanged) 62 IPC_MESSAGE_HANDLER(VideoCaptureMsg_StateChanged, OnDeviceStateChanged)
63 IPC_MESSAGE_HANDLER(VideoCaptureMsg_NewBuffer, OnBufferCreated) 63 IPC_MESSAGE_HANDLER(VideoCaptureMsg_NewBuffer, OnBufferCreated)
64 IPC_MESSAGE_HANDLER(VideoCaptureMsg_NewBuffer2, OnBufferCreated2)
64 IPC_MESSAGE_HANDLER(VideoCaptureMsg_FreeBuffer, OnBufferDestroyed) 65 IPC_MESSAGE_HANDLER(VideoCaptureMsg_FreeBuffer, OnBufferDestroyed)
65 IPC_MESSAGE_HANDLER(VideoCaptureMsg_DeviceSupportedFormatsEnumerated, 66 IPC_MESSAGE_HANDLER(VideoCaptureMsg_DeviceSupportedFormatsEnumerated,
66 OnDeviceSupportedFormatsEnumerated) 67 OnDeviceSupportedFormatsEnumerated)
67 IPC_MESSAGE_HANDLER(VideoCaptureMsg_DeviceFormatsInUseReceived, 68 IPC_MESSAGE_HANDLER(VideoCaptureMsg_DeviceFormatsInUseReceived,
68 OnDeviceFormatsInUseReceived) 69 OnDeviceFormatsInUseReceived)
69 IPC_MESSAGE_UNHANDLED(handled = false) 70 IPC_MESSAGE_UNHANDLED(handled = false)
70 IPC_END_MESSAGE_MAP() 71 IPC_END_MESSAGE_MAP()
71 return handled; 72 return handled;
72 } 73 }
73 74
(...skipping 29 matching lines...) Expand all
103 int length, 104 int length,
104 int buffer_id) { 105 int buffer_id) {
105 Delegate* const delegate = find_delegate(device_id); 106 Delegate* const delegate = find_delegate(device_id);
106 if (!delegate) { 107 if (!delegate) {
107 DLOG(WARNING) << "OnBufferCreated: Got video SHM buffer for a " 108 DLOG(WARNING) << "OnBufferCreated: Got video SHM buffer for a "
108 "non-existent or removed video capture."; 109 "non-existent or removed video capture.";
109 110
110 // Send the buffer back to Host in case it's waiting for all buffers 111 // Send the buffer back to Host in case it's waiting for all buffers
111 // to be returned. 112 // to be returned.
112 base::SharedMemory::CloseHandle(handle); 113 base::SharedMemory::CloseHandle(handle);
113 Send(new VideoCaptureHostMsg_BufferReady(device_id, buffer_id, 0, -1.0)); 114
115 Send(new VideoCaptureHostMsg_BufferReady(
116 device_id, buffer_id, 0 /* release_sync_point */,
117 -1.0 /* consumer_resource_utilization */));
114 return; 118 return;
115 } 119 }
116 120
117 delegate->OnBufferCreated(handle, length, buffer_id); 121 delegate->OnBufferCreated(handle, length, buffer_id);
118 } 122 }
119 123
124 void VideoCaptureMessageFilter::OnBufferCreated2(
125 int device_id,
126 const std::vector<gfx::GpuMemoryBufferHandle>& gmb_handles,
reveman 2015/08/26 11:54:05 nit: s/gmb_handles/handles/
emircan 2015/08/26 21:23:12 Done.
127 const gfx::Size& size,
128 int buffer_id) {
129 Delegate* const delegate = find_delegate(device_id);
130 if (!delegate) {
131 DLOG(WARNING) << "OnBufferCreated: Got video GMB buffer for a "
132 "non-existent or removed video capture.";
133 Send(new VideoCaptureHostMsg_BufferReady(
134 device_id, buffer_id, 0 /* release_sync_point */,
135 -1.0 /* consumer_resource_utilization */));
136 return;
137 }
138
139 delegate->OnBufferCreated2(gmb_handles, size, buffer_id);
140 }
141
120 void VideoCaptureMessageFilter::OnBufferReceived( 142 void VideoCaptureMessageFilter::OnBufferReceived(
121 const VideoCaptureMsg_BufferReady_Params& params) { 143 const VideoCaptureMsg_BufferReady_Params& params) {
122 Delegate* const delegate = find_delegate(params.device_id); 144 Delegate* const delegate = find_delegate(params.device_id);
123 if (!delegate) { 145 if (!delegate) {
124 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a " 146 DLOG(WARNING) << "OnBufferReceived: Got video SHM buffer for a "
125 "non-existent or removed video capture."; 147 "non-existent or removed video capture.";
126 148
127 // Send the buffer back to Host in case it's waiting for all buffers 149 // Send the buffer back to Host in case it's waiting for all buffers
128 // to be returned. 150 // to be returned.
129 Send(new VideoCaptureHostMsg_BufferReady( 151 Send(new VideoCaptureHostMsg_BufferReady(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 const media::VideoCaptureFormats& formats_in_use) { 203 const media::VideoCaptureFormats& formats_in_use) {
182 Delegate* const delegate = find_delegate(device_id); 204 Delegate* const delegate = find_delegate(device_id);
183 if (!delegate) { 205 if (!delegate) {
184 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device"; 206 DLOG(WARNING) << "OnDeviceFormatInUse: unknown device";
185 return; 207 return;
186 } 208 }
187 delegate->OnDeviceFormatsInUseReceived(formats_in_use); 209 delegate->OnDeviceFormatsInUseReceived(formats_in_use);
188 } 210 }
189 211
190 } // namespace content 212 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698