| OLD | NEW |
| 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_NET_RTP_RTP_PARSER_H_ |
| 6 #define MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ | 6 #define MEDIA_CAST_NET_RTP_RTP_PARSER_H_ |
| 7 | 7 |
| 8 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" | 8 #include "media/cast/net/cast_transport_defines.h" |
| 9 #include "media/cast/transport/cast_transport_defines.h" | 9 #include "media/cast/net/rtp/rtp_receiver_defines.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 namespace cast { | 12 namespace cast { |
| 13 | 13 |
| 14 // TODO(miu): RtpParser and RtpPacketizer should be consolidated into a single | 14 // TODO(miu): RtpParser and RtpPacketizer should be consolidated into a single |
| 15 // module that handles all RTP/Cast packet serialization and deserialization | 15 // module that handles all RTP/Cast packet serialization and deserialization |
| 16 // throughout the media/cast library. | 16 // throughout the media/cast library. |
| 17 class RtpParser { | 17 class RtpParser { |
| 18 public: | 18 public: |
| 19 RtpParser(uint32 expected_sender_ssrc, uint8 expected_payload_type); | 19 RtpParser(uint32 expected_sender_ssrc, uint8 expected_payload_type); |
| 20 | 20 |
| 21 virtual ~RtpParser(); | 21 virtual ~RtpParser(); |
| 22 | 22 |
| 23 // Parses the |packet|, expecting an RTP header along with a Cast header at | 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 | 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 | 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 | 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 | 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 | 28 // the expected sender (as identified by the SSRC field), or is not the |
| 29 // expected payload type. | 29 // expected payload type. |
| 30 bool ParsePacket(const uint8* packet, | 30 bool ParsePacket(const uint8* packet, |
| 31 size_t length, | 31 size_t length, |
| 32 RtpCastHeader* rtp_header, | 32 RtpCastHeader* rtp_header, |
| 33 const uint8** payload_data, | 33 const uint8** payload_data, |
| 34 size_t* payload_size); | 34 size_t* payload_size); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 const uint32 expected_sender_ssrc_; | 37 const uint32 expected_sender_ssrc_; |
| 38 const uint8 expected_payload_type_; | 38 const uint8 expected_payload_type_; |
| 39 transport::FrameIdWrapHelper frame_id_wrap_helper_; | 39 FrameIdWrapHelper frame_id_wrap_helper_; |
| 40 | 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(RtpParser); | 41 DISALLOW_COPY_AND_ASSIGN(RtpParser); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace cast | 44 } // namespace cast |
| 45 } // namespace media | 45 } // namespace media |
| 46 | 46 |
| 47 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_PARSER_RTP_PARSER_H_ | 47 #endif // MEDIA_CAST_NET_RTP_RTP_PARSER_H_ |
| OLD | NEW |