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

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

Issue 616833004: chrome://media-internals: update MediaInternals when devices capabilities are enumerated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: burnik@ comments. Rebased. Refactored capabilities update. Created 6 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_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 7a28856273673092a84a4d761b278ab9dec96c7e..bb66998d45415400165c33be75fd0a89897be291 100644
--- a/content/browser/renderer_host/media/video_capture_manager.cc
+++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -14,6 +14,7 @@
#include "base/task_runner_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "content/browser/media/capture/web_contents_video_capture_device.h"
+#include "content/browser/media/media_internals.h"
#include "content/browser/renderer_host/media/video_capture_controller.h"
#include "content/browser/renderer_host/media/video_capture_controller_event_handler.h"
#include "content/public/browser/browser_thread.h"
@@ -563,11 +564,19 @@ void VideoCaptureManager::OnDevicesInfoEnumerated(
// Walk the |devices_info_cache_| and transform from VCD::Name to
// StreamDeviceInfo for return purposes.
StreamDeviceInfoArray devices;
- for (DeviceInfos::const_iterator it = devices_info_cache_.begin();
- it != devices_info_cache_.end(); ++it) {
+ std::vector<Tuple2<media::VideoCaptureDevice::Name,
+ media::VideoCaptureFormats> > name_and_formats;
+ for (const auto &it : devices_info_cache_) {
perkj_chrome 2014/10/07 14:12:51 is this allowed or not? I was trying to figure it
mcasas 2014/10/07 14:54:44 I read that C++11 is being introduced all over [1]
devices.push_back(StreamDeviceInfo(
- stream_type, it->name.GetNameAndModel(), it->name.id()));
+ stream_type, it.name.GetNameAndModel(), it.name.id()));
+ name_and_formats.push_back(MakeTuple(it.name, it.supported_formats));
}
+ // Send an update to MediaInternals about enumerated capabilities.
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
+ &MediaInternals::UpdateVideoCaptureDeviceCapabilities,
+ base::Unretained(MediaInternals::GetInstance()),
perkj_chrome 2014/10/07 15:51:24 Should we use devices_info_cache_ instead of creat
+ name_and_formats));
+
listener_->DevicesEnumerated(stream_type, devices);
}
@@ -603,7 +612,6 @@ void VideoCaptureManager::ConsolidateDevicesInfoOnDeviceThread(
for (media::VideoCaptureDevice::Names::const_iterator it =
names_snapshot->begin();
it != names_snapshot->end(); ++it) {
- media::VideoCaptureFormats supported_formats;
DeviceInfo device_info(*it, media::VideoCaptureFormats());
video_capture_device_factory_->GetDeviceSupportedFormats(
*it, &(device_info.supported_formats));

Powered by Google App Engine
This is Rietveld 408576698