Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
Alpha Left Google
2014/02/11 22:14:03
Isn't this subscriber specific to Cast Streaming A
Alpha Left Google
2014/02/11 22:49:13
Nevermind my previous comment. Putting it in this
imcheng
2014/02/12 08:44:13
Ack.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ | |
| 6 #define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/memory/linked_ptr.h" | |
| 11 #include "base/single_thread_task_runner.h" | |
| 12 #include "base/threading/thread_checker.h" | |
| 13 #include "media/cast/logging/proto/raw_events.pb.h" | |
| 14 #include "media/cast/logging/raw_event_subscriber.h" | |
| 15 | |
| 16 namespace media { | |
| 17 namespace cast { | |
| 18 | |
| 19 typedef std::map<RtpTimestamp, | |
| 20 linked_ptr<media::cast::proto::AggregatedFrameEvent> > | |
| 21 FrameEventMap; | |
| 22 typedef std::map<RtpTimestamp, | |
| 23 linked_ptr<media::cast::proto::AggregatedPacketEvent> > | |
| 24 PacketEventMap; | |
| 25 typedef std::map<CastLoggingEvent, | |
| 26 linked_ptr<media::cast::proto::AggregatedGenericEvent> > | |
| 27 GenericEventMap; | |
| 28 | |
| 29 // A RawEventSubscriber implementation that subscribes to events, | |
| 30 // encodes them in protocol buffer format, and aggregates them into a more | |
| 31 // compact structure. | |
| 32 // TODO(imcheng): Implement event filtering and windowing based on size. | |
| 33 class EncodingEventSubscriber : public RawEventSubscriber { | |
| 34 public: | |
| 35 // |main_thread_proxy|: Only used for ensuring the subscriber is only called | |
|
Alpha Left Google
2014/02/11 22:49:13
This is not very useful. I suggest you remove this
imcheng
2014/02/12 08:44:13
I suppose that's true. The only difference it will
| |
| 36 // on the main thread. This object does not keep a reference on it. | |
| 37 explicit EncodingEventSubscriber( | |
| 38 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy); | |
| 39 | |
| 40 virtual ~EncodingEventSubscriber(); | |
| 41 | |
| 42 virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE; | |
|
Alpha Left Google
2014/02/11 22:49:13
nit:
// RawReventSubscriber implementations.
imcheng
2014/02/12 08:44:13
Done.
| |
| 43 | |
| 44 virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE; | |
| 45 | |
| 46 virtual void OnReceiveGenericEvent(const GenericEvent& generic_event) | |
| 47 OVERRIDE; | |
| 48 | |
| 49 // Assigns frame events received so far to |frame_events| and clears them | |
| 50 // from this object. | |
| 51 void GetFrameEventsAndReset(FrameEventMap* frame_events); | |
| 52 | |
| 53 // Assigns packet events received so far to |packet_events| and clears them | |
| 54 // from this object. | |
| 55 void GetPacketEventsAndReset(PacketEventMap* packet_events); | |
| 56 | |
| 57 // Assigns generic events received so far to |generic_events| and clears them | |
| 58 // from this object. | |
| 59 void GetGenericEventsAndReset(GenericEventMap* generic_events); | |
| 60 | |
| 61 private: | |
| 62 FrameEventMap frame_event_map_; | |
| 63 PacketEventMap packet_event_map_; | |
| 64 GenericEventMap generic_event_map_; | |
| 65 | |
| 66 // All functions must be called on the main thread. | |
| 67 base::ThreadChecker thread_checker_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber); | |
| 70 }; | |
| 71 | |
| 72 } // namespace cast | |
| 73 } // namespace media | |
| 74 | |
| 75 #endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ | |
| OLD | NEW |