| 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..2f4bc63da498cce489aaf8887e761cf1593a0747 100644
|
| --- a/content/browser/media/media_internals.cc
|
| +++ b/content/browser/media/media_internals.cc
|
| @@ -224,29 +224,44 @@ 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());
|
| + 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
|
| - // 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;
|
| +
|
| + SendVideoCaptureCapabilities();
|
| }
|
|
|
| scoped_ptr<media::AudioLog> MediaInternals::CreateAudioLog(
|
|
|