| 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 media::VideoCaptureDeviceInfos& video_capture_device_infos) { | 603 const VideoCaptureDeviceInfos& video_capture_device_infos) { |
| 604 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 604 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 605 video_capture_capabilities_cached_data_.Clear(); | 605 video_capture_capabilities_cached_data_.Clear(); |
| 606 | 606 |
| 607 for (const auto& video_capture_device_info : video_capture_device_infos) { | 607 for (const auto& video_capture_device_info : video_capture_device_infos) { |
| 608 base::ListValue* format_list = new base::ListValue(); | 608 base::ListValue* format_list = new base::ListValue(); |
| 609 // TODO(nisse): Representing format information as a string, to be | 609 // TODO(nisse): Representing format information as a string, to be |
| 610 // parsed by the javascript handler, is brittle. Consider passing | 610 // parsed by the javascript handler, is brittle. Consider passing |
| 611 // a list of mappings instead. | 611 // a list of mappings instead. |
| 612 | 612 |
| 613 for (const auto& format : video_capture_device_info.supported_formats) | 613 for (const auto& format : video_capture_device_info.supported_formats) |
| 614 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); | 614 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); |
| 615 | 615 |
| 616 std::unique_ptr<base::DictionaryValue> device_dict( | 616 std::unique_ptr<base::DictionaryValue> device_dict( |
| 617 new base::DictionaryValue()); | 617 new base::DictionaryValue()); |
| 618 device_dict->SetString("id", video_capture_device_info.name.id()); | 618 device_dict->SetString("id", |
| 619 video_capture_device_info.descriptor.device_id); |
| 619 device_dict->SetString( | 620 device_dict->SetString( |
| 620 "name", video_capture_device_info.name.GetNameAndModel()); | 621 "name", video_capture_device_info.descriptor.GetNameAndModel()); |
| 621 device_dict->Set("formats", format_list); | 622 device_dict->Set("formats", format_list); |
| 622 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ | 623 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
| 623 defined(OS_ANDROID) | 624 defined(OS_ANDROID) |
| 624 device_dict->SetString( | 625 device_dict->SetString( |
| 625 "captureApi", video_capture_device_info.name.GetCaptureApiTypeString()); | 626 "captureApi", |
| 627 video_capture_device_info.descriptor.GetCaptureApiTypeString()); |
| 626 #endif | 628 #endif |
| 627 video_capture_capabilities_cached_data_.Append(std::move(device_dict)); | 629 video_capture_capabilities_cached_data_.Append(std::move(device_dict)); |
| 628 } | 630 } |
| 629 | 631 |
| 630 SendVideoCaptureDeviceCapabilities(); | 632 SendVideoCaptureDeviceCapabilities(); |
| 631 } | 633 } |
| 632 | 634 |
| 633 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( | 635 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( |
| 634 AudioComponent component) { | 636 AudioComponent component) { |
| 635 base::AutoLock auto_lock(lock_); | 637 base::AutoLock auto_lock(lock_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); | 703 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); |
| 702 existing_dict->MergeDictionary(value); | 704 existing_dict->MergeDictionary(value); |
| 703 } | 705 } |
| 704 } | 706 } |
| 705 | 707 |
| 706 if (CanUpdate()) | 708 if (CanUpdate()) |
| 707 SendUpdate(SerializeUpdate(function, value)); | 709 SendUpdate(SerializeUpdate(function, value)); |
| 708 } | 710 } |
| 709 | 711 |
| 710 } // namespace content | 712 } // namespace content |
| OLD | NEW |