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

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

Issue 2410383002: VideoCapture: more migration IPC-->mojo, part 6 (Closed)
Patch Set: Comment correction 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 d37dc46fcdb864ee5e43c1e21d17f4249749c132..b699b8bc09bb5e3df8d526e75589106388dbb3c3 100644
--- a/content/browser/renderer_host/media/video_capture_host.cc
+++ b/content/browser/renderer_host/media/video_capture_host.cc
@@ -12,6 +12,7 @@
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/media/video_capture_manager.h"
#include "content/common/media/video_capture_messages.h"
+#include "mojo/public/cpp/system/platform_handle.h"
namespace content {
@@ -60,14 +61,17 @@ void VideoCaptureHost::OnError(VideoCaptureControllerID controller_id) {
}
void VideoCaptureHost::OnBufferCreated(VideoCaptureControllerID controller_id,
- base::SharedMemoryHandle handle,
+ mojo::ScopedSharedBufferHandle handle,
int length,
int buffer_id) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (controllers_.find(controller_id) == controllers_.end())
return;
- Send(new VideoCaptureMsg_NewBuffer(controller_id, handle, length, buffer_id));
+ if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
+ device_id_to_observer_map_[controller_id]->OnBufferCreated(
+ buffer_id, std::move(handle));
+ }
}
void VideoCaptureHost::OnBufferDestroyed(VideoCaptureControllerID controller_id,
@@ -113,34 +117,6 @@ void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) {
base::Bind(&VideoCaptureHost::DoEnded, this, controller_id));
}
-void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) {
- DVLOG(1) << __func__;
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (controllers_.find(controller_id) == controllers_.end())
- return;
-
- if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
- device_id_to_observer_map_[controller_id]->OnStateChanged(
- mojom::VideoCaptureState::FAILED);
- }
-
- DeleteVideoCaptureController(controller_id, true);
-}
-
-void VideoCaptureHost::DoEnded(VideoCaptureControllerID controller_id) {
- DVLOG(1) << __func__;
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- if (controllers_.find(controller_id) == controllers_.end())
- return;
-
- if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
- device_id_to_observer_map_[controller_id]->OnStateChanged(
- mojom::VideoCaptureState::ENDED);
- }
-
- DeleteVideoCaptureController(controller_id, false);
-}
-
void VideoCaptureHost::Start(int32_t device_id,
int32_t session_id,
const media::VideoCaptureParams& params,
@@ -164,7 +140,6 @@ void VideoCaptureHost::Start(int32_t device_id,
media_stream_manager_->video_capture_manager()->StartCaptureForClient(
session_id,
params,
- PeerHandle(),
controller_id,
this,
base::Bind(&VideoCaptureHost::OnControllerAdded, this, device_id));
@@ -282,6 +257,34 @@ void VideoCaptureHost::GetDeviceFormatsInUse(
callback.Run(formats_in_use);
}
+void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) {
+ DVLOG(1) << __func__;
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ if (controllers_.find(controller_id) == controllers_.end())
+ return;
+
+ if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
+ device_id_to_observer_map_[controller_id]->OnStateChanged(
+ mojom::VideoCaptureState::FAILED);
+ }
+
+ DeleteVideoCaptureController(controller_id, true);
+}
+
+void VideoCaptureHost::DoEnded(VideoCaptureControllerID controller_id) {
+ DVLOG(1) << __func__;
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ if (controllers_.find(controller_id) == controllers_.end())
+ return;
+
+ if (base::ContainsKey(device_id_to_observer_map_, controller_id)) {
+ device_id_to_observer_map_[controller_id]->OnStateChanged(
+ mojom::VideoCaptureState::ENDED);
+ }
+
+ DeleteVideoCaptureController(controller_id, false);
+}
+
void VideoCaptureHost::OnControllerAdded(
int device_id,
const base::WeakPtr<VideoCaptureController>& controller) {

Powered by Google App Engine
This is Rietveld 408576698