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

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

Issue 2634263002: Pass camera facing info to audio client (Closed)
Patch Set: Address comments Created 3 years, 11 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_manager.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc
index 007fae8d034143bd019b28d18fa6ea52b26a205f..9b0a8db11408e50b8834086b1aacd8d07c97f88b 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -34,6 +34,7 @@
#include "content/public/common/media_stream_request.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/media_switches.h"
+#include "media/base/video_facing.h"
#include "media/capture/video/video_capture_buffer_pool_impl.h"
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
#include "media/capture/video/video_capture_device.h"
@@ -334,13 +335,19 @@ VideoCaptureManager::VideoCaptureManager(
std::unique_ptr<media::VideoCaptureDeviceFactory> factory)
: listener_(nullptr),
new_capture_session_id_(1),
- video_capture_device_factory_(std::move(factory)) {}
+ video_capture_device_factory_(std::move(factory)),
+ capture_observer_(nullptr) {}
chfremer 2017/01/30 19:49:28 No need to initialize a std::unique_ptr<> member t
shenghao 2017/02/08 02:07:10 Done.
VideoCaptureManager::~VideoCaptureManager() {
DCHECK(devices_.empty());
DCHECK(device_start_queue_.empty());
}
+void VideoCaptureManager::SetVideoCaptureObserver(
+ std::unique_ptr<media::VideoCaptureObserver> observer) {
+ capture_observer_ = std::move(observer);
+}
+
void VideoCaptureManager::Register(
MediaStreamProviderListener* listener,
const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner) {
@@ -471,6 +478,11 @@ void VideoCaptureManager::DoStopDevice(DeviceEntry* entry) {
}
}
+ const DeviceInfo* device_info = GetDeviceInfoById(entry->id);
+ if (device_info != NULL && capture_observer_.get() != NULL) {
chfremer 2017/01/30 19:49:28 NULL -> nullptr
shenghao 2017/02/08 02:07:10 Done.
+ capture_observer_->OnVideoCaptureStopped(device_info->descriptor.facing);
+ }
+
DVLOG(3) << "DoStopDevice. Send stop request for device = " << entry->id
<< " serial_id = " << entry->serial_id << ".";
entry->video_capture_controller.OnLog(
@@ -527,6 +539,10 @@ void VideoCaptureManager::HandleQueuedStartRequest() {
found->descriptor.GetNameAndModel().c_str(),
found->descriptor.GetCaptureApiTypeString()));
+ if (capture_observer_.get() != NULL) {
chfremer 2017/01/30 19:49:28 NULL -> nullptr
shenghao 2017/02/08 02:07:10 Done.
+ capture_observer_->OnVideoCaptureStarted(found->descriptor.facing);
+ }
+
start_capture_function =
base::Bind(&VideoCaptureManager::DoStartDeviceCaptureOnDeviceThread,
this, found->descriptor, request->params(),

Powered by Google App Engine
This is Rietveld 408576698