Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / net / rtcp / rtcp_builder.h
blob2f22c3910fa482888560f0e1b8a4d6e602843378
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.
5 #ifndef MEDIA_CAST_NET_RTCP_RTCP_BUILDER_H_
6 #define MEDIA_CAST_NET_RTCP_RTCP_BUILDER_H_
8 #include <deque>
9 #include <list>
10 #include <string>
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"
19 namespace media {
20 namespace cast {
22 class RtcpBuilder {
23 public:
24 explicit RtcpBuilder(uint32 sending_ssrc);
25 ~RtcpBuilder();
27 PacketRef BuildRtcpFromReceiver(
28 const RtcpReportBlock* report_block,
29 const RtcpReceiverReferenceTimeReport* rrtr,
30 const RtcpCastMessage* cast_message,
31 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
32 base::TimeDelta target_delay);
34 PacketRef BuildRtcpFromSender(const RtcpSenderInfo& sender_info);
36 private:
37 void AddRtcpHeader(RtcpPacketFields payload, int format_or_count);
38 void PatchLengthField();
39 void AddRR(const RtcpReportBlock* report_block);
40 void AddReportBlocks(const RtcpReportBlock& report_block);
41 void AddRrtr(const RtcpReceiverReferenceTimeReport* rrtr);
42 void AddCast(const RtcpCastMessage* cast_message,
43 base::TimeDelta target_delay);
44 void AddSR(const RtcpSenderInfo& sender_info);
45 void AddDlrrRb(const RtcpDlrrReportBlock& dlrr);
46 void AddReceiverLog(
47 const ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events);
49 bool GetRtcpReceiverLogMessage(
50 const ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events,
51 RtcpReceiverLogMessage* receiver_log_message,
52 size_t* total_number_of_messages_to_send);
54 void Start();
55 PacketRef Finish();
57 base::BigEndianWriter writer_;
58 const uint32 ssrc_;
59 char* ptr_of_length_;
60 PacketRef packet_;
62 DISALLOW_COPY_AND_ASSIGN(RtcpBuilder);
65 } // namespace cast
66 } // namespace media
68 #endif // MEDIA_CAST_NET_RTCP_RTCP_SENDER_H_