Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / cast / net / rtp / rtp_header_parser.h
blobfd235c2aa59bdab11e1ae17f3aac403736b295b5
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 // Utility parser for rtp packetizer unittests
6 #ifndef MEDIA_CAST_NET_RTP_RTP_HEADER_PARSER_H_
7 #define MEDIA_CAST_NET_RTP_RTP_HEADER_PARSER_H_
9 #include "base/basictypes.h"
10 #include "media/cast/net/cast_transport_defines.h"
12 namespace media {
13 namespace cast {
15 // TODO(miu): Kill this and use RtpCastHeader instead.
16 struct RtpCastTestHeader {
17 RtpCastTestHeader();
18 ~RtpCastTestHeader();
19 // Cast specific.
20 bool is_key_frame;
21 uint32 frame_id;
22 uint16 packet_id;
23 uint16 max_packet_id;
24 bool is_reference; // Set to true if the previous frame is not available,
25 // and the reference frame id is available.
26 uint32 reference_frame_id;
28 // Rtp Generic.
29 bool marker;
30 uint16 sequence_number;
31 uint32 rtp_timestamp;
32 uint32 ssrc;
33 int payload_type;
34 uint8 num_csrcs;
35 uint8 audio_num_energy;
36 int header_length;
39 // TODO(miu): Kill this and use RtpParser instead.
40 class RtpHeaderParser {
41 public:
42 RtpHeaderParser(const uint8* rtpData, size_t rtpDataLength);
43 ~RtpHeaderParser();
45 bool Parse(RtpCastTestHeader* parsed_packet) const;
47 private:
48 bool ParseCommon(RtpCastTestHeader* parsed_packet) const;
49 bool ParseCast(RtpCastTestHeader* parsed_packet) const;
50 const uint8* const rtp_data_begin_;
51 size_t length_;
53 mutable FrameIdWrapHelper frame_id_wrap_helper_;
54 mutable FrameIdWrapHelper reference_frame_id_wrap_helper_;
56 DISALLOW_COPY_AND_ASSIGN(RtpHeaderParser);
59 } // namespace cast
60 } // namespace media
62 #endif // MEDIA_CAST_NET_RTP_RTP_HEADER_PARSER_H_