- add sources.
[platform/framework/web/crosswalk.git] / src / media / cast / rtcp / rtcp_defines.h
1 // Copyright 2013 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_RTCP_DEFINES_H_
6 #define MEDIA_CAST_RTCP_RTCP_DEFINES_H_
7
8 #include <list>
9 #include <map>
10 #include <set>
11
12 #include "media/cast/cast_config.h"
13 #include "media/cast/cast_defines.h"
14
15 namespace media {
16 namespace cast {
17
18 class RtcpCastMessage {
19  public:
20   explicit RtcpCastMessage(uint32 media_ssrc);
21   ~RtcpCastMessage();
22
23   uint32 media_ssrc_;
24   uint8 ack_frame_id_;
25   MissingFramesAndPacketsMap missing_frames_and_packets_;
26 };
27
28 struct RtcpSenderInfo {
29   // First three members are used for lipsync.
30   // First two members are used for rtt.
31   uint32 ntp_seconds;
32   uint32 ntp_fraction;
33   uint32 rtp_timestamp;
34   uint32 send_packet_count;
35   size_t send_octet_count;
36 };
37
38 struct RtcpReportBlock {
39   uint32 remote_ssrc;  // SSRC of sender of this report.
40   uint32 media_ssrc;  // SSRC of the RTP packet sender.
41   uint8 fraction_lost;
42   uint32 cumulative_lost;  // 24 bits valid.
43   uint32 extended_high_sequence_number;
44   uint32 jitter;
45   uint32 last_sr;
46   uint32 delay_since_last_sr;
47 };
48
49 struct RtcpRpsiMessage {
50   uint32 remote_ssrc;
51   uint8 payload_type;
52   uint64 picture_id;
53 };
54
55 class RtcpNackMessage {
56  public:
57   RtcpNackMessage();
58   ~RtcpNackMessage();
59
60   uint32 remote_ssrc;
61   std::list<uint16> nack_list;
62 };
63
64 class RtcpRembMessage {
65  public:
66   RtcpRembMessage();
67   ~RtcpRembMessage();
68
69   uint32 remb_bitrate;
70   std::list<uint32> remb_ssrcs;
71 };
72
73 struct RtcpReceiverReferenceTimeReport {
74   uint32 remote_ssrc;
75   uint32 ntp_seconds;
76   uint32 ntp_fraction;
77 };
78
79 struct RtcpDlrrReportBlock {
80   uint32 last_rr;
81   uint32 delay_since_last_rr;
82 };
83
84 inline bool operator==(RtcpReportBlock lhs, RtcpReportBlock rhs) {
85   return lhs.remote_ssrc == rhs.remote_ssrc &&
86       lhs.media_ssrc == rhs.media_ssrc &&
87       lhs.fraction_lost == rhs.fraction_lost &&
88       lhs.cumulative_lost == rhs.cumulative_lost &&
89       lhs.extended_high_sequence_number == rhs.extended_high_sequence_number &&
90       lhs.jitter == rhs.jitter &&
91       lhs.last_sr == rhs.last_sr &&
92       lhs.delay_since_last_sr == rhs.delay_since_last_sr;
93 }
94
95 inline bool operator==(RtcpSenderInfo lhs, RtcpSenderInfo rhs) {
96   return lhs.ntp_seconds == rhs.ntp_seconds &&
97       lhs.ntp_fraction == rhs.ntp_fraction &&
98       lhs.rtp_timestamp == rhs.rtp_timestamp &&
99       lhs.send_packet_count == rhs.send_packet_count &&
100       lhs.send_octet_count == rhs.send_octet_count;
101 }
102
103 inline bool operator==(RtcpReceiverReferenceTimeReport lhs,
104                        RtcpReceiverReferenceTimeReport rhs) {
105   return lhs.remote_ssrc == rhs.remote_ssrc &&
106       lhs.ntp_seconds == rhs.ntp_seconds &&
107       lhs.ntp_fraction == rhs.ntp_fraction;
108 }
109
110 }  // namespace cast
111 }  // namespace media
112
113 #endif  // MEDIA_CAST_RTCP_RTCP_DEFINES_H_