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 // This file contains the interface to the cast RTP sender. | 5 // This file contains the interface to the cast RTP sender. |
6 | 6 |
7 #ifndef MEDIA_CAST_NET_RTP_SENDER_RTP_SENDER_H_ | 7 #ifndef MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_SENDER_H_ |
8 #define MEDIA_CAST_NET_RTP_SENDER_RTP_SENDER_H_ | 8 #define MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_SENDER_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/tick_clock.h" | 14 #include "base/time/tick_clock.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/cast/cast_config.h" | 16 #include "media/cast/cast_config.h" |
17 #include "media/cast/cast_environment.h" | 17 #include "media/cast/cast_environment.h" |
18 #include "media/cast/net/rtp_sender/packet_storage/packet_storage.h" | 18 #include "media/cast/transport/rtp_sender/packet_storage/packet_storage.h" |
19 #include "media/cast/net/rtp_sender/rtp_packetizer/rtp_packetizer.h" | 19 #include "media/cast/transport/rtp_sender/rtp_packetizer/rtp_packetizer.h" |
20 #include "media/cast/net/rtp_sender/rtp_packetizer/rtp_packetizer_config.h" | |
21 | 20 |
22 namespace media { | 21 namespace media { |
23 namespace cast { | 22 namespace cast { |
| 23 namespace transport { |
24 | 24 |
25 class PacedPacketSender; | 25 class PacedPacketSender; |
26 struct RtcpSenderInfo; | |
27 | 26 |
28 // This object is only called from the main cast thread. | 27 // This object is only called from the main cast thread. |
29 // This class handles splitting encoded audio and video frames into packets and | 28 // This class handles splitting encoded audio and video frames into packets and |
30 // add an RTP header to each packet. The sent packets are stored until they are | 29 // add an RTP header to each packet. The sent packets are stored until they are |
31 // acknowledged by the remote peer or timed out. | 30 // acknowledged by the remote peer or timed out. |
32 class RtpSender { | 31 class RtpSender { |
33 public: | 32 public: |
34 RtpSender(scoped_refptr<CastEnvironment> cast_environment, | 33 RtpSender(scoped_refptr<CastEnvironment> cast_environment, |
35 const AudioSenderConfig* audio_config, | 34 const AudioSenderConfig* audio_config, |
36 const VideoSenderConfig* video_config, | 35 const VideoSenderConfig* video_config, |
37 PacedPacketSender* transport); | 36 PacedPacketSender* transport); |
38 | 37 |
39 ~RtpSender(); | 38 ~RtpSender(); |
40 | 39 |
41 // The video_frame objects ownership is handled by the main cast thread. | 40 // The video_frame objects ownership is handled by the main cast thread. |
42 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 41 void IncomingEncodedVideoFrame(const EncodedVideoFrame* video_frame, |
43 const base::TimeTicks& capture_time); | 42 const base::TimeTicks& capture_time); |
44 | 43 |
45 // The audio_frame objects ownership is handled by the main cast thread. | 44 // The audio_frame objects ownership is handled by the main cast thread. |
46 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, | 45 void IncomingEncodedAudioFrame(const EncodedAudioFrame* audio_frame, |
47 const base::TimeTicks& recorded_time); | 46 const base::TimeTicks& recorded_time); |
48 | 47 |
49 void ResendPackets(const MissingFramesAndPacketsMap& missing_packets); | 48 void ResendPackets(const MissingFramesAndPacketsMap& missing_packets); |
50 | 49 |
51 void RtpStatistics(const base::TimeTicks& now, RtcpSenderInfo* sender_info); | 50 void RtpStatistics(const base::TimeTicks& now, |
| 51 media::cast::RtcpSenderInfo* sender_info); |
52 | 52 |
53 private: | 53 private: |
54 void UpdateSequenceNumber(std::vector<uint8>* packet); | 54 void UpdateSequenceNumber(std::vector<uint8>* packet); |
55 | 55 |
56 scoped_refptr<CastEnvironment> cast_environment_; | 56 scoped_refptr<CastEnvironment> cast_environment_; |
57 RtpPacketizerConfig config_; | 57 RtpPacketizerConfig config_; |
58 scoped_ptr<RtpPacketizer> packetizer_; | 58 scoped_ptr<RtpPacketizer> packetizer_; |
59 scoped_ptr<PacketStorage> storage_; | 59 scoped_ptr<PacketStorage> storage_; |
60 PacedPacketSender* transport_; | 60 PacedPacketSender* transport_; |
61 }; | 61 }; |
62 | 62 |
| 63 } // namespace transport |
63 } // namespace cast | 64 } // namespace cast |
64 } // namespace media | 65 } // namespace media |
65 | 66 |
66 #endif // MEDIA_CAST_NET_RTP_SENDER_RTP_SENDER_H_ | 67 #endif // MEDIA_CAST_TRANSPORT_RTP_SENDER_RTP_SENDER_H_ |
OLD | NEW |