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

Side by Side Diff: talk/app/webrtc/statscollector.h

Issue 1204493002: Set / verify stats report timestamps. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « talk/app/webrtc/peerconnection_unittest.cc ('k') | talk/app/webrtc/statscollector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 // Conversion function to convert candidate type string to the corresponding one 46 // Conversion function to convert candidate type string to the corresponding one
47 // from enum RTCStatsIceCandidateType. 47 // from enum RTCStatsIceCandidateType.
48 const char* IceCandidateTypeToStatsType(const std::string& candidate_type); 48 const char* IceCandidateTypeToStatsType(const std::string& candidate_type);
49 49
50 // Conversion function to convert adapter type to report string which are more 50 // Conversion function to convert adapter type to report string which are more
51 // fitting to the general style of http://w3c.github.io/webrtc-stats. This is 51 // fitting to the general style of http://w3c.github.io/webrtc-stats. This is
52 // only used by stats collector. 52 // only used by stats collector.
53 const char* AdapterTypeToStatsType(rtc::AdapterType type); 53 const char* AdapterTypeToStatsType(rtc::AdapterType type);
54 54
55 // A mapping between track ids and their StatsReport.
56 typedef std::map<std::string, StatsReport*> TrackIdMap;
57
55 class StatsCollector { 58 class StatsCollector {
56 public: 59 public:
57 // The caller is responsible for ensuring that the session outlives the 60 // The caller is responsible for ensuring that the session outlives the
58 // StatsCollector instance. 61 // StatsCollector instance.
59 explicit StatsCollector(WebRtcSession* session); 62 explicit StatsCollector(WebRtcSession* session);
60 virtual ~StatsCollector(); 63 virtual ~StatsCollector();
61 64
62 // Adds a MediaStream with tracks that can be used as a |selector| in a call 65 // Adds a MediaStream with tracks that can be used as a |selector| in a call
63 // to GetStats. 66 // to GetStats.
64 void AddStream(MediaStreamInterface* stream); 67 void AddStream(MediaStreamInterface* stream);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // Helper method to get stats from the local audio tracks. 135 // Helper method to get stats from the local audio tracks.
133 void UpdateStatsFromExistingLocalAudioTracks(); 136 void UpdateStatsFromExistingLocalAudioTracks();
134 void UpdateReportFromAudioTrack(AudioTrackInterface* track, 137 void UpdateReportFromAudioTrack(AudioTrackInterface* track,
135 StatsReport* report); 138 StatsReport* report);
136 139
137 // Helper method to get the id for the track identified by ssrc. 140 // Helper method to get the id for the track identified by ssrc.
138 // |direction| tells if the track is for sending or receiving. 141 // |direction| tells if the track is for sending or receiving.
139 bool GetTrackIdBySsrc(uint32 ssrc, std::string* track_id, 142 bool GetTrackIdBySsrc(uint32 ssrc, std::string* track_id,
140 StatsReport::Direction direction); 143 StatsReport::Direction direction);
141 144
145 // Helper method to update the timestamp of track records.
146 void UpdateTrackReports();
147
142 // A collection for all of our stats reports. 148 // A collection for all of our stats reports.
143 StatsCollection reports_; 149 StatsCollection reports_;
150 TrackIdMap track_ids_;
144 // Raw pointer to the session the statistics are gathered from. 151 // Raw pointer to the session the statistics are gathered from.
145 WebRtcSession* const session_; 152 WebRtcSession* const session_;
146 double stats_gathering_started_; 153 double stats_gathering_started_;
147 cricket::ProxyTransportMap proxy_to_transport_; 154 cricket::ProxyTransportMap proxy_to_transport_;
148 155
149 // TODO(tommi): We appear to be holding on to raw pointers to reference 156 // TODO(tommi): We appear to be holding on to raw pointers to reference
150 // counted objects? We should be using scoped_refptr here. 157 // counted objects? We should be using scoped_refptr here.
151 typedef std::vector<std::pair<AudioTrackInterface*, uint32> > 158 typedef std::vector<std::pair<AudioTrackInterface*, uint32> >
152 LocalAudioTrackVector; 159 LocalAudioTrackVector;
153 LocalAudioTrackVector local_audio_tracks_; 160 LocalAudioTrackVector local_audio_tracks_;
154 }; 161 };
155 162
156 } // namespace webrtc 163 } // namespace webrtc
157 164
158 #endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_ 165 #endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/peerconnection_unittest.cc ('k') | talk/app/webrtc/statscollector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698