Chromium Code Reviews| 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 24 matching lines...) Expand all Loading... | |
| 49 // has been sent out. | 50 // has been sent out. |
| 50 void InsertRawVideoFrame( | 51 void InsertRawVideoFrame( |
| 51 const I420VideoFrame* video_frame, | 52 const I420VideoFrame* video_frame, |
| 52 const base::TimeTicks& capture_time, | 53 const base::TimeTicks& capture_time, |
| 53 const base::Closure callback); | 54 const base::Closure callback); |
| 54 | 55 |
| 55 // The video_frame must be valid until the closure callback is called. | 56 // The video_frame must be valid until the closure callback is called. |
| 56 // The closure callback is called from the main thread as soon as | 57 // The closure callback is called from the main thread as soon as |
| 57 // the cast sender is done with the frame; it does not mean that the encoded | 58 // the cast sender is done with the frame; it does not mean that the encoded |
| 58 // frame has been sent out. | 59 // frame has been sent out. |
| 59 void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, | 60 void InsertCodedVideoFrame(EncodedVideoFrame* video_frame, |
|
Alpha Left Google
2013/11/07 01:10:11
Why take away the const? The call goes to EncryptV
pwestin
2013/11/07 17:16:04
Removed; changed due to padding, which we don't ne
| |
| 60 const base::TimeTicks& capture_time, | 61 const base::TimeTicks& capture_time, |
| 61 const base::Closure callback); | 62 const base::Closure callback); |
| 62 | 63 |
| 63 // Only called from the main cast thread. | 64 // Only called from the main cast thread. |
| 64 void IncomingRtcpPacket(const uint8* packet, size_t length, | 65 void IncomingRtcpPacket(const uint8* packet, size_t length, |
| 65 const base::Closure callback); | 66 const base::Closure callback); |
| 66 | 67 |
| 67 protected: | 68 protected: |
| 68 // Protected for testability. | 69 // Protected for testability. |
| 69 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); | 70 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 83 // normal operation 3 full frames), hence this is the last resort to prevent | 84 // normal operation 3 full frames), hence this is the last resort to prevent |
| 84 // us getting stuck after a long outage. | 85 // us getting stuck after a long outage. |
| 85 void ScheduleNextResendCheck(); | 86 void ScheduleNextResendCheck(); |
| 86 void ResendCheck(); | 87 void ResendCheck(); |
| 87 | 88 |
| 88 // Monitor how many frames that are silently dropped by the video sender | 89 // Monitor how many frames that are silently dropped by the video sender |
| 89 // per time unit. | 90 // per time unit. |
| 90 void ScheduleNextSkippedFramesCheck(); | 91 void ScheduleNextSkippedFramesCheck(); |
| 91 void SkippedFramesCheck(); | 92 void SkippedFramesCheck(); |
| 92 | 93 |
| 93 void SendEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 94 void SendEncodedVideoFrame(EncodedVideoFrame* video_frame, |
| 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 bool EncryptVideoFrame(const EncodedVideoFrame* encoded_frame, | |
|
Alpha Left Google
2013/11/07 01:10:11
I'd return a scoped_ptr<EncodedVideoframe> instead
pwestin
2013/11/07 17:16:04
Same as above; I think this is cleaner since the p
| |
| 106 EncodedVideoFrame* encrypted_video_frame); | |
| 107 | |
| 104 const uint32 incoming_feedback_ssrc_; | 108 const uint32 incoming_feedback_ssrc_; |
| 105 const base::TimeDelta rtp_max_delay_; | 109 const base::TimeDelta rtp_max_delay_; |
| 106 const int max_frame_rate_; | 110 const int max_frame_rate_; |
| 107 | 111 |
| 108 scoped_refptr<CastEnvironment> cast_environment_; | 112 scoped_refptr<CastEnvironment> cast_environment_; |
| 109 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; | 113 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; |
| 110 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; | 114 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; |
| 111 scoped_refptr<VideoEncoder> video_encoder_; | 115 scoped_refptr<VideoEncoder> video_encoder_; |
| 112 scoped_ptr<Rtcp> rtcp_; | 116 scoped_ptr<Rtcp> rtcp_; |
| 113 scoped_ptr<RtpSender> rtp_sender_; | 117 scoped_ptr<RtpSender> rtp_sender_; |
| 114 VideoEncoderController* video_encoder_controller_; | 118 VideoEncoderController* video_encoder_controller_; |
| 115 uint8 max_unacked_frames_; | 119 uint8 max_unacked_frames_; |
| 120 scoped_ptr<crypto::Encryptor> encryptor_; | |
| 121 std::string iv_mask_; | |
| 116 int last_acked_frame_id_; | 122 int last_acked_frame_id_; |
| 117 int last_sent_frame_id_; | 123 int last_sent_frame_id_; |
| 118 int last_sent_key_frame_id_; | 124 int last_sent_key_frame_id_; |
| 119 int duplicate_ack_; | 125 int duplicate_ack_; |
| 120 base::TimeTicks last_send_time_; | 126 base::TimeTicks last_send_time_; |
| 121 base::TimeTicks last_checked_skip_count_time_; | 127 base::TimeTicks last_checked_skip_count_time_; |
| 122 int last_skip_count_; | 128 int last_skip_count_; |
| 123 CongestionControl congestion_control_; | 129 CongestionControl congestion_control_; |
| 124 | 130 |
| 125 base::WeakPtrFactory<VideoSender> weak_factory_; | 131 base::WeakPtrFactory<VideoSender> weak_factory_; |
| 126 | 132 |
| 127 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 133 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
| 128 }; | 134 }; |
| 129 | 135 |
| 130 } // namespace cast | 136 } // namespace cast |
| 131 } // namespace media | 137 } // namespace media |
| 132 | 138 |
| 133 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 139 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
| 134 | 140 |
| OLD | NEW |