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

Unified Diff: content/browser/media/media_internals.cc

Issue 643343004: Video Capture Capabilities available on chrome://media-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/media/media_internals.cc
diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc
index 7d6c78a40b59ae764a8da9051223fdac5678763d..a75de91d1fef3e7207ab7eacc5a04eb806aa42b7 100644
--- a/content/browser/media/media_internals.cc
+++ b/content/browser/media/media_internals.cc
@@ -224,31 +224,55 @@ void MediaInternals::SendAudioStreamData() {
SendUpdate(audio_stream_update);
}
+void MediaInternals::SendVideoCaptureCapabilities() {
+ base::string16 video_capture_capabilities_update;
+ {
+ base::AutoLock auto_lock(lock_);
+ video_capture_capabilities_update = SerializeUpdate(
+ "media.onReceiveVideoCaptureCapabilities",
+ &video_capture_capabilities_cached_data_);
+ }
+ SendUpdate(video_capture_capabilities_update);
+}
+
void MediaInternals::UpdateVideoCaptureDeviceCapabilities(
const media::VideoCaptureDeviceInfos& video_capture_device_infos) {
- base::DictionaryValue video_devices_info_dictionary;
- for (const auto& video_capture_device_info : video_capture_device_infos) {
- base::DictionaryValue* formats_dict = new base::DictionaryValue();
- formats_dict->SetString("Unique ID", video_capture_device_info.name.id());
+ {
+ base::AutoLock auto_lock(lock_);
+ video_capture_capabilities_cached_data_.Clear();
+
+ for (const auto& video_capture_device_info : video_capture_device_infos) {
+ base::ListValue* format_list = new base::ListValue();
+ for (const auto& format : video_capture_device_info.supported_formats)
+ format_list->AppendString(format.ToString());
+
+ base::DictionaryValue* device_dict = new base::DictionaryValue();
+ device_dict->SetString("id", video_capture_device_info.name.id());
+ device_dict->SetString(
+ "name", video_capture_device_info.name.GetNameAndModel());
+ device_dict->Set("formats", format_list);
+
#if defined(OS_WIN) || defined(OS_MACOSX)
- formats_dict->SetInteger("Capture API: #",
- video_capture_device_info.name.capture_api_type());
+ // TODO(burnik): Capture API should be a name/description.
+ device_dict->SetInteger(
+ "captureApi",
+ video_capture_device_info.name.capture_api_type());
#endif
- int count = 0;
- for (const auto& format : video_capture_device_info.supported_formats) {
- formats_dict->SetString(base::StringPrintf("[%3d]", count++),
- format.ToString());
+
+ video_capture_capabilities_cached_data_.Append(device_dict);
+
}
- video_devices_info_dictionary.Set(
- video_capture_device_info.name.GetNameAndModel(), formats_dict);
- }
+
+ }
// TODO(mcasas): Remove the following printout when sending the capabilities
mcasas 2014/10/14 13:44:11 Remove TODO /rewrite comment
burnik 2014/10/15 13:45:57 Done.
// to JS is implemented in a similar way to how SendAudioStreamData() does.
// A lock might be needed if these capabilities are cached at this point.
- DVLOG(1) << "Received: " << video_devices_info_dictionary;
+ DVLOG(1) << "Received: " << video_capture_capabilities_cached_data_;
+ SendVideoCaptureCapabilities();
}
+
mcasas 2014/10/14 13:44:11 Remove empty line.
burnik 2014/10/15 13:45:57 Done.
scoped_ptr<media::AudioLog> MediaInternals::CreateAudioLog(
AudioComponent component) {
base::AutoLock auto_lock(lock_);

Powered by Google App Engine
This is Rietveld 408576698