blob: b941178b63300587f03f21b0c1bb4dda0d79f929 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Handles NACK list and manages ACK.
#ifndef MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_
#define MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_
#include <map>
#include "media/cast/framer/frame_id_map.h"
#include "media/cast/rtcp/rtcp.h"
#include "media/cast/rtp_common/rtp_defines.h"
namespace media {
namespace cast {
class RtpPayloadFeedback;
typedef std::map<uint8, base::TimeTicks> TimeLastNackMap;
class CastMessageBuilder {
public:
CastMessageBuilder(RtpPayloadFeedback* incoming_payload_feedback,
FrameIdMap* frame_id_map,
uint32 media_ssrc,
bool decoder_faster_than_max_frame_rate,
int max_unacked_frames);
~CastMessageBuilder();
void CompleteFrameReceived(uint8 frame_id, bool is_key_frame);
bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send);
void UpdateCastMessage();
void Reset();
void set_clock(base::TickClock* clock) {
clock_ = clock;
}
private:
bool UpdateAckMessage();
void BuildPacketList();
bool UpdateCastMessageInternal(RtcpCastMessage* message);
RtpPayloadFeedback* const cast_feedback_;
// CastMessageBuilder has only const access to the frame id mapper.
const FrameIdMap* const frame_id_map_;
const uint32 media_ssrc_;
const bool decoder_faster_than_max_frame_rate_;
const int max_unacked_frames_;
RtcpCastMessage cast_msg_;
base::TimeTicks last_update_time_;
bool waiting_for_key_frame_;
TimeLastNackMap time_last_nacked_map_;
bool slowing_down_ack_;
bool acked_last_frame_;
uint8 last_acked_frame_id_;
scoped_ptr<base::TickClock> default_tick_clock_;
base::TickClock* clock_;
DISALLOW_COPY_AND_ASSIGN(CastMessageBuilder);
};
} // namespace cast
} // namespace media
#endif // MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_
|