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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // the encoder is done with the frame; it does not mean that the encoded frame | 56 // the encoder is done with the frame; it does not mean that the encoded frame |
57 // has been sent out. | 57 // has been sent out. |
58 void InsertRawVideoFrame( | 58 void InsertRawVideoFrame( |
59 const scoped_refptr<media::VideoFrame>& video_frame, | 59 const scoped_refptr<media::VideoFrame>& video_frame, |
60 const base::TimeTicks& capture_time); | 60 const base::TimeTicks& capture_time); |
61 | 61 |
62 // The video_frame must be valid until the closure callback is called. | 62 // The video_frame must be valid until the closure callback is called. |
63 // The closure callback is called from the main thread as soon as | 63 // The closure callback is called from the main thread as soon as |
64 // the cast sender is done with the frame; it does not mean that the encoded | 64 // the cast sender is done with the frame; it does not mean that the encoded |
65 // frame has been sent out. | 65 // frame has been sent out. |
66 void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, | 66 void InsertCodedVideoFrame(const transport::EncodedVideoFrame* video_frame, |
67 const base::TimeTicks& capture_time, | 67 const base::TimeTicks& capture_time, |
68 const base::Closure callback); | 68 const base::Closure callback); |
69 | 69 |
70 // Only called from the main cast thread. | 70 // Only called from the main cast thread. |
71 void IncomingRtcpPacket(const uint8* packet, size_t length, | 71 void IncomingRtcpPacket(const uint8* packet, size_t length, |
72 const base::Closure callback); | 72 const base::Closure callback); |
73 | 73 |
74 protected: | 74 protected: |
75 // Protected for testability. | 75 // Protected for testability. |
76 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); | 76 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
(...skipping 13 matching lines...) Expand all Loading... |
90 // normal operation 3 full frames), hence this is the last resort to prevent | 90 // normal operation 3 full frames), hence this is the last resort to prevent |
91 // us getting stuck after a long outage. | 91 // us getting stuck after a long outage. |
92 void ScheduleNextResendCheck(); | 92 void ScheduleNextResendCheck(); |
93 void ResendCheck(); | 93 void ResendCheck(); |
94 | 94 |
95 // Monitor how many frames that are silently dropped by the video sender | 95 // Monitor how many frames that are silently dropped by the video sender |
96 // per time unit. | 96 // per time unit. |
97 void ScheduleNextSkippedFramesCheck(); | 97 void ScheduleNextSkippedFramesCheck(); |
98 void SkippedFramesCheck(); | 98 void SkippedFramesCheck(); |
99 | 99 |
100 void SendEncodedVideoFrame(const EncodedVideoFrame* video_frame, | 100 void SendEncodedVideoFrame(const transport::EncodedVideoFrame* video_frame, |
101 const base::TimeTicks& capture_time); | 101 const base::TimeTicks& capture_time); |
102 void ResendFrame(uint32 resend_frame_id); | 102 void ResendFrame(uint32 resend_frame_id); |
103 void ReceivedAck(uint32 acked_frame_id); | 103 void ReceivedAck(uint32 acked_frame_id); |
104 void UpdateFramesInFlight(); | 104 void UpdateFramesInFlight(); |
105 | 105 |
106 void SendEncodedVideoFrameMainThread( | 106 void SendEncodedVideoFrameMainThread( |
107 scoped_ptr<EncodedVideoFrame> video_frame, | 107 scoped_ptr<transport::EncodedVideoFrame> video_frame, |
108 const base::TimeTicks& capture_time); | 108 const base::TimeTicks& capture_time); |
109 | 109 |
110 void InitializeTimers(); | 110 void InitializeTimers(); |
111 | 111 |
112 // Caller must allocate the destination |encrypted_video_frame| the data | 112 // Caller must allocate the destination |encrypted_video_frame| the data |
113 // member will be resized to hold the encrypted size. | 113 // member will be resized to hold the encrypted size. |
114 bool EncryptVideoFrame(const EncodedVideoFrame& encoded_frame, | 114 bool EncryptVideoFrame(const transport::EncodedVideoFrame& encoded_frame, |
115 EncodedVideoFrame* encrypted_video_frame); | 115 transport::EncodedVideoFrame* encrypted_video_frame); |
116 | 116 |
117 const base::TimeDelta rtp_max_delay_; | 117 const base::TimeDelta rtp_max_delay_; |
118 const int max_frame_rate_; | 118 const int max_frame_rate_; |
119 | 119 |
120 scoped_refptr<CastEnvironment> cast_environment_; | 120 scoped_refptr<CastEnvironment> cast_environment_; |
121 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; | 121 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; |
122 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; | 122 scoped_ptr<LocalRtpVideoSenderStatistics> rtp_video_sender_statistics_; |
123 scoped_ptr<VideoEncoder> video_encoder_; | 123 scoped_ptr<VideoEncoder> video_encoder_; |
124 scoped_ptr<Rtcp> rtcp_; | 124 scoped_ptr<Rtcp> rtcp_; |
125 scoped_ptr<transport::RtpSender> rtp_sender_; | 125 scoped_ptr<transport::RtpSender> rtp_sender_; |
(...skipping 13 matching lines...) Expand all Loading... |
139 bool initialized_; | 139 bool initialized_; |
140 base::WeakPtrFactory<VideoSender> weak_factory_; | 140 base::WeakPtrFactory<VideoSender> weak_factory_; |
141 | 141 |
142 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 142 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
143 }; | 143 }; |
144 | 144 |
145 } // namespace cast | 145 } // namespace cast |
146 } // namespace media | 146 } // namespace media |
147 | 147 |
148 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 148 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
OLD | NEW |