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 // Interface to the rtp receiver. | 5 // Interface to the rtp receiver. |
6 | 6 |
7 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ | 7 #ifndef MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ |
8 #define MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ | 8 #define MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "media/cast/cast_config.h" | 11 #include "media/cast/cast_config.h" |
12 #include "media/cast/rtcp/rtcp.h" | 12 #include "media/cast/rtcp/rtcp.h" |
13 #include "media/cast/rtp_receiver/receiver_stats.h" | 13 #include "media/cast/rtp_receiver/receiver_stats.h" |
14 #include "media/cast/rtp_receiver/rtp_parser/rtp_parser.h" | 14 #include "media/cast/rtp_receiver/rtp_parser/rtp_parser.h" |
15 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" | 15 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 namespace cast { | 18 namespace cast { |
19 | 19 |
20 // TODO(miu): This is a good candidate to contain common functionality that's | 20 // TODO(miu): This is a good candidate to contain common functionality that's |
21 // identical in both AudioReceiver and VideoReceiver. | 21 // identical in both AudioReceiver and VideoReceiver. |
22 class RtpReceiver { | 22 class RtpReceiver { |
23 public: | 23 public: |
24 RtpReceiver(base::TickClock* clock, | 24 RtpReceiver(base::TickClock* clock, |
25 const AudioReceiverConfig* audio_config, | 25 const FrameReceiverConfig* audio_config, |
26 const VideoReceiverConfig* video_config); | 26 const FrameReceiverConfig* video_config); |
27 virtual ~RtpReceiver(); | 27 virtual ~RtpReceiver(); |
28 | 28 |
29 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); | 29 static uint32 GetSsrcOfSender(const uint8* rtcp_buffer, size_t length); |
30 | 30 |
31 bool ReceivedPacket(const uint8* packet, size_t length); | 31 bool ReceivedPacket(const uint8* packet, size_t length); |
32 | 32 |
33 RtpReceiverStatistics* GetStatistics() { | 33 RtpReceiverStatistics* GetStatistics() { |
34 return &stats_; | 34 return &stats_; |
35 } | 35 } |
36 | 36 |
37 protected: | 37 protected: |
38 // Subclasses implement this to consume and process deserialized packets. | 38 // Subclasses implement this to consume and process deserialized packets. |
39 virtual void OnReceivedPayloadData(const uint8* payload_data, | 39 virtual void OnReceivedPayloadData(const uint8* payload_data, |
40 size_t payload_size, | 40 size_t payload_size, |
41 const RtpCastHeader& rtp_header) = 0; | 41 const RtpCastHeader& rtp_header) = 0; |
42 | 42 |
43 private: | 43 private: |
44 RtpParser packet_parser_; | 44 RtpParser packet_parser_; |
45 ReceiverStats stats_; | 45 ReceiverStats stats_; |
46 | 46 |
47 DISALLOW_COPY_AND_ASSIGN(RtpReceiver); | 47 DISALLOW_COPY_AND_ASSIGN(RtpReceiver); |
48 }; | 48 }; |
49 | 49 |
50 } // namespace cast | 50 } // namespace cast |
51 } // namespace media | 51 } // namespace media |
52 | 52 |
53 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ | 53 #endif // MEDIA_CAST_RTP_RECEIVER_RTP_RECEIVER_H_ |
OLD | NEW |