Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: media/cast/rtp_receiver/rtp_parser/rtp_parser.h

Issue 250363002: [Cast] Clean-up RtpCastHeader and RtpParser, removing the last WebRTC dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed hubbe's comment. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 5 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_
6 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 6 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_
7 7
8 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" 8 #include "media/cast/rtp_receiver/rtp_receiver_defines.h"
9 #include "media/cast/transport/cast_transport_defines.h" 9 #include "media/cast/transport/cast_transport_defines.h"
10 10
11 namespace media { 11 namespace media {
12 namespace cast { 12 namespace cast {
13 13
14 struct RtpParserConfig { 14 // TODO(miu): RtpParser and RtpPacketizer should be consolidated into a single
15 RtpParserConfig() { 15 // module that handles all RTP/Cast packet serialization and deserialization
16 ssrc = 0; 16 // throughout the media/cast library.
17 payload_type = 0;
18 audio_channels = 0;
19 }
20
21 uint32 ssrc;
22 int payload_type;
23 transport::AudioCodec audio_codec;
24 transport::VideoCodec video_codec;
25 int audio_channels;
26 };
27
28 class RtpParser { 17 class RtpParser {
29 public: 18 public:
30 RtpParser(const RtpParserConfig parser_config); 19 RtpParser(uint32 expected_sender_ssrc, uint8 expected_payload_type);
31 20
32 virtual ~RtpParser(); 21 virtual ~RtpParser();
33 22
23 // Parses the |packet|, expecting an RTP header along with a Cast header at
24 // the beginning of the the RTP payload. This method populates the structure
25 // pointed to by |rtp_header| and sets the |payload_data| pointer and
26 // |payload_size| to the memory region within |packet| containing the Cast
27 // payload data. Returns false if the data appears to be invalid, is not from
28 // the expected sender (as identified by the SSRC field), or is not the
29 // expected payload type.
34 bool ParsePacket(const uint8* packet, 30 bool ParsePacket(const uint8* packet,
35 size_t length, 31 size_t length,
36 RtpCastHeader* rtp_header); 32 RtpCastHeader* rtp_header,
37 protected: 33 const uint8** payload_data,
38 virtual void OnReceivedPayloadData(const uint8* payload_data, 34 size_t* payload_size);
39 size_t payload_size, 35
40 const RtpCastHeader& rtp_header) = 0;
41 private: 36 private:
42 bool ParseCommon(const uint8* packet, 37 const uint32 expected_sender_ssrc_;
43 size_t length, 38 const uint8 expected_payload_type_;
44 RtpCastHeader* rtp_header);
45
46 bool ParseCast(const uint8* packet, size_t length, RtpCastHeader* rtp_header);
47
48 RtpParserConfig parser_config_;
49 transport::FrameIdWrapHelper frame_id_wrap_helper_; 39 transport::FrameIdWrapHelper frame_id_wrap_helper_;
50 transport::FrameIdWrapHelper reference_frame_id_wrap_helper_;
51 40
52 DISALLOW_COPY_AND_ASSIGN(RtpParser); 41 DISALLOW_COPY_AND_ASSIGN(RtpParser);
53 }; 42 };
54 43
55 } // namespace cast 44 } // namespace cast
56 } // namespace media 45 } // namespace media
57 46
58 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ 47 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_
OLDNEW
« no previous file with comments | « media/cast/rtp_receiver/receiver_stats_unittest.cc ('k') | media/cast/rtp_receiver/rtp_parser/rtp_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698