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

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

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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/sctputils_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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // The caller is responsible for ensuring that the session outlives the 60 // The caller is responsible for ensuring that the session outlives the
61 // StatsCollector instance. 61 // StatsCollector instance.
62 explicit StatsCollector(WebRtcSession* session); 62 explicit StatsCollector(WebRtcSession* session);
63 virtual ~StatsCollector(); 63 virtual ~StatsCollector();
64 64
65 // 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
66 // to GetStats. 66 // to GetStats.
67 void AddStream(MediaStreamInterface* stream); 67 void AddStream(MediaStreamInterface* stream);
68 68
69 // Adds a local audio track that is used for getting some voice statistics. 69 // Adds a local audio track that is used for getting some voice statistics.
70 void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32 ssrc); 70 void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc);
71 71
72 // Removes a local audio tracks that is used for getting some voice 72 // Removes a local audio tracks that is used for getting some voice
73 // statistics. 73 // statistics.
74 void RemoveLocalAudioTrack(AudioTrackInterface* audio_track, uint32 ssrc); 74 void RemoveLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc);
75 75
76 // Gather statistics from the session and store them for future use. 76 // Gather statistics from the session and store them for future use.
77 void UpdateStats(PeerConnectionInterface::StatsOutputLevel level); 77 void UpdateStats(PeerConnectionInterface::StatsOutputLevel level);
78 78
79 // Gets a StatsReports of the last collected stats. Note that UpdateStats must 79 // Gets a StatsReports of the last collected stats. Note that UpdateStats must
80 // be called before this function to get the most recent stats. |selector| is 80 // be called before this function to get the most recent stats. |selector| is
81 // a track label or empty string. The most recent reports are stored in 81 // a track label or empty string. The most recent reports are stored in
82 // |reports|. 82 // |reports|.
83 // TODO(tommi): Change this contract to accept a callback object instead 83 // TODO(tommi): Change this contract to accept a callback object instead
84 // of filling in |reports|. As is, there's a requirement that the caller 84 // of filling in |reports|. As is, there's a requirement that the caller
85 // uses |reports| immediately without allowing any async activity on 85 // uses |reports| immediately without allowing any async activity on
86 // the thread (message handling etc) and then discard the results. 86 // the thread (message handling etc) and then discard the results.
87 void GetStats(MediaStreamTrackInterface* track, 87 void GetStats(MediaStreamTrackInterface* track,
88 StatsReports* reports); 88 StatsReports* reports);
89 89
90 // Prepare a local or remote SSRC report for the given ssrc. Used internally 90 // Prepare a local or remote SSRC report for the given ssrc. Used internally
91 // in the ExtractStatsFromList template. 91 // in the ExtractStatsFromList template.
92 StatsReport* PrepareReport(bool local, uint32 ssrc, 92 StatsReport* PrepareReport(bool local,
93 const StatsReport::Id& transport_id, StatsReport::Direction direction); 93 uint32_t ssrc,
94 const StatsReport::Id& transport_id,
95 StatsReport::Direction direction);
94 96
95 // Method used by the unittest to force a update of stats since UpdateStats() 97 // Method used by the unittest to force a update of stats since UpdateStats()
96 // that occur less than kMinGatherStatsPeriod number of ms apart will be 98 // that occur less than kMinGatherStatsPeriod number of ms apart will be
97 // ignored. 99 // ignored.
98 void ClearUpdateStatsCacheForTest(); 100 void ClearUpdateStatsCacheForTest();
99 101
100 private: 102 private:
101 friend class StatsCollectorTest; 103 friend class StatsCollectorTest;
102 104
103 // Overridden in unit tests to fake timing. 105 // Overridden in unit tests to fake timing.
(...skipping 28 matching lines...) Expand all
132 const std::string& id, 134 const std::string& id,
133 StatsReport::Direction direction); 135 StatsReport::Direction direction);
134 136
135 // Helper method to get stats from the local audio tracks. 137 // Helper method to get stats from the local audio tracks.
136 void UpdateStatsFromExistingLocalAudioTracks(); 138 void UpdateStatsFromExistingLocalAudioTracks();
137 void UpdateReportFromAudioTrack(AudioTrackInterface* track, 139 void UpdateReportFromAudioTrack(AudioTrackInterface* track,
138 StatsReport* report); 140 StatsReport* report);
139 141
140 // Helper method to get the id for the track identified by ssrc. 142 // Helper method to get the id for the track identified by ssrc.
141 // |direction| tells if the track is for sending or receiving. 143 // |direction| tells if the track is for sending or receiving.
142 bool GetTrackIdBySsrc(uint32 ssrc, std::string* track_id, 144 bool GetTrackIdBySsrc(uint32_t ssrc,
145 std::string* track_id,
143 StatsReport::Direction direction); 146 StatsReport::Direction direction);
144 147
145 // Helper method to update the timestamp of track records. 148 // Helper method to update the timestamp of track records.
146 void UpdateTrackReports(); 149 void UpdateTrackReports();
147 150
148 // A collection for all of our stats reports. 151 // A collection for all of our stats reports.
149 StatsCollection reports_; 152 StatsCollection reports_;
150 TrackIdMap track_ids_; 153 TrackIdMap track_ids_;
151 // Raw pointer to the session the statistics are gathered from. 154 // Raw pointer to the session the statistics are gathered from.
152 WebRtcSession* const session_; 155 WebRtcSession* const session_;
153 double stats_gathering_started_; 156 double stats_gathering_started_;
154 cricket::ProxyTransportMap proxy_to_transport_; 157 cricket::ProxyTransportMap proxy_to_transport_;
155 158
156 // TODO(tommi): We appear to be holding on to raw pointers to reference 159 // TODO(tommi): We appear to be holding on to raw pointers to reference
157 // counted objects? We should be using scoped_refptr here. 160 // counted objects? We should be using scoped_refptr here.
158 typedef std::vector<std::pair<AudioTrackInterface*, uint32> > 161 typedef std::vector<std::pair<AudioTrackInterface*, uint32_t> >
159 LocalAudioTrackVector; 162 LocalAudioTrackVector;
160 LocalAudioTrackVector local_audio_tracks_; 163 LocalAudioTrackVector local_audio_tracks_;
161 }; 164 };
162 165
163 } // namespace webrtc 166 } // namespace webrtc
164 167
165 #endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_ 168 #endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_
OLDNEW
« no previous file with comments | « talk/app/webrtc/sctputils_unittest.cc ('k') | talk/app/webrtc/statscollector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698