| 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 |
| 9 #include <memory> |
| 8 #include <utility> | 10 #include <utility> |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 15 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 16 #include "content/browser/renderer_host/media/media_stream_manager.h" | 18 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 606 |
| 605 for (const auto& video_capture_device_info : video_capture_device_infos) { | 607 for (const auto& video_capture_device_info : video_capture_device_infos) { |
| 606 base::ListValue* format_list = new base::ListValue(); | 608 base::ListValue* format_list = new base::ListValue(); |
| 607 // TODO(nisse): Representing format information as a string, to be | 609 // TODO(nisse): Representing format information as a string, to be |
| 608 // parsed by the javascript handler, is brittle. Consider passing | 610 // parsed by the javascript handler, is brittle. Consider passing |
| 609 // a list of mappings instead. | 611 // a list of mappings instead. |
| 610 | 612 |
| 611 for (const auto& format : video_capture_device_info.supported_formats) | 613 for (const auto& format : video_capture_device_info.supported_formats) |
| 612 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); | 614 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); |
| 613 | 615 |
| 614 base::DictionaryValue* device_dict = new base::DictionaryValue(); | 616 std::unique_ptr<base::DictionaryValue> device_dict( |
| 617 new base::DictionaryValue()); |
| 615 device_dict->SetString("id", video_capture_device_info.name.id()); | 618 device_dict->SetString("id", video_capture_device_info.name.id()); |
| 616 device_dict->SetString( | 619 device_dict->SetString( |
| 617 "name", video_capture_device_info.name.GetNameAndModel()); | 620 "name", video_capture_device_info.name.GetNameAndModel()); |
| 618 device_dict->Set("formats", format_list); | 621 device_dict->Set("formats", format_list); |
| 619 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ | 622 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ |
| 620 defined(OS_ANDROID) | 623 defined(OS_ANDROID) |
| 621 device_dict->SetString( | 624 device_dict->SetString( |
| 622 "captureApi", video_capture_device_info.name.GetCaptureApiTypeString()); | 625 "captureApi", video_capture_device_info.name.GetCaptureApiTypeString()); |
| 623 #endif | 626 #endif |
| 624 video_capture_capabilities_cached_data_.Append(device_dict); | 627 video_capture_capabilities_cached_data_.Append(std::move(device_dict)); |
| 625 } | 628 } |
| 626 | 629 |
| 627 SendVideoCaptureDeviceCapabilities(); | 630 SendVideoCaptureDeviceCapabilities(); |
| 628 } | 631 } |
| 629 | 632 |
| 630 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( | 633 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( |
| 631 AudioComponent component) { | 634 AudioComponent component) { |
| 632 base::AutoLock auto_lock(lock_); | 635 base::AutoLock auto_lock(lock_); |
| 633 return std::unique_ptr<media::AudioLog>( | 636 return std::unique_ptr<media::AudioLog>( |
| 634 new AudioLogImpl(owner_ids_[component]++, component, this)); | 637 new AudioLogImpl(owner_ids_[component]++, component, this)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); | 701 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); |
| 699 existing_dict->MergeDictionary(value); | 702 existing_dict->MergeDictionary(value); |
| 700 } | 703 } |
| 701 } | 704 } |
| 702 | 705 |
| 703 if (CanUpdate()) | 706 if (CanUpdate()) |
| 704 SendUpdate(SerializeUpdate(function, value)); | 707 SendUpdate(SerializeUpdate(function, value)); |
| 705 } | 708 } |
| 706 | 709 |
| 707 } // namespace content | 710 } // namespace content |
| OLD | NEW |