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_
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"
20 // This class is not thread safe, and should only be called from the main
22 class LoggingRaw
: public base::NonThreadSafe
{
27 // Inform of new event: three types of events: frame, packets and generic.
28 // Frame events can be inserted with different parameters.
29 void InsertFrameEvent(const base::TimeTicks
& time_of_event
,
30 CastLoggingEvent event
, uint32 rtp_timestamp
,
33 // Size - Inserting the size implies that this is an encoded frame.
34 // This function is only applicable for the following frame events:
35 // kAudioFrameEncoded, kVideoFrameEncoded
36 void InsertFrameEventWithSize(const base::TimeTicks
& time_of_event
,
37 CastLoggingEvent event
, uint32 rtp_timestamp
,
38 uint32 frame_id
, int size
);
40 // Render/playout delay
41 // This function is only applicable for the following frame events:
42 // kAudioPlayoutDelay, kVideoRenderDelay
43 void InsertFrameEventWithDelay(const base::TimeTicks
& time_of_event
,
44 CastLoggingEvent event
, uint32 rtp_timestamp
,
45 uint32 frame_id
, base::TimeDelta delay
);
47 // Insert a packet event.
48 void InsertPacketEvent(const base::TimeTicks
& time_of_event
,
49 CastLoggingEvent event
, uint32 rtp_timestamp
,
50 uint32 frame_id
, uint16 packet_id
,
51 uint16 max_packet_id
, size_t size
);
53 // Insert a generic event. The interpretation of |value| depends on
55 void InsertGenericEvent(const base::TimeTicks
& time_of_event
,
56 CastLoggingEvent event
, int value
);
58 // Adds |subscriber| so that it will start receiving events on main thread.
59 // Note that this class does not own |subscriber|.
60 // It is a no-op to add a subscriber that already exists.
61 void AddSubscriber(RawEventSubscriber
* subscriber
);
63 // Removes |subscriber| so that it will stop receiving events.
64 // Note that this class does NOT own the subscribers. This function MUST be
65 // called before |subscriber| is destroyed if it was previously added.
66 // It is a no-op to remove a subscriber that doesn't exist.
67 void RemoveSubscriber(RawEventSubscriber
* subscriber
);
70 void InsertBaseFrameEvent(const base::TimeTicks
& time_of_event
,
71 CastLoggingEvent event
, uint32 frame_id
,
72 uint32 rtp_timestamp
, base::TimeDelta delay
,
75 // List of subscriber pointers. This class does not own the subscribers.
76 std::vector
<RawEventSubscriber
*> subscribers_
;
78 DISALLOW_COPY_AND_ASSIGN(LoggingRaw
);
84 #endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_