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

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

Issue 1864483002: Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finished up for review. Created 4 years, 7 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "content/browser/renderer_host/media/media_stream_manager.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/render_frame_host.h" 20 #include "content/public/browser/render_frame_host.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_ui.h" 23 #include "content/public/browser/web_ui.h"
23 #include "media/base/audio_parameters.h" 24 #include "media/base/audio_parameters.h"
24 #include "media/base/media_log_event.h" 25 #include "media/base/media_log_event.h"
25 #include "media/filters/gpu_video_decoder.h" 26 #include "media/filters/gpu_video_decoder.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void OnCreated(int component_id, 104 void OnCreated(int component_id,
104 const media::AudioParameters& params, 105 const media::AudioParameters& params,
105 const std::string& device_id) override; 106 const std::string& device_id) override;
106 void OnStarted(int component_id) override; 107 void OnStarted(int component_id) override;
107 void OnStopped(int component_id) override; 108 void OnStopped(int component_id) override;
108 void OnClosed(int component_id) override; 109 void OnClosed(int component_id) override;
109 void OnError(int component_id) override; 110 void OnError(int component_id) override;
110 void OnSetVolume(int component_id, double volume) override; 111 void OnSetVolume(int component_id, double volume) override;
111 void OnSwitchOutputDevice(int component_id, 112 void OnSwitchOutputDevice(int component_id,
112 const std::string& device_id) override; 113 const std::string& device_id) override;
114 void OnStatistics(int component_id,
115 const std::string& name,
116 int value) override;
113 117
114 // Called by MediaInternals to update the WebContents title for a stream. 118 // Called by MediaInternals to update the WebContents title for a stream.
115 void SendWebContentsTitle(int component_id, 119 void SendWebContentsTitle(int component_id,
116 int render_process_id, 120 int render_process_id,
117 int render_frame_id); 121 int render_frame_id);
118 122
119 private: 123 private:
120 void SendSingleStringUpdate(int component_id, 124 void SendSingleStringUpdate(int component_id,
121 const std::string& key, 125 const std::string& key,
122 const std::string& value); 126 const std::string& value);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void AudioLogImpl::OnSwitchOutputDevice(int component_id, 203 void AudioLogImpl::OnSwitchOutputDevice(int component_id,
200 const std::string& device_id) { 204 const std::string& device_id) {
201 base::DictionaryValue dict; 205 base::DictionaryValue dict;
202 StoreComponentMetadata(component_id, &dict); 206 StoreComponentMetadata(component_id, &dict);
203 dict.SetString("device_id", device_id); 207 dict.SetString("device_id", device_id);
204 media_internals_->UpdateAudioLog(MediaInternals::UPDATE_IF_EXISTS, 208 media_internals_->UpdateAudioLog(MediaInternals::UPDATE_IF_EXISTS,
205 FormatCacheKey(component_id), 209 FormatCacheKey(component_id),
206 kAudioLogUpdateFunction, &dict); 210 kAudioLogUpdateFunction, &dict);
207 } 211 }
208 212
213 void AudioLogImpl::OnStatistics(int component_id,
214 const std::string& name,
215 int value) {
216 MediaStreamManager::SendMessageToNativeLog(
217 base::StringPrintf("%s: %d", name.c_str(), value));
218
219 // TODO(grunell): Show stats on media-internals page.
220 }
221
209 void AudioLogImpl::SendWebContentsTitle(int component_id, 222 void AudioLogImpl::SendWebContentsTitle(int component_id,
210 int render_process_id, 223 int render_process_id,
211 int render_frame_id) { 224 int render_frame_id) {
212 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 225 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
213 StoreComponentMetadata(component_id, dict.get()); 226 StoreComponentMetadata(component_id, dict.get());
214 SendWebContentsTitleHelper(FormatCacheKey(component_id), std::move(dict), 227 SendWebContentsTitleHelper(FormatCacheKey(component_id), std::move(dict),
215 render_process_id, render_frame_id); 228 render_process_id, render_frame_id);
216 } 229 }
217 230
218 std::string AudioLogImpl::FormatCacheKey(int component_id) { 231 std::string AudioLogImpl::FormatCacheKey(int component_id) {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict)); 705 audio_streams_cached_data_.GetDictionary(cache_key, &existing_dict));
693 existing_dict->MergeDictionary(value); 706 existing_dict->MergeDictionary(value);
694 } 707 }
695 } 708 }
696 709
697 if (CanUpdate()) 710 if (CanUpdate())
698 SendUpdate(SerializeUpdate(function, value)); 711 SendUpdate(SerializeUpdate(function, value));
699 } 712 }
700 713
701 } // namespace content 714 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698