| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_ | 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_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // | 24 // |
| 25 // If the renderer process goes away without sending messages that | 25 // If the renderer process goes away without sending messages that |
| 26 // tracks were removed, this class instead infers that the tracks were | 26 // tracks were removed, this class instead infers that the tracks were |
| 27 // removed. | 27 // removed. |
| 28 class MediaStreamTrackMetricsHost | 28 class MediaStreamTrackMetricsHost |
| 29 : public BrowserMessageFilter { | 29 : public BrowserMessageFilter { |
| 30 public: | 30 public: |
| 31 explicit MediaStreamTrackMetricsHost(); | 31 explicit MediaStreamTrackMetricsHost(); |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 virtual ~MediaStreamTrackMetricsHost(); | 34 ~MediaStreamTrackMetricsHost() override; |
| 35 | 35 |
| 36 // BrowserMessageFilter override. | 36 // BrowserMessageFilter override. |
| 37 virtual bool OnMessageReceived(const IPC::Message& message) override; | 37 bool OnMessageReceived(const IPC::Message& message) override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 void OnAddTrack(uint64 id, bool is_audio, bool is_remote); | 40 void OnAddTrack(uint64 id, bool is_audio, bool is_remote); |
| 41 void OnRemoveTrack(uint64 id); | 41 void OnRemoveTrack(uint64 id); |
| 42 | 42 |
| 43 // Information for a track we're keeping in |tracks_|. |is_audio| | 43 // Information for a track we're keeping in |tracks_|. |is_audio| |
| 44 // specifies whether it's an audio or video track, |is_remote| | 44 // specifies whether it's an audio or video track, |is_remote| |
| 45 // specifies whether it's remote (received over a PeerConnection) or | 45 // specifies whether it's remote (received over a PeerConnection) or |
| 46 // local (sent over a PeerConnection). |timestamp| specifies when | 46 // local (sent over a PeerConnection). |timestamp| specifies when |
| 47 // the track was connected. | 47 // the track was connected. |
| 48 struct TrackInfo { | 48 struct TrackInfo { |
| 49 bool is_audio; | 49 bool is_audio; |
| 50 bool is_remote; | 50 bool is_remote; |
| 51 base::TimeTicks timestamp; | 51 base::TimeTicks timestamp; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 void ReportDuration(const TrackInfo& info); | 54 void ReportDuration(const TrackInfo& info); |
| 55 | 55 |
| 56 // Values are unique (per renderer) track IDs. | 56 // Values are unique (per renderer) track IDs. |
| 57 typedef std::map<uint64, TrackInfo> TrackMap; | 57 typedef std::map<uint64, TrackInfo> TrackMap; |
| 58 TrackMap tracks_; | 58 TrackMap tracks_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace content | 61 } // namespace content |
| 62 | 62 |
| 63 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H
_ | 63 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H
_ |
| OLD | NEW |