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

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

Issue 1393563002: Moving MediaStreamSignaling logic into PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing copyright header 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 25 matching lines...) Expand all
36 #include <vector> 36 #include <vector>
37 37
38 #include "talk/app/webrtc/mediastreaminterface.h" 38 #include "talk/app/webrtc/mediastreaminterface.h"
39 #include "talk/app/webrtc/mediastreamsignaling.h" 39 #include "talk/app/webrtc/mediastreamsignaling.h"
40 #include "talk/app/webrtc/peerconnectioninterface.h" 40 #include "talk/app/webrtc/peerconnectioninterface.h"
41 #include "talk/app/webrtc/statstypes.h" 41 #include "talk/app/webrtc/statstypes.h"
42 #include "talk/app/webrtc/webrtcsession.h" 42 #include "talk/app/webrtc/webrtcsession.h"
43 43
44 namespace webrtc { 44 namespace webrtc {
45 45
46 class PeerConnection;
47
46 // Conversion function to convert candidate type string to the corresponding one 48 // Conversion function to convert candidate type string to the corresponding one
47 // from enum RTCStatsIceCandidateType. 49 // from enum RTCStatsIceCandidateType.
48 const char* IceCandidateTypeToStatsType(const std::string& candidate_type); 50 const char* IceCandidateTypeToStatsType(const std::string& candidate_type);
49 51
50 // Conversion function to convert adapter type to report string which are more 52 // 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 53 // fitting to the general style of http://w3c.github.io/webrtc-stats. This is
52 // only used by stats collector. 54 // only used by stats collector.
53 const char* AdapterTypeToStatsType(rtc::AdapterType type); 55 const char* AdapterTypeToStatsType(rtc::AdapterType type);
54 56
55 // A mapping between track ids and their StatsReport. 57 // A mapping between track ids and their StatsReport.
56 typedef std::map<std::string, StatsReport*> TrackIdMap; 58 typedef std::map<std::string, StatsReport*> TrackIdMap;
57 59
58 class StatsCollector { 60 class StatsCollector {
59 public: 61 public:
60 // The caller is responsible for ensuring that the session outlives the 62 // The caller is responsible for ensuring that the pc outlives the
61 // StatsCollector instance. 63 // StatsCollector instance.
62 explicit StatsCollector(WebRtcSession* session); 64 explicit StatsCollector(PeerConnection* pc);
63 virtual ~StatsCollector(); 65 virtual ~StatsCollector();
64 66
65 // Adds a MediaStream with tracks that can be used as a |selector| in a call 67 // Adds a MediaStream with tracks that can be used as a |selector| in a call
66 // to GetStats. 68 // to GetStats.
67 void AddStream(MediaStreamInterface* stream); 69 void AddStream(MediaStreamInterface* stream);
68 70
69 // Adds a local audio track that is used for getting some voice statistics. 71 // Adds a local audio track that is used for getting some voice statistics.
70 void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc); 72 void AddLocalAudioTrack(AudioTrackInterface* audio_track, uint32_t ssrc);
71 73
72 // Removes a local audio tracks that is used for getting some voice 74 // Removes a local audio tracks that is used for getting some voice
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 bool GetTrackIdBySsrc(uint32_t ssrc, 146 bool GetTrackIdBySsrc(uint32_t ssrc,
145 std::string* track_id, 147 std::string* track_id,
146 StatsReport::Direction direction); 148 StatsReport::Direction direction);
147 149
148 // Helper method to update the timestamp of track records. 150 // Helper method to update the timestamp of track records.
149 void UpdateTrackReports(); 151 void UpdateTrackReports();
150 152
151 // A collection for all of our stats reports. 153 // A collection for all of our stats reports.
152 StatsCollection reports_; 154 StatsCollection reports_;
153 TrackIdMap track_ids_; 155 TrackIdMap track_ids_;
154 // Raw pointer to the session the statistics are gathered from. 156 // Raw pointer to the peer connection the statistics are gathered from.
155 WebRtcSession* const session_; 157 PeerConnection* const pc_;
156 double stats_gathering_started_; 158 double stats_gathering_started_;
157 cricket::ProxyTransportMap proxy_to_transport_; 159 cricket::ProxyTransportMap proxy_to_transport_;
158 160
159 // TODO(tommi): We appear to be holding on to raw pointers to reference 161 // TODO(tommi): We appear to be holding on to raw pointers to reference
160 // counted objects? We should be using scoped_refptr here. 162 // counted objects? We should be using scoped_refptr here.
161 typedef std::vector<std::pair<AudioTrackInterface*, uint32_t> > 163 typedef std::vector<std::pair<AudioTrackInterface*, uint32_t> >
162 LocalAudioTrackVector; 164 LocalAudioTrackVector;
163 LocalAudioTrackVector local_audio_tracks_; 165 LocalAudioTrackVector local_audio_tracks_;
164 }; 166 };
165 167
166 } // namespace webrtc 168 } // namespace webrtc
167 169
168 #endif // TALK_APP_WEBRTC_STATSCOLLECTOR_H_ 170 #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