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

Side by Side Diff: content/browser/media/media_internals.cc

Issue 2169013002: Change class VideoCaptureDevice::Name to struct VideoCaptureDeviceDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build errors Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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
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 std::vector<std::tuple<media::VideoCaptureDeviceDescriptor,
604 media::VideoCaptureFormats>>&
605 descriptors_and_formats) {
604 DCHECK_CURRENTLY_ON(BrowserThread::IO); 606 DCHECK_CURRENTLY_ON(BrowserThread::IO);
605 video_capture_capabilities_cached_data_.Clear(); 607 video_capture_capabilities_cached_data_.Clear();
606 608
607 for (const auto& video_capture_device_info : video_capture_device_infos) { 609 for (const auto& device_format_pair : descriptors_and_formats) {
608 base::ListValue* format_list = new base::ListValue(); 610 base::ListValue* format_list = new base::ListValue();
609 // TODO(nisse): Representing format information as a string, to be 611 // TODO(nisse): Representing format information as a string, to be
610 // parsed by the javascript handler, is brittle. Consider passing 612 // parsed by the javascript handler, is brittle. Consider passing
611 // a list of mappings instead. 613 // a list of mappings instead.
612 614
613 for (const auto& format : video_capture_device_info.supported_formats) 615 const media::VideoCaptureDeviceDescriptor& descriptor =
616 std::get<0>(device_format_pair);
617 const media::VideoCaptureFormats& supported_formats =
618 std::get<1>(device_format_pair);
619 for (const auto& format : supported_formats)
614 format_list->AppendString(media::VideoCaptureFormat::ToString(format)); 620 format_list->AppendString(media::VideoCaptureFormat::ToString(format));
615 621
616 std::unique_ptr<base::DictionaryValue> device_dict( 622 std::unique_ptr<base::DictionaryValue> device_dict(
617 new base::DictionaryValue()); 623 new base::DictionaryValue());
618 device_dict->SetString("id", video_capture_device_info.name.id()); 624 device_dict->SetString("id", descriptor.device_id);
619 device_dict->SetString( 625 device_dict->SetString("name", descriptor.GetNameAndModel());
620 "name", video_capture_device_info.name.GetNameAndModel());
621 device_dict->Set("formats", format_list); 626 device_dict->Set("formats", format_list);
622 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \ 627 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) || \
623 defined(OS_ANDROID) 628 defined(OS_ANDROID)
624 device_dict->SetString( 629 device_dict->SetString("captureApi", descriptor.GetCaptureApiTypeString());
625 "captureApi", video_capture_device_info.name.GetCaptureApiTypeString());
626 #endif 630 #endif
627 video_capture_capabilities_cached_data_.Append(std::move(device_dict)); 631 video_capture_capabilities_cached_data_.Append(std::move(device_dict));
628 } 632 }
629 633
630 SendVideoCaptureDeviceCapabilities(); 634 SendVideoCaptureDeviceCapabilities();
631 } 635 }
632 636
633 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog( 637 std::unique_ptr<media::AudioLog> MediaInternals::CreateAudioLog(
634 AudioComponent component) { 638 AudioComponent component) {
635 base::AutoLock auto_lock(lock_); 639 base::AutoLock auto_lock(lock_);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); 705 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict));
702 existing_dict->MergeDictionary(value); 706 existing_dict->MergeDictionary(value);
703 } 707 }
704 } 708 }
705 709
706 if (CanUpdate()) 710 if (CanUpdate())
707 SendUpdate(SerializeUpdate(function, value)); 711 SendUpdate(SerializeUpdate(function, value));
708 } 712 }
709 713
710 } // namespace content 714 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_internals.h ('k') | content/browser/media/media_internals_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698