| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/media/media_internals.h" | 5 #include "content/browser/media/media_internals.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 593 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 594 | 594 |
| 595 if (!CanUpdate()) | 595 if (!CanUpdate()) |
| 596 return; | 596 return; |
| 597 | 597 |
| 598 SendUpdate(SerializeUpdate("media.onReceiveVideoCaptureCapabilities", | 598 SendUpdate(SerializeUpdate("media.onReceiveVideoCaptureCapabilities", |
| 599 &video_capture_capabilities_cached_data_)); | 599 &video_capture_capabilities_cached_data_)); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void MediaInternals::UpdateVideoCaptureDeviceCapabilities( | 602 void MediaInternals::UpdateVideoCaptureDeviceCapabilities( |
| 603 const std::vector<std::tuple<media::VideoCaptureDeviceDescriptor, | 603 const std::vector<std::tuple<device::VideoCaptureDeviceDescriptor, |
| 604 media::VideoCaptureFormats>>& | 604 media::VideoCaptureFormats>>& |
| 605 descriptors_and_formats) { | 605 descriptors_and_formats) { |
| 606 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 606 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 607 video_capture_capabilities_cached_data_.Clear(); | 607 video_capture_capabilities_cached_data_.Clear(); |
| 608 | 608 |
| 609 for (const auto& device_format_pair : descriptors_and_formats) { | 609 for (const auto& device_format_pair : descriptors_and_formats) { |
| 610 base::ListValue* format_list = new base::ListValue(); | 610 base::ListValue* format_list = new base::ListValue(); |
| 611 // TODO(nisse): Representing format information as a string, to be | 611 // TODO(nisse): Representing format information as a string, to be |
| 612 // parsed by the javascript handler, is brittle. Consider passing | 612 // parsed by the javascript handler, is brittle. Consider passing |
| 613 // a list of mappings instead. | 613 // a list of mappings instead. |
| 614 | 614 |
| 615 const media::VideoCaptureDeviceDescriptor& descriptor = | 615 const device::VideoCaptureDeviceDescriptor& descriptor = |
| 616 std::get<0>(device_format_pair); | 616 std::get<0>(device_format_pair); |
| 617 const media::VideoCaptureFormats& supported_formats = | 617 const media::VideoCaptureFormats& supported_formats = |
| 618 std::get<1>(device_format_pair); | 618 std::get<1>(device_format_pair); |
| 619 for (const auto& format : supported_formats) | 619 for (const auto& format : supported_formats) |
| 620 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); | 620 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); |
| 621 | 621 |
| 622 std::unique_ptr<base::DictionaryValue> device_dict( | 622 std::unique_ptr<base::DictionaryValue> device_dict( |
| 623 new base::DictionaryValue()); | 623 new base::DictionaryValue()); |
| 624 device_dict->SetString("id", descriptor.device_id); | 624 device_dict->SetString("id", descriptor.device_id); |
| 625 device_dict->SetString("name", descriptor.GetNameAndModel()); | 625 device_dict->SetString("name", descriptor.GetNameAndModel()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); | 705 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); |
| 706 existing_dict->MergeDictionary(value); | 706 existing_dict->MergeDictionary(value); |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 if (CanUpdate()) | 710 if (CanUpdate()) |
| 711 SendUpdate(SerializeUpdate(function, value)); | 711 SendUpdate(SerializeUpdate(function, value)); |
| 712 } | 712 } |
| 713 | 713 |
| 714 } // namespace content | 714 } // namespace content |
| OLD | NEW |