Commit 579eac05 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

BroadcastingReceiver: Allow GpuMemoryBuffer handles

Allow GpuMemoryBuffer handles to be provided even when they
weren't requested. There is precedent for this already, for
texture mailboxes. This becomes an "upgrade" of a shared
memory buffer.

Bug: 1125879
Change-Id: I2abdaf0d0331899d3463c0f9cb8afc2519cbeed2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2408880Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807609}
parent 0c71cc06
......@@ -56,11 +56,6 @@ void CloneSharedBufferToRawFileDescriptorHandle(
#endif
}
void CloneGpuMemoryBufferHandle(const gfx::GpuMemoryBufferHandle& source,
media::mojom::VideoBufferHandlePtr* target) {
(*target)->set_gpu_memory_buffer_handle(source.Clone());
}
} // anonymous namespace
BroadcastingReceiver::ClientContext::ClientContext(
......@@ -134,13 +129,21 @@ BroadcastingReceiver::BufferContext::CloneBufferHandle(
media::mojom::VideoBufferHandlePtr result =
media::mojom::VideoBufferHandle::New();
// If the source uses mailbox hanldes, i.e. textures, we pass those through
// If the source uses mailbox handles, i.e. textures, we pass those through
// without conversion, no matter what clients requested.
if (buffer_handle_->is_mailbox_handles()) {
result->set_mailbox_handles(buffer_handle_->get_mailbox_handles()->Clone());
return result;
}
// If the source uses GpuMemoryBuffer handles, we pass those through without
// conversion, no matter what clients requested.
if (buffer_handle_->is_gpu_memory_buffer_handle()) {
result->set_gpu_memory_buffer_handle(
buffer_handle_->get_gpu_memory_buffer_handle().Clone());
return result;
}
switch (target_buffer_type) {
case media::VideoCaptureBufferType::kMailboxHolder:
NOTREACHED() << "Cannot convert buffer type to kMailboxHolder from "
......@@ -171,8 +174,7 @@ BroadcastingReceiver::BufferContext::CloneBufferHandle(
}
break;
case media::VideoCaptureBufferType::kGpuMemoryBuffer:
CloneGpuMemoryBufferHandle(buffer_handle_->get_gpu_memory_buffer_handle(),
&result);
NOTREACHED() << "Unexpected GpuMemoryBuffer handle type";
break;
}
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment