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

Side by Side Diff: media/cast/net/rtcp/rtcp_builder.h

Issue 541293004: Revert of Cast: Re-factor rtcp_sender.cc into rtcp_builder.cc and do some cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/net/rtcp/rtcp.cc ('k') | media/cast/net/rtcp/rtcp_builder.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_NET_RTCP_RTCP_BUILDER_H_
6 #define MEDIA_CAST_NET_RTCP_RTCP_BUILDER_H_
7
8 #include <deque>
9 #include <list>
10 #include <string>
11
12 #include "base/big_endian.h"
13 #include "media/cast/cast_config.h"
14 #include "media/cast/cast_defines.h"
15 #include "media/cast/net/cast_transport_defines.h"
16 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
17 #include "media/cast/net/rtcp/rtcp_defines.h"
18
19 namespace media {
20 namespace cast {
21
22 // We limit the size of receiver logs to avoid queuing up packets.
23 const size_t kMaxReceiverLogBytes = 200;
24
25 // The determines how long to hold receiver log events, based on how
26 // many "receiver log message reports" ago the events were sent.
27 const size_t kReceiveLogMessageHistorySize = 20;
28
29 // This determines when to send events the second time.
30 const size_t kFirstRedundancyOffset = 10;
31 COMPILE_ASSERT(kFirstRedundancyOffset > 0 &&
32 kFirstRedundancyOffset <= kReceiveLogMessageHistorySize,
33 redundancy_offset_out_of_range);
34
35 // When to send events the third time.
36 const size_t kSecondRedundancyOffset = 20;
37 COMPILE_ASSERT(kSecondRedundancyOffset >
38 kFirstRedundancyOffset && kSecondRedundancyOffset <=
39 kReceiveLogMessageHistorySize,
40 redundancy_offset_out_of_range);
41
42
43 class RtcpBuilder {
44 public:
45 explicit RtcpBuilder(uint32 sending_ssrc);
46 ~RtcpBuilder();
47
48 PacketRef BuildRtcpFromReceiver(
49 const RtcpReportBlock* report_block,
50 const RtcpReceiverReferenceTimeReport* rrtr,
51 const RtcpCastMessage* cast_message,
52 const ReceiverRtcpEventSubscriber::RtcpEventMultiMap* rtcp_events,
53 base::TimeDelta target_delay);
54
55 PacketRef BuildRtcpFromSender(const RtcpSenderInfo& sender_info);
56
57 private:
58 void AddRtcpHeader(RtcpPacketFields payload, int format_or_count);
59 void PatchLengthField();
60 void AddRR(const RtcpReportBlock* report_block);
61 void AddReportBlocks(const RtcpReportBlock& report_block);
62 void AddRrtr(const RtcpReceiverReferenceTimeReport* rrtr);
63 void AddCast(const RtcpCastMessage* cast_message,
64 base::TimeDelta target_delay);
65 void AddSR(const RtcpSenderInfo& sender_info);
66 void AddDlrrRb(const RtcpDlrrReportBlock& dlrr);
67 void AddReceiverLog(
68 const ReceiverRtcpEventSubscriber::RtcpEventMultiMap& rtcp_events);
69
70 bool GetRtcpReceiverLogMessage(
71 const ReceiverRtcpEventSubscriber::RtcpEventMultiMap& rtcp_events,
72 RtcpReceiverLogMessage* receiver_log_message,
73 size_t* total_number_of_messages_to_send);
74
75 void Start();
76 PacketRef Finish();
77
78 base::BigEndianWriter writer_;
79 const uint32 ssrc_;
80 char* ptr_of_length_;
81 PacketRef packet_;
82 std::deque<RtcpReceiverLogMessage> rtcp_events_history_;
83
84 DISALLOW_COPY_AND_ASSIGN(RtcpBuilder);
85 };
86
87 } // namespace cast
88 } // namespace media
89
90 #endif // MEDIA_CAST_NET_RTCP_RTCP_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/net/rtcp/rtcp.cc ('k') | media/cast/net/rtcp/rtcp_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698