Chromium Code Reviews| Index: content/browser/media/media_internals.cc |
| diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc |
| index 06c51e6f30e278b71cef2a5b22f758f79a571f4a..871aecda8df59ec401297f3677a8929e97423828 100644 |
| --- a/content/browser/media/media_internals.cc |
| +++ b/content/browser/media/media_internals.cc |
| @@ -219,7 +219,7 @@ void MediaInternals::SendEverything() { |
| { |
| base::AutoLock auto_lock(lock_); |
| everything_update = SerializeUpdate( |
| - "media.onReceiveEverything", &cached_data_); |
| + "media.onReceiveEverything", &audio_streams_cached_data_); |
|
burnik
2014/10/05 23:08:55
Audio data is not everything.
Not your doing, but
mcasas
2014/10/07 11:25:39
Done.
|
| } |
| SendUpdate(everything_update); |
| } |
| @@ -251,13 +251,13 @@ void MediaInternals::SendUpdateAndCache(const std::string& cache_key, |
| SendUpdate(SerializeUpdate(function, value)); |
| base::AutoLock auto_lock(lock_); |
| - if (!cached_data_.HasKey(cache_key)) { |
| - cached_data_.Set(cache_key, value->DeepCopy()); |
| + if (!audio_streams_cached_data_.HasKey(cache_key)) { |
| + audio_streams_cached_data_.Set(cache_key, value->DeepCopy()); |
| return; |
| } |
| base::DictionaryValue* existing_dict = NULL; |
| - CHECK(cached_data_.GetDictionary(cache_key, &existing_dict)); |
| + CHECK(audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); |
| existing_dict->MergeDictionary(value); |
| } |
| @@ -269,7 +269,27 @@ void MediaInternals::SendUpdateAndPurgeCache( |
| base::AutoLock auto_lock(lock_); |
| scoped_ptr<base::Value> out_value; |
| - CHECK(cached_data_.Remove(cache_key, &out_value)); |
| + CHECK(audio_streams_cached_data_.Remove(cache_key, &out_value)); |
| +} |
| + |
| +void MediaInternals::UpdateVideoCaptureDeviceCapabilities( |
| + const media::VideoCaptureDevice::Name& name, |
| + const media::VideoCaptureFormats& formats) { |
|
burnik
2014/10/05 23:08:55
ditto, add:
const size_t num_devices
mcasas
2014/10/07 11:25:39
Done.
|
| + base::DictionaryValue* formats_dict = new base::DictionaryValue(); |
| + int cont = 0; |
| + for (const auto &it : formats) |
| + formats_dict->SetString(base::StringPrintf("[%3d]", cont++), it.ToString()); |
| + formats_dict->SetString("Unique ID", name.id()); |
| +#if defined(OS_WIN) || defined(OS_MACOSX) |
| + formats_dict->SetString("Capture API:", name.capture_api_type()); |
| +#endif |
| + |
| + video_devices_cached_data_.Set(name.GetNameAndModel(), formats_dict); |
| + SendEverything(); |
|
burnik
2014/10/05 23:08:55
Two problems lie here:
1) You're calling MediaInte
mcasas
2014/10/07 11:25:40
Done.
|
| +} |
| + |
| +void MediaInternals::PurgeVideoCaptureDeviceCapabilities() { |
|
burnik
2014/10/05 23:08:55
We can probably avoid this method alltogether if w
mcasas
2014/10/07 11:25:39
Done.
|
| + video_devices_cached_data_.Clear(); |
| } |
| } // namespace content |