Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Unified Diff: media/cast/logging/encoding_event_subscriber.h

Issue 138913014: Cast: Added a new RawEventSubscriber implementation for use in cast extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed miu's comments and changed targets Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/cast.gyp ('k') | media/cast/logging/encoding_event_subscriber.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/logging/encoding_event_subscriber.h
diff --git a/media/cast/logging/encoding_event_subscriber.h b/media/cast/logging/encoding_event_subscriber.h
new file mode 100644
index 0000000000000000000000000000000000000000..e80061d32422fc8f45834f08ed410c88ebb35965
--- /dev/null
+++ b/media/cast/logging/encoding_event_subscriber.h
@@ -0,0 +1,70 @@
+// Copyright 2014 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_ENCODING_EVENT_SUBSCRIBER_H_
+#define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
+
+#include <map>
+
+#include "base/memory/linked_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "media/cast/logging/proto/raw_events.pb.h"
+#include "media/cast/logging/raw_event_subscriber.h"
+
+namespace media {
+namespace cast {
+
+typedef std::map<RtpTimestamp,
+ linked_ptr<media::cast::proto::AggregatedFrameEvent> >
+ FrameEventMap;
+typedef std::map<RtpTimestamp,
+ linked_ptr<media::cast::proto::AggregatedPacketEvent> >
+ PacketEventMap;
+typedef std::map<CastLoggingEvent,
+ linked_ptr<media::cast::proto::AggregatedGenericEvent> >
+ GenericEventMap;
+
+// A RawEventSubscriber implementation that subscribes to events,
+// encodes them in protocol buffer format, and aggregates them into a more
+// compact structure.
+// TODO(imcheng): Implement event filtering and windowing based on size.
+class EncodingEventSubscriber : public RawEventSubscriber {
+ public:
+ EncodingEventSubscriber();
+
+ virtual ~EncodingEventSubscriber();
+
+ // RawReventSubscriber implementations.
+ virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE;
+ virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE;
+ virtual void OnReceiveGenericEvent(const GenericEvent& generic_event)
+ OVERRIDE;
+
+ // Assigns frame events received so far to |frame_events| and clears them
+ // from this object.
+ void GetFrameEventsAndReset(FrameEventMap* frame_events);
+
+ // Assigns packet events received so far to |packet_events| and clears them
+ // from this object.
+ void GetPacketEventsAndReset(PacketEventMap* packet_events);
+
+ // Assigns generic events received so far to |generic_events| and clears them
+ // from this object.
+ void GetGenericEventsAndReset(GenericEventMap* generic_events);
+
+ private:
+ FrameEventMap frame_event_map_;
+ PacketEventMap packet_event_map_;
+ GenericEventMap generic_event_map_;
+
+ // All functions must be called on the main thread.
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber);
+};
+
+} // namespace cast
+} // namespace media
+
+#endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
« no previous file with comments | « media/cast/cast.gyp ('k') | media/cast/logging/encoding_event_subscriber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698