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

Side by Side Diff: media/cast/rtcp/sender_rtcp_event_subscriber.h

Issue 281293002: Cast: Remove SenderRtcpEventSubscriber from cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « media/cast/cast_testing.gypi ('k') | media/cast/rtcp/sender_rtcp_event_subscriber.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAST_RTCP_SENDER_RTCP_EVENT_SUBSCRIBER_H_
6 #define MEDIA_CAST_RTCP_SENDER_RTCP_EVENT_SUBSCRIBER_H_
7
8 #include <map>
9
10 #include "base/threading/thread_checker.h"
11 #include "media/cast/logging/logging_defines.h"
12 #include "media/cast/logging/raw_event_subscriber.h"
13 #include "media/cast/rtcp/rtcp_defines.h"
14
15 namespace media {
16 namespace cast {
17
18 // The key should really be something more than just a RTP timestamp in order
19 // to differentiate between video and audio frames, but since the implementation
20 // only process video frame events, RTP timestamp only as key is fine.
21 typedef std::map<RtpTimestamp, RtcpEvent> RtcpEventMap;
22
23 // A RawEventSubscriber implementation with the following properties:
24 // - Only processes raw event types that are relevant for sending from cast
25 // sender to cast receiver via RTCP.
26 // - Captures information to be sent over to RTCP from raw event logs into the
27 // more compact RtcpEvent struct.
28 // - Orders events by RTP timestamp with a map.
29 // - Internally, the map is capped at a maximum size configurable by the caller.
30 // The subscriber only keeps the most recent events (determined by RTP
31 // timestamp) up to the size limit.
32 class SenderRtcpEventSubscriber : public RawEventSubscriber {
33 public:
34 // |max_size_to_retain|: The object will keep up to |max_size_to_retain|
35 // events
36 // in the map. Once threshold has been reached, an event with the smallest
37 // RTP timestamp will be removed.
38 SenderRtcpEventSubscriber(const size_t max_size_to_retain);
39
40 virtual ~SenderRtcpEventSubscriber();
41
42 // RawEventSubscriber implementation.
43 virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE;
44 virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE;
45
46 // Assigns all collected events since last invocation to |rtcp_events|, and
47 // clears |rtcp_events_|.
48 void GetRtcpEventsAndReset(RtcpEventMap* rtcp_events);
49
50 private:
51 // If |rtcp_events_.size()| exceeds |max_size_to_retain_|, remove an oldest
52 // entry
53 // (determined by RTP timestamp) so its size no greater than
54 // |max_size_to_retain_|.
55 void TruncateMapIfNeeded();
56
57 const size_t max_size_to_retain_;
58 RtcpEventMap rtcp_events_;
59
60 // Ensures methods are only called on the main thread.
61 base::ThreadChecker thread_checker_;
62
63 DISALLOW_COPY_AND_ASSIGN(SenderRtcpEventSubscriber);
64 };
65
66 } // namespace cast
67 } // namespace media
68
69 #endif // MEDIA_CAST_RTCP_SENDER_RTCP_EVENT_SUBSCRIBER_H_
OLDNEW
« no previous file with comments | « media/cast/cast_testing.gypi ('k') | media/cast/rtcp/sender_rtcp_event_subscriber.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698