Remove INJECT_EVENTS permissions from test APKs.
[chromium-blink-merge.git] / media / cast / logging / logging_raw.h
blob49ec98500c616980a096b501891e3049e8181e40
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.
5 #ifndef MEDIA_CAST_LOGGING_LOGGING_RAW_H_
6 #define MEDIA_CAST_LOGGING_LOGGING_RAW_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/threading/non_thread_safe.h"
13 #include "base/time/tick_clock.h"
14 #include "media/cast/logging/logging_defines.h"
15 #include "media/cast/logging/raw_event_subscriber.h"
17 namespace media {
18 namespace cast {
20 // This class is not thread safe, and should only be called from the main
21 // thread.
22 class LoggingRaw : public base::NonThreadSafe {
23 public:
24 LoggingRaw();
25 ~LoggingRaw();
27 // Inform of new event: two types of events: frame and packet.
28 // Frame events can be inserted with different parameters.
29 void InsertFrameEvent(const base::TimeTicks& time_of_event,
30 CastLoggingEvent event, EventMediaType event_media_type,
31 uint32 rtp_timestamp, uint32 frame_id);
33 // Inserts a FRAME_CAPTURE_END event with the VIDEO_EVENT media type.
34 void InsertCapturedVideoFrameEvent(const base::TimeTicks& time_of_event,
35 uint32 rtp_timestamp,
36 int width,
37 int height);
39 // This function is only applicable for FRAME_ENCODED event.
40 // |encoded_size| - Size of encoded frame in bytes.
41 // |key_frame| - Whether the frame is a key frame. This field is only
42 // applicable for video event.
43 // |target_bitrate| - The target bitrate of the encoder the time the frame
44 // was encoded. Only applicable for video event.
45 void InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
46 CastLoggingEvent event,
47 EventMediaType event_media_type,
48 uint32 rtp_timestamp,
49 uint32 frame_id,
50 int encoded_size,
51 bool key_frame,
52 int target_bitrate,
53 double encoder_cpu_utilization,
54 double idealized_bitrate_utilization);
56 // Render/playout delay
57 // This function is only applicable for FRAME_PLAYOUT event.
58 void InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
59 CastLoggingEvent event,
60 EventMediaType event_media_type,
61 uint32 rtp_timestamp,
62 uint32 frame_id, base::TimeDelta delay);
64 // Insert a packet event.
65 void InsertPacketEvent(const base::TimeTicks& time_of_event,
66 CastLoggingEvent event,
67 EventMediaType event_media_type, uint32 rtp_timestamp,
68 uint32 frame_id, uint16 packet_id,
69 uint16 max_packet_id, size_t size);
71 // Adds |subscriber| so that it will start receiving events on main thread.
72 // Note that this class does not own |subscriber|.
73 // It is a no-op to add a subscriber that already exists.
74 void AddSubscriber(RawEventSubscriber* subscriber);
76 // Removes |subscriber| so that it will stop receiving events.
77 // Note that this class does NOT own the subscribers. This function MUST be
78 // called before |subscriber| is destroyed if it was previously added.
79 // It is a no-op to remove a subscriber that doesn't exist.
80 void RemoveSubscriber(RawEventSubscriber* subscriber);
82 private:
83 void InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
84 CastLoggingEvent event,
85 EventMediaType event_media_type,
86 uint32 frame_id,
87 uint32 rtp_timestamp,
88 base::TimeDelta delay,
89 int width,
90 int height,
91 int encoded_size,
92 bool key_frame,
93 int target_bitrate,
94 double encoder_cpu_utilization,
95 double idealized_bitrate_utilization);
97 // List of subscriber pointers. This class does not own the subscribers.
98 std::vector<RawEventSubscriber*> subscribers_;
100 DISALLOW_COPY_AND_ASSIGN(LoggingRaw);
103 } // namespace cast
104 } // namespace media
106 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_