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

Unified Diff: content/browser/renderer_host/media/video_capture_host.cc

Issue 2409893003: VideoCapture: more migration IPC-->mojo, part 5 (Closed)
Patch Set: rebase content/common/BUILD.gn Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_host.cc
diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc
index 3076bc50054c6554490707410b0888d5a89b46eb..492148db5624314cead71a3a67c2cabe9caa57a5 100644
--- a/content/browser/renderer_host/media/video_capture_host.cc
+++ b/content/browser/renderer_host/media/video_capture_host.cc
@@ -76,7 +76,8 @@ void VideoCaptureHost::OnBufferDestroyed(VideoCaptureControllerID controller_id,
if (controllers_.find(controller_id) == controllers_.end())
return;
- Send(new VideoCaptureMsg_FreeBuffer(controller_id, buffer_id));
+ if (base::ContainsKey(device_id_to_observer_map_, controller_id))
+ device_id_to_observer_map_[controller_id]->OnBufferDestroyed(buffer_id);
}
void VideoCaptureHost::OnBufferReady(
@@ -87,17 +88,21 @@ void VideoCaptureHost::OnBufferReady(
if (controllers_.find(controller_id) == controllers_.end())
return;
- VideoCaptureMsg_BufferReady_Params params;
- params.device_id = controller_id;
- params.buffer_id = buffer_id;
- params.timestamp = video_frame->timestamp();
- video_frame->metadata()->MergeInternalValuesInto(&params.metadata);
- params.pixel_format = video_frame->format();
- params.storage_type = video_frame->storage_type();
- params.coded_size = video_frame->coded_size();
- params.visible_rect = video_frame->visible_rect();
-
- Send(new VideoCaptureMsg_BufferReady(params));
+ if (!base::ContainsKey(device_id_to_observer_map_, controller_id))
+ return;
+
+ mojom::VideoFrameInfoPtr info = mojom::VideoFrameInfo::New();
+ info->timestamp = video_frame->timestamp();
+ video_frame->metadata()->MergeInternalValuesInto(&info->metadata);
+
+ DCHECK_EQ(media::PIXEL_FORMAT_I420, video_frame->format());
+ info->pixel_format = media::mojom::VideoFormat::I420;
+ info->storage_type = media::PIXEL_STORAGE_CPU;
+ info->coded_size = video_frame->coded_size();
+ info->visible_rect = video_frame->visible_rect();
+
+ device_id_to_observer_map_[controller_id]->OnBufferReady(buffer_id,
+ std::move(info));
}
void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) {

Powered by Google App Engine
This is Rietveld 408576698