OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ |
| 6 #define MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ |
| 7 |
| 8 #include "base/threading/thread_checker.h" |
| 9 #include "media/cast/logging/logging_defines.h" |
| 10 #include "media/cast/logging/raw_event_subscriber.h" |
| 11 |
| 12 namespace media { |
| 13 namespace cast { |
| 14 |
| 15 // A RawEventSubscriber implementation that subscribes to events, |
| 16 // and aggregates them into stats. |
| 17 class StatsEventSubscriber : public RawEventSubscriber { |
| 18 public: |
| 19 StatsEventSubscriber(EventMediaType media_type); |
| 20 |
| 21 virtual ~StatsEventSubscriber(); |
| 22 |
| 23 // RawReventSubscriber implementations. |
| 24 virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE; |
| 25 virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE; |
| 26 virtual void OnReceiveGenericEvent(const GenericEvent& generic_event) |
| 27 OVERRIDE; |
| 28 |
| 29 // Assigns |frame_stats_map| with frame stats. |
| 30 void GetFrameStats(FrameStatsMap* frame_stats_map) const; |
| 31 |
| 32 // Assigns |packet_stats_map| with packet stats. |
| 33 void GetPacketStats(PacketStatsMap* packet_stats_map) const; |
| 34 |
| 35 // Assigns |generic_stats_map| with generic stats data. |
| 36 void GetGenericStats(GenericStatsMap* generic_stats_map) const; |
| 37 |
| 38 // Resets all stats maps in this object. |
| 39 void Reset(); |
| 40 |
| 41 private: |
| 42 EventMediaType event_media_type_; |
| 43 FrameStatsMap frame_stats_; |
| 44 PacketStatsMap packet_stats_; |
| 45 GenericStatsMap generic_stats_; |
| 46 base::ThreadChecker thread_checker_; |
| 47 DISALLOW_COPY_AND_ASSIGN(StatsEventSubscriber); |
| 48 }; |
| 49 |
| 50 } // namespace cast |
| 51 } // namespace media |
| 52 |
| 53 #endif // MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ |
OLD | NEW |