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