summaryrefslogtreecommitdiff
path: root/media/cast/logging/logging_raw.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/cast/logging/logging_raw.h')
-rw-r--r--media/cast/logging/logging_raw.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/media/cast/logging/logging_raw.h b/media/cast/logging/logging_raw.h
new file mode 100644
index 0000000000..91de12aaaa
--- /dev/null
+++ b/media/cast/logging/logging_raw.h
@@ -0,0 +1,85 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CAST_LOGGING_LOGGING_RAW_H_
+#define MEDIA_CAST_LOGGING_LOGGING_RAW_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/linked_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/non_thread_safe.h"
+#include "base/time/tick_clock.h"
+#include "media/cast/logging/logging_defines.h"
+
+namespace media {
+namespace cast {
+
+// This class is not thread safe, and should only be called from the main
+// thread.
+class LoggingRaw : public base::NonThreadSafe,
+ public base::SupportsWeakPtr<LoggingRaw> {
+ public:
+ explicit LoggingRaw(base::TickClock* clock);
+ ~LoggingRaw();
+
+ // Inform of new event: three types of events: frame, packets and generic.
+ // Frame events can be inserted with different parameters.
+ void InsertFrameEvent(CastLoggingEvent event,
+ uint32 rtp_timestamp,
+ uint8 frame_id);
+
+ // Size - Inserting the size implies that this is an encoded frame.
+ void InsertFrameEventWithSize(CastLoggingEvent event,
+ uint32 rtp_timestamp,
+ uint8 frame_id,
+ int frame_size);
+
+ // Render/playout delay
+ void InsertFrameEventWithDelay(CastLoggingEvent event,
+ uint32 rtp_timestamp,
+ uint8 frame_id,
+ base::TimeDelta delay);
+
+ // Insert a packet event.
+ void InsertPacketEvent(CastLoggingEvent event,
+ uint32 rtp_timestamp,
+ uint8 frame_id,
+ uint16 packet_id,
+ uint16 max_packet_id,
+ int size);
+
+ void InsertGenericEvent(CastLoggingEvent event, int value);
+
+ // Get raw log data.
+ FrameRawMap GetFrameData() const;
+ PacketRawMap GetPacketData() const;
+ GenericRawMap GetGenericData() const;
+
+
+ // Reset all log data.
+ void Reset();
+
+ private:
+ void InsertBaseFrameEvent(CastLoggingEvent event,
+ uint8 frame_id,
+ uint32 rtp_timestamp);
+
+ base::WeakPtrFactory<LoggingRaw> weak_factory_;
+ base::TickClock* const clock_; // Not owned by this class.
+ FrameRawMap frame_map_;
+ PacketRawMap packet_map_;
+ GenericRawMap generic_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoggingRaw);
+};
+
+} // namespace cast
+} // namespace media
+
+#endif // MEDIA_CAST_LOGGING_LOGGING_RAW_H_
+