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_VIDEO_SENDER_VIDEO_SENDER_H_ | 5 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 6 #define MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "media/cast/cast_config.h" | 15 #include "media/cast/cast_config.h" |
16 #include "media/cast/cast_environment.h" | 16 #include "media/cast/cast_environment.h" |
17 #include "media/cast/congestion_control/congestion_control.h" | 17 #include "media/cast/congestion_control/congestion_control.h" |
18 #include "media/cast/net/rtp_sender/rtp_sender.h" | |
19 #include "media/cast/rtcp/rtcp.h" | 18 #include "media/cast/rtcp/rtcp.h" |
| 19 #include "media/cast/transport/rtp_sender/rtp_sender.h" |
20 | 20 |
21 namespace crypto { | 21 namespace crypto { |
22 class Encryptor; | 22 class Encryptor; |
23 } | 23 } |
24 | 24 |
25 namespace media { | 25 namespace media { |
26 class VideoFrame; | 26 class VideoFrame; |
27 } | 27 } |
28 | 28 |
29 namespace media { | 29 namespace media { |
30 namespace cast { | 30 namespace cast { |
31 | 31 |
32 class VideoEncoder; | 32 class VideoEncoder; |
33 class LocalRtcpVideoSenderFeedback; | 33 class LocalRtcpVideoSenderFeedback; |
34 class LocalRtpVideoSenderStatistics; | 34 class LocalRtpVideoSenderStatistics; |
35 class LocalVideoEncoderCallback; | 35 class LocalVideoEncoderCallback; |
36 class PacedPacketSender; | |
37 | 36 |
38 // Not thread safe. Only called from the main cast thread. | 37 // Not thread safe. Only called from the main cast thread. |
39 // This class owns all objects related to sending video, objects that create RTP | 38 // This class owns all objects related to sending video, objects that create RTP |
40 // packets, congestion control, video encoder, parsing and sending of | 39 // packets, congestion control, video encoder, parsing and sending of |
41 // RTCP packets. | 40 // RTCP packets. |
42 // Additionally it posts a bunch of delayed tasks to the main thread for various | 41 // Additionally it posts a bunch of delayed tasks to the main thread for various |
43 // timeouts. | 42 // timeouts. |
44 class VideoSender : public base::NonThreadSafe, | 43 class VideoSender : public base::NonThreadSafe, |
45 public base::SupportsWeakPtr<VideoSender> { | 44 public base::SupportsWeakPtr<VideoSender> { |
46 public: | 45 public: |
47 VideoSender(scoped_refptr<CastEnvironment> cast_environment, | 46 VideoSender(scoped_refptr<CastEnvironment> cast_environment, |
48 const VideoSenderConfig& video_config, | 47 const VideoSenderConfig& video_config, |
49 VideoEncoderController* const video_encoder_controller, | 48 VideoEncoderController* const video_encoder_controller, |
50 PacedPacketSender* const paced_packet_sender); | 49 transport::PacedPacketSender* const paced_packet_sender); |
51 | 50 |
52 virtual ~VideoSender(); | 51 virtual ~VideoSender(); |
53 | 52 |
54 // The video_frame must be valid until the closure callback is called. | 53 // The video_frame must be valid until the closure callback is called. |
55 // The closure callback is called from the video encoder thread as soon as | 54 // The closure callback is called from the video encoder thread as soon as |
56 // the encoder is done with the frame; it does not mean that the encoded frame | 55 // the encoder is done with the frame; it does not mean that the encoded frame |
57 // has been sent out. | 56 // has been sent out. |
58 void InsertRawVideoFrame( | 57 void InsertRawVideoFrame( |
59 const scoped_refptr<media::VideoFrame>& video_frame, | 58 const scoped_refptr<media::VideoFrame>& video_frame, |
60 const base::TimeTicks& capture_time); | 59 const base::TimeTicks& capture_time); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 EncodedVideoFrame* encrypted_video_frame); | 114 EncodedVideoFrame* encrypted_video_frame); |
116 | 115 |
117 const base::TimeDelta rtp_max_delay_; | 116 const base::TimeDelta rtp_max_delay_; |
118 const int max_frame_rate_; | 117 const int max_frame_rate_; |
119 | 118 |
120 scoped_refptr<CastEnvironment> cast_environment_; | 119 scoped_refptr<CastEnvironment> cast_environment_; |
121 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; | 120 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; |
122 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; | 121 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; |
123 scoped_ptr<VideoEncoder> video_encoder_; | 122 scoped_ptr<VideoEncoder> video_encoder_; |
124 scoped_ptr<Rtcp> rtcp_; | 123 scoped_ptr<Rtcp> rtcp_; |
125 scoped_ptr<RtpSender> rtp_sender_; | 124 scoped_ptr<transport::RtpSender> rtp_sender_; |
126 VideoEncoderController* video_encoder_controller_; | 125 VideoEncoderController* video_encoder_controller_; |
127 uint8 max_unacked_frames_; | 126 uint8 max_unacked_frames_; |
128 scoped_ptr<crypto::Encryptor> encryptor_; | 127 scoped_ptr<crypto::Encryptor> encryptor_; |
129 std::string iv_mask_; | 128 std::string iv_mask_; |
130 int last_acked_frame_id_; | 129 int last_acked_frame_id_; |
131 int last_sent_frame_id_; | 130 int last_sent_frame_id_; |
132 int duplicate_ack_; | 131 int duplicate_ack_; |
133 base::TimeTicks last_send_time_; | 132 base::TimeTicks last_send_time_; |
134 base::TimeTicks last_checked_skip_count_time_; | 133 base::TimeTicks last_checked_skip_count_time_; |
135 int last_skip_count_; | 134 int last_skip_count_; |
136 CongestionControl congestion_control_; | 135 CongestionControl congestion_control_; |
137 | 136 |
138 bool initialized_; | 137 bool initialized_; |
139 base::WeakPtrFactory<VideoSender> weak_factory_; | 138 base::WeakPtrFactory<VideoSender> weak_factory_; |
140 | 139 |
141 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 140 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
142 }; | 141 }; |
143 | 142 |
144 } // namespace cast | 143 } // namespace cast |
145 } // namespace media | 144 } // namespace media |
146 | 145 |
147 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 146 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
148 | 147 |
OLD | NEW |