- add sources.
[platform/framework/web/crosswalk.git] / src / media / cast / logging / logging_impl.h
1 // Copyright 2013 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 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_
6
7 // Generic class that handles event logging for the cast library.
8 // Logging has three possible optional forms:
9 // 1. Raw data and stats accessible by the application.
10 // 2. UMA stats.
11 // 3. Tracing of raw events.
12
13 #include "media/cast/logging/logging_defines.h"
14 #include "media/cast/logging/logging_raw.h"
15 #include "media/cast/logging/logging_stats.h"
16
17 namespace media {
18 namespace cast {
19
20 class LoggingImpl {
21  public:
22   LoggingImpl(base::TickClock* clock,
23               bool enable_data_collection,
24               bool enable_uma_stats,
25               bool enable_tracing);
26
27   ~LoggingImpl();
28
29   void InsertFrameEvent(CastLoggingEvent event,
30                         uint32 rtp_timestamp,
31                         uint8 frame_id);
32   void InsertFrameEventWithSize(CastLoggingEvent event,
33                                 uint32 rtp_timestamp,
34                                 uint8 frame_id,
35                                 int frame_size);
36   void InsertFrameEventWithDelay(CastLoggingEvent event,
37                                  uint32 rtp_timestamp,
38                                  uint8 frame_id,
39                                  base::TimeDelta delay);
40   void InsertPacketEvent(CastLoggingEvent event,
41                          uint32 rtp_timestamp,
42                          uint8 frame_id,
43                          uint16 packet_id,
44                          uint16 max_packet_id,
45                          int size);
46   void InsertGenericEvent(CastLoggingEvent event, int value);
47
48   // Get raw data.
49   FrameRawMap GetFrameRawData();
50   PacketRawMap GetPacketRawData();
51   GenericRawMap GetGenericRawData();
52   // Get stats only (computed when called). Triggers UMA stats when enabled.
53   const FrameStatsMap* GetFrameStatsData();
54   const PacketStatsMap* GetPacketStatsData();
55   const GenericStatsMap* GetGenericStatsData();
56
57   void Reset();
58
59  private:
60   LoggingRaw raw_;
61   LoggingStats stats_;
62   bool enable_data_collection_;
63   bool enable_uma_stats_;
64   bool enable_tracing_;
65
66   DISALLOW_COPY_AND_ASSIGN(LoggingImpl);
67 };
68
69 }  // namespace cast
70 }  // namespace media
71
72 #endif  // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_