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

Side by Side Diff: media/cast/logging/encoding_event_subscriber.h

Issue 241833002: Cast: Limit number of events/packets in EncodingEventSubscriber protos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ 5 #ifndef MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
6 #define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ 6 #define MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "media/cast/logging/logging_defines.h" 12 #include "media/cast/logging/logging_defines.h"
13 #include "media/cast/logging/proto/raw_events.pb.h" 13 #include "media/cast/logging/proto/raw_events.pb.h"
14 #include "media/cast/logging/raw_event_subscriber.h" 14 #include "media/cast/logging/raw_event_subscriber.h"
15 15
16 namespace media { 16 namespace media {
17 namespace cast { 17 namespace cast {
18 18
19 typedef std::map<RtpTimestamp, 19 typedef std::map<RtpTimestamp,
20 linked_ptr<media::cast::proto::AggregatedFrameEvent> > 20 linked_ptr<media::cast::proto::AggregatedFrameEvent> >
21 FrameEventMap; 21 FrameEventMap;
22 typedef std::map<RtpTimestamp, 22 typedef std::map<RtpTimestamp,
23 linked_ptr<media::cast::proto::AggregatedPacketEvent> > 23 linked_ptr<media::cast::proto::AggregatedPacketEvent> >
24 PacketEventMap; 24 PacketEventMap;
25 25
26 // Number of packets per frame recorded by the subscriber.
27 // Once the max number of packets has been reached, incoming events will be
28 // discarded.
29 const int kMaxPacketsPerFrame = 64;
Alpha Left Google 2014/04/17 22:59:00 This number seems small. Why is this 64? Instead o
imcheng 2014/04/18 00:05:31 How often will we have more than 64 packets per fr
Alpha Left Google 2014/04/21 18:14:04 Sometimes this can happen. A scene change frame ca
imcheng 2014/04/22 01:17:39 ACK. On 2014/04/21 18:14:04, Alpha wrote:
30 // Number of events per proto recorded by the subscriber.
31 // Once the max number of events has been reached, incoming events will be
32 // discarded.
33 const int kMaxEventsPerProto = 16;
Alpha Left Google 2014/04/17 22:59:00 Why is this 16? It seems small..
imcheng 2014/04/18 00:05:31 How about 32? Normally a proto will rarely have mo
Alpha Left Google 2014/04/21 18:14:04 I don't see much value in this limit. This limits
imcheng 2014/04/22 01:17:39 This limits the number of events, this helps keep
34
26 // A RawEventSubscriber implementation that subscribes to events, 35 // A RawEventSubscriber implementation that subscribes to events,
27 // encodes them in protocol buffer format, and aggregates them into a more 36 // encodes them in protocol buffer format, and aggregates them into a more
28 // compact structure. 37 // compact structure.
29 class EncodingEventSubscriber : public RawEventSubscriber { 38 class EncodingEventSubscriber : public RawEventSubscriber {
30 public: 39 public:
31 // |event_media_type|: The subscriber will only process events that 40 // |event_media_type|: The subscriber will only process events that
32 // corresponds to this type. 41 // corresponds to this type.
33 // |max_frames|: How many events to keep in the frame / packet map. 42 // |max_frames|: How many events to keep in the frame / packet map.
34 // This helps keep memory usage bounded. 43 // This helps keep memory usage bounded.
35 // Every time one of |OnReceive[Frame,Packet]Event()| is 44 // Every time one of |OnReceive[Frame,Packet]Event()| is
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Set to RTP timestamp of first event encountered after a |Reset()|. 93 // Set to RTP timestamp of first event encountered after a |Reset()|.
85 RtpTimestamp first_rtp_timestamp_; 94 RtpTimestamp first_rtp_timestamp_;
86 95
87 DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber); 96 DISALLOW_COPY_AND_ASSIGN(EncodingEventSubscriber);
88 }; 97 };
89 98
90 } // namespace cast 99 } // namespace cast
91 } // namespace media 100 } // namespace media
92 101
93 #endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_ 102 #endif // MEDIA_CAST_LOGGING_ENCODING_EVENT_SUBSCRIBER_H_
OLDNEW
« no previous file with comments | « no previous file | media/cast/logging/encoding_event_subscriber.cc » ('j') | media/cast/logging/encoding_event_subscriber.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698