| 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_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "third_party/webrtc/api/peerconnectioninterface.h" | 15 #include "third_party/webrtc/api/peerconnectioninterface.h" |
| 16 | 16 |
| 17 namespace webrtc { | 17 namespace webrtc { |
| 18 class MediaStreamInterface; | 18 class MediaStreamInterface; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 | 22 |
| 23 class MediaStreamTrackMetricsObserver; | 23 class MediaStreamTrackMetricsObserver; |
| 24 class RTCPeerConnectionHandler; | 24 class RTCPeerConnectionHandler; |
| 25 | 25 |
| 26 // Responsible for observing the connected lifetimes of tracks going | 26 // Responsible for observing the connected lifetimes of tracks going |
| 27 // over a PeerConnection, and sending messages to the browser process | 27 // over a PeerConnection, and sending messages to the browser process |
| 28 // about lifetime events. | 28 // about lifetime events. |
| 29 // | 29 // |
| 30 // There should be exactly one of these objects owned by each | 30 // There should be exactly one of these objects owned by each |
| 31 // RTCPeerConnectionHandler, and its lifetime should match the | 31 // RTCPeerConnectionHandler, and its lifetime should match the |
| 32 // lifetime of its owner. | 32 // lifetime of its owner. |
| 33 class CONTENT_EXPORT MediaStreamTrackMetrics : public base::NonThreadSafe { | 33 class CONTENT_EXPORT MediaStreamTrackMetrics { |
| 34 public: | 34 public: |
| 35 explicit MediaStreamTrackMetrics(); | 35 explicit MediaStreamTrackMetrics(); |
| 36 ~MediaStreamTrackMetrics(); | 36 ~MediaStreamTrackMetrics(); |
| 37 | 37 |
| 38 enum StreamType { SENT_STREAM, RECEIVED_STREAM }; | 38 enum StreamType { SENT_STREAM, RECEIVED_STREAM }; |
| 39 | 39 |
| 40 enum TrackType { AUDIO_TRACK, VIDEO_TRACK }; | 40 enum TrackType { AUDIO_TRACK, VIDEO_TRACK }; |
| 41 | 41 |
| 42 enum LifetimeEvent { CONNECTED, DISCONNECTED }; | 42 enum LifetimeEvent { CONNECTED, DISCONNECTED }; |
| 43 | 43 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // Make a unique ID for the given track, that is valid while the | 91 // Make a unique ID for the given track, that is valid while the |
| 92 // track object and the PeerConnection it is attached to both exist. | 92 // track object and the PeerConnection it is attached to both exist. |
| 93 uint64_t MakeUniqueId(const std::string& track, StreamType stream_type); | 93 uint64_t MakeUniqueId(const std::string& track, StreamType stream_type); |
| 94 | 94 |
| 95 typedef std::vector<std::unique_ptr<MediaStreamTrackMetricsObserver>> | 95 typedef std::vector<std::unique_ptr<MediaStreamTrackMetricsObserver>> |
| 96 ObserverVector; | 96 ObserverVector; |
| 97 ObserverVector observers_; | 97 ObserverVector observers_; |
| 98 | 98 |
| 99 webrtc::PeerConnectionInterface::IceConnectionState ice_state_; | 99 webrtc::PeerConnectionInterface::IceConnectionState ice_state_; |
| 100 | 100 |
| 101 SEQUENCE_CHECKER(sequence_checker_); |
| 102 |
| 101 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackMetrics); | 103 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackMetrics); |
| 102 }; | 104 }; |
| 103 | 105 |
| 104 } // namespace | 106 } // namespace |
| 105 | 107 |
| 106 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ | 108 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_TRACK_METRICS_H_ |
| OLD | NEW |