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_RTCP_RTCP_DEFINES_H_
6 #define MEDIA_CAST_RTCP_RTCP_DEFINES_H_
11 #include "media/cast/cast_config.h"
12 #include "media/cast/cast_defines.h"
13 #include "media/cast/logging/logging_defines.h"
14 #include "media/cast/net/cast_transport_defines.h"
19 static const size_t kRtcpCastLogHeaderSize
= 12;
20 static const size_t kRtcpReceiverFrameLogSize
= 8;
21 static const size_t kRtcpReceiverEventLogSize
= 4;
23 // Handle the per frame ACK and NACK messages.
24 struct RtcpCastMessage
{
25 explicit RtcpCastMessage(uint32 ssrc
);
31 uint16 target_delay_ms
;
32 MissingFramesAndPacketsMap missing_frames_and_packets
;
35 // Log messages from receiver to sender.
36 struct RtcpReceiverEventLogMessage
{
37 RtcpReceiverEventLogMessage();
38 ~RtcpReceiverEventLogMessage();
40 CastLoggingEvent type
;
41 base::TimeTicks event_timestamp
;
42 base::TimeDelta delay_delta
;
46 typedef std::list
<RtcpReceiverEventLogMessage
> RtcpReceiverEventLogMessages
;
48 struct RtcpReceiverFrameLogMessage
{
49 explicit RtcpReceiverFrameLogMessage(uint32 rtp_timestamp
);
50 ~RtcpReceiverFrameLogMessage();
52 uint32 rtp_timestamp_
;
53 RtcpReceiverEventLogMessages event_log_messages_
;
55 // TODO(mikhal): Investigate what's the best way to allow adding
56 // DISALLOW_COPY_AND_ASSIGN, as currently it contradicts the implementation
57 // and possible changes have a big impact on design.
60 typedef std::list
<RtcpReceiverFrameLogMessage
> RtcpReceiverLogMessage
;
62 struct RtcpNackMessage
{
67 std::list
<uint16
> nack_list
;
69 DISALLOW_COPY_AND_ASSIGN(RtcpNackMessage
);
72 struct RtcpReceiverReferenceTimeReport
{
73 RtcpReceiverReferenceTimeReport();
74 ~RtcpReceiverReferenceTimeReport();
81 inline bool operator==(RtcpReceiverReferenceTimeReport lhs
,
82 RtcpReceiverReferenceTimeReport rhs
) {
83 return lhs
.remote_ssrc
== rhs
.remote_ssrc
&&
84 lhs
.ntp_seconds
== rhs
.ntp_seconds
&&
85 lhs
.ntp_fraction
== rhs
.ntp_fraction
;
88 // Struct used by raw event subscribers as an intermediate format before
89 // sending off to the other side via RTCP.
90 // (i.e., {Sender,Receiver}RtcpEventSubscriber)
95 CastLoggingEvent type
;
97 // Time of event logged.
98 base::TimeTicks timestamp
;
100 // Render/playout delay. Only set for FRAME_PLAYOUT events.
101 base::TimeDelta delay_delta
;
103 // Only set for packet events.
107 typedef base::Callback
<void(const RtcpCastMessage
&)> RtcpCastMessageCallback
;
108 typedef base::Callback
<void(base::TimeDelta
)> RtcpRttCallback
;
110 base::Callback
<void(const RtcpReceiverLogMessage
&)> RtcpLogMessageCallback
;
112 // TODO(hubbe): Document members of this struct.
113 struct RtpReceiverStatistics
{
114 RtpReceiverStatistics();
116 uint32 cumulative_lost
; // 24 bits valid.
117 uint32 extended_high_sequence_number
;
121 // These are intended to only be created using Rtcp::ConvertToNTPAndSave.
122 struct RtcpTimeData
{
125 base::TimeTicks timestamp
;
128 // This struct is used to encapsulate all the parameters of the
129 // SendRtcpFromRtpReceiver for IPC transportation.
130 struct SendRtcpFromRtpReceiver_Params
{
131 SendRtcpFromRtpReceiver_Params();
132 ~SendRtcpFromRtpReceiver_Params();
135 RtcpTimeData time_data
;
136 scoped_ptr
<RtcpCastMessage
> cast_message
;
137 base::TimeDelta target_delay
;
138 scoped_ptr
<std::vector
<std::pair
<RtpTimestamp
, RtcpEvent
> > > rtcp_events
;
139 scoped_ptr
<RtpReceiverStatistics
> rtp_receiver_statistics
;
146 #endif // MEDIA_CAST_RTCP_RTCP_DEFINES_H_