OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ | 5 #ifndef MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ |
6 #define MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ | 6 #define MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "media/cast/net/cast_transport_config.h" | 11 #include "media/cast/net/cast_transport_config.h" |
12 #include "media/cast/net/rtp/rtp_defines.h" | 12 #include "media/cast/net/rtp/rtp_defines.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 namespace cast { | 15 namespace cast { |
16 | 16 |
17 typedef std::map<uint16, std::vector<uint8> > PacketMap; | 17 typedef std::map<uint16_t, std::vector<uint8_t>> PacketMap; |
18 | 18 |
19 class FrameBuffer { | 19 class FrameBuffer { |
20 public: | 20 public: |
21 FrameBuffer(); | 21 FrameBuffer(); |
22 ~FrameBuffer(); | 22 ~FrameBuffer(); |
23 bool InsertPacket(const uint8* payload_data, | 23 bool InsertPacket(const uint8_t* payload_data, |
24 size_t payload_size, | 24 size_t payload_size, |
25 const RtpCastHeader& rtp_header); | 25 const RtpCastHeader& rtp_header); |
26 bool Complete() const; | 26 bool Complete() const; |
27 | 27 |
28 void GetMissingPackets(bool newest_frame, PacketIdSet* missing_packets) const; | 28 void GetMissingPackets(bool newest_frame, PacketIdSet* missing_packets) const; |
29 | 29 |
30 // If a frame is complete, sets the frame IDs and RTP timestamp in |frame|, | 30 // If a frame is complete, sets the frame IDs and RTP timestamp in |frame|, |
31 // and also copies the data from all packets into the data field in |frame|. | 31 // and also copies the data from all packets into the data field in |frame|. |
32 // Returns true if the frame was complete; false if incomplete and |frame| | 32 // Returns true if the frame was complete; false if incomplete and |frame| |
33 // remains unchanged. | 33 // remains unchanged. |
34 bool AssembleEncodedFrame(EncodedFrame* frame) const; | 34 bool AssembleEncodedFrame(EncodedFrame* frame) const; |
35 | 35 |
36 bool is_key_frame() const { return is_key_frame_; } | 36 bool is_key_frame() const { return is_key_frame_; } |
37 uint32 last_referenced_frame_id() const { return last_referenced_frame_id_; } | 37 uint32_t last_referenced_frame_id() const { |
38 uint32 frame_id() const { return frame_id_; } | 38 return last_referenced_frame_id_; |
| 39 } |
| 40 uint32_t frame_id() const { return frame_id_; } |
39 | 41 |
40 private: | 42 private: |
41 uint32 frame_id_; | 43 uint32_t frame_id_; |
42 uint16 max_packet_id_; | 44 uint16_t max_packet_id_; |
43 uint16 num_packets_received_; | 45 uint16_t num_packets_received_; |
44 uint16 max_seen_packet_id_; | 46 uint16_t max_seen_packet_id_; |
45 uint16 new_playout_delay_ms_; | 47 uint16_t new_playout_delay_ms_; |
46 bool is_key_frame_; | 48 bool is_key_frame_; |
47 size_t total_data_size_; | 49 size_t total_data_size_; |
48 uint32 last_referenced_frame_id_; | 50 uint32_t last_referenced_frame_id_; |
49 uint32 rtp_timestamp_; | 51 uint32_t rtp_timestamp_; |
50 PacketMap packets_; | 52 PacketMap packets_; |
51 | 53 |
52 DISALLOW_COPY_AND_ASSIGN(FrameBuffer); | 54 DISALLOW_COPY_AND_ASSIGN(FrameBuffer); |
53 }; | 55 }; |
54 | 56 |
55 } // namespace cast | 57 } // namespace cast |
56 } // namespace media | 58 } // namespace media |
57 | 59 |
58 #endif // MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ | 60 #endif // MEDIA_CAST_NET_RTP_FRAME_BUFFER_H_ |
OLD | NEW |