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

Side by Side Diff: content/browser/renderer_host/media/media_stream_track_metrics_host.h

Issue 183973021: Add metrics to track the duration of tracks received over a PeerConnection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_track_metrics_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/time/time.h"
12 #include "content/public/browser/browser_message_filter.h"
13
14 namespace content {
15
16 // Responsible for logging metrics about audio and video track
17 // lifetimes. These are based on messages from the renderer that are
18 // sent when tracks are created and destroyed. Unfortunately we can't
19 // reliably log the lifetime metric in the renderer because that
20 // process may be destroyed at any time by the fast shutdown path (see
21 // RenderProcessHost::FastShutdownIfPossible).
22 //
23 // There is one instance of this class per render process.
24 //
25 // If the renderer process goes away without sending messages that
26 // tracks were removed, this class instead infers that the tracks were
27 // removed.
28 class MediaStreamTrackMetricsHost
29 : public BrowserMessageFilter {
30 public:
31 explicit MediaStreamTrackMetricsHost();
32
33 protected:
34 virtual ~MediaStreamTrackMetricsHost();
35
36 // BrowserMessageFilter override.
37 virtual bool OnMessageReceived(const IPC::Message& message,
38 bool* message_was_ok) OVERRIDE;
39
40 private:
41 void OnAddTrack(uint64 id, bool is_audio, bool is_remote);
42 void OnRemoveTrack(uint64 id);
43
44 void ReportDuration(bool is_audio, base::TimeTicks start_time);
45
46 // Keys are unique (per renderer) track IDs, values are pairs: A
47 // boolean indicating whether the track is an audio track, and a
48 // timestamp from when the track was created.
49 typedef std::pair<bool, base::TimeTicks> IsAudioPlusTimestamp;
50 typedef std::map<uint64, IsAudioPlusTimestamp> TrackMap;
51 TrackMap tracks_;
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H _
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_track_metrics_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698