| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_host/media/media_stream_track_metrics_host.h" | 5 #include "content/browser/renderer_host/media/media_stream_track_metrics_host.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "content/common/media/media_stream_track_metrics_host_messages.h" | 8 #include "content/common/media/media_stream_track_metrics_host_messages.h" |
| 9 | 9 |
| 10 // We use a histogram with a maximum bucket of 16 hours to infinity | 10 // We use a histogram with a maximum bucket of 16 hours to infinity |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 for (TrackMap::iterator it = tracks_.begin(); | 27 for (TrackMap::iterator it = tracks_.begin(); |
| 28 it != tracks_.end(); | 28 it != tracks_.end(); |
| 29 ++it) { | 29 ++it) { |
| 30 TrackInfo& info = it->second; | 30 TrackInfo& info = it->second; |
| 31 ReportDuration(info); | 31 ReportDuration(info); |
| 32 } | 32 } |
| 33 tracks_.clear(); | 33 tracks_.clear(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool MediaStreamTrackMetricsHost::OnMessageReceived( | 36 bool MediaStreamTrackMetricsHost::OnMessageReceived( |
| 37 const IPC::Message& message, | 37 const IPC::Message& message) { |
| 38 bool* message_was_ok) { | |
| 39 bool handled = true; | 38 bool handled = true; |
| 40 | 39 |
| 41 IPC_BEGIN_MESSAGE_MAP_EX(MediaStreamTrackMetricsHost, | 40 IPC_BEGIN_MESSAGE_MAP(MediaStreamTrackMetricsHost, message) |
| 42 message, | |
| 43 *message_was_ok) | |
| 44 IPC_MESSAGE_HANDLER(MediaStreamTrackMetricsHost_AddTrack, OnAddTrack) | 41 IPC_MESSAGE_HANDLER(MediaStreamTrackMetricsHost_AddTrack, OnAddTrack) |
| 45 IPC_MESSAGE_HANDLER(MediaStreamTrackMetricsHost_RemoveTrack, OnRemoveTrack) | 42 IPC_MESSAGE_HANDLER(MediaStreamTrackMetricsHost_RemoveTrack, OnRemoveTrack) |
| 46 IPC_MESSAGE_UNHANDLED(handled = false) | 43 IPC_MESSAGE_UNHANDLED(handled = false) |
| 47 IPC_END_MESSAGE_MAP_EX() | 44 IPC_END_MESSAGE_MAP() |
| 48 | 45 |
| 49 return handled; | 46 return handled; |
| 50 } | 47 } |
| 51 | 48 |
| 52 void MediaStreamTrackMetricsHost::OnAddTrack(uint64 id, | 49 void MediaStreamTrackMetricsHost::OnAddTrack(uint64 id, |
| 53 bool is_audio, | 50 bool is_audio, |
| 54 bool is_remote) { | 51 bool is_remote) { |
| 55 DCHECK(tracks_.find(id) == tracks_.end()); | 52 DCHECK(tracks_.find(id) == tracks_.end()); |
| 56 TrackInfo info = {is_audio, is_remote, base::TimeTicks::Now()}; | 53 TrackInfo info = {is_audio, is_remote, base::TimeTicks::Now()}; |
| 57 tracks_[id] = info; | 54 tracks_[id] = info; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 DVLOG(3) << "WebRTC.SentAudioTrackDuration: " << duration.InSeconds(); | 77 DVLOG(3) << "WebRTC.SentAudioTrackDuration: " << duration.InSeconds(); |
| 81 UMA_HISTOGRAM_TIMES_16H("WebRTC.SentAudioTrackDuration", duration); | 78 UMA_HISTOGRAM_TIMES_16H("WebRTC.SentAudioTrackDuration", duration); |
| 82 } else { | 79 } else { |
| 83 DVLOG(3) << "WebRTC.SentVideoTrackDuration: " << duration.InSeconds(); | 80 DVLOG(3) << "WebRTC.SentVideoTrackDuration: " << duration.InSeconds(); |
| 84 UMA_HISTOGRAM_TIMES_16H("WebRTC.SentVideoTrackDuration", duration); | 81 UMA_HISTOGRAM_TIMES_16H("WebRTC.SentVideoTrackDuration", duration); |
| 85 } | 82 } |
| 86 } | 83 } |
| 87 } | 84 } |
| 88 | 85 |
| 89 } // namespace content | 86 } // namespace content |
| OLD | NEW |