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/rtcp/rtcp.h" | 18 #include "media/cast/rtcp/rtcp.h" |
19 #include "media/cast/rtp_sender/rtp_sender.h" | 19 #include "media/cast/rtp_sender/rtp_sender.h" |
20 | 20 |
| 21 namespace crypto { |
| 22 class Encryptor; |
| 23 } |
| 24 |
21 namespace media { | 25 namespace media { |
22 namespace cast { | 26 namespace cast { |
23 | 27 |
24 class VideoEncoder; | 28 class VideoEncoder; |
25 class LocalRtcpVideoSenderFeedback; | 29 class LocalRtcpVideoSenderFeedback; |
26 class LocalRtpVideoSenderStatistics; | 30 class LocalRtpVideoSenderStatistics; |
27 class LocalVideoEncoderCallback; | 31 class LocalVideoEncoderCallback; |
28 class PacedPacketSender; | 32 class PacedPacketSender; |
29 | 33 |
30 // Not thread safe. Only called from the main cast thread. | 34 // Not thread safe. Only called from the main cast thread. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void ResendFrame(uint32 resend_frame_id); | 99 void ResendFrame(uint32 resend_frame_id); |
96 void ReceivedAck(uint32 acked_frame_id); | 100 void ReceivedAck(uint32 acked_frame_id); |
97 void UpdateFramesInFlight(); | 101 void UpdateFramesInFlight(); |
98 | 102 |
99 void SendEncodedVideoFrameMainThread( | 103 void SendEncodedVideoFrameMainThread( |
100 scoped_ptr<EncodedVideoFrame> video_frame, | 104 scoped_ptr<EncodedVideoFrame> video_frame, |
101 const base::TimeTicks& capture_time); | 105 const base::TimeTicks& capture_time); |
102 | 106 |
103 void InitializeTimers(); | 107 void InitializeTimers(); |
104 | 108 |
| 109 // Caller must allocate the destination |encrypted_video_frame| the data |
| 110 // member will be resized to hold the encrypted size. |
| 111 bool EncryptVideoFrame(const EncodedVideoFrame& encoded_frame, |
| 112 EncodedVideoFrame* encrypted_video_frame); |
| 113 |
105 const base::TimeDelta rtp_max_delay_; | 114 const base::TimeDelta rtp_max_delay_; |
106 const int max_frame_rate_; | 115 const int max_frame_rate_; |
107 | 116 |
108 scoped_refptr<CastEnvironment> cast_environment_; | 117 scoped_refptr<CastEnvironment> cast_environment_; |
109 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; | 118 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; |
110 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; | 119 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; |
111 scoped_refptr<VideoEncoder> video_encoder_; | 120 scoped_refptr<VideoEncoder> video_encoder_; |
112 scoped_ptr<Rtcp> rtcp_; | 121 scoped_ptr<Rtcp> rtcp_; |
113 scoped_ptr<RtpSender> rtp_sender_; | 122 scoped_ptr<RtpSender> rtp_sender_; |
114 VideoEncoderController* video_encoder_controller_; | 123 VideoEncoderController* video_encoder_controller_; |
115 uint8 max_unacked_frames_; | 124 uint8 max_unacked_frames_; |
| 125 scoped_ptr<crypto::Encryptor> encryptor_; |
| 126 std::string iv_mask_; |
116 int last_acked_frame_id_; | 127 int last_acked_frame_id_; |
117 int last_sent_frame_id_; | 128 int last_sent_frame_id_; |
118 int duplicate_ack_; | 129 int duplicate_ack_; |
119 base::TimeTicks last_send_time_; | 130 base::TimeTicks last_send_time_; |
120 base::TimeTicks last_checked_skip_count_time_; | 131 base::TimeTicks last_checked_skip_count_time_; |
121 int last_skip_count_; | 132 int last_skip_count_; |
122 CongestionControl congestion_control_; | 133 CongestionControl congestion_control_; |
123 | 134 |
124 bool initialized_; | 135 bool initialized_; |
125 base::WeakPtrFactory<VideoSender> weak_factory_; | 136 base::WeakPtrFactory<VideoSender> weak_factory_; |
126 | 137 |
127 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 138 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
128 }; | 139 }; |
129 | 140 |
130 } // namespace cast | 141 } // namespace cast |
131 } // namespace media | 142 } // namespace media |
132 | 143 |
133 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 144 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
134 | 145 |
OLD | NEW |