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/logging/logging_defines.h" | 18 #include "media/cast/logging/logging_defines.h" |
19 #include "media/cast/rtcp/rtcp.h" | 19 #include "media/cast/rtcp/rtcp.h" |
| 20 #include "media/cast/rtp_timestamp_helper.h" |
20 | 21 |
21 namespace media { | 22 namespace media { |
22 class VideoFrame; | 23 class VideoFrame; |
23 | 24 |
24 namespace cast { | 25 namespace cast { |
25 class LocalRtcpVideoSenderFeedback; | 26 class LocalRtcpVideoSenderFeedback; |
26 class LocalVideoEncoderCallback; | 27 class LocalVideoEncoderCallback; |
27 class VideoEncoder; | 28 class VideoEncoder; |
28 | 29 |
29 namespace transport { | 30 namespace transport { |
(...skipping 21 matching lines...) Expand all Loading... |
51 // The video_frame must be valid until the closure callback is called. | 52 // The video_frame must be valid until the closure callback is called. |
52 // The closure callback is called from the video encoder thread as soon as | 53 // The closure callback is called from the video encoder thread as soon as |
53 // the encoder is done with the frame; it does not mean that the encoded frame | 54 // the encoder is done with the frame; it does not mean that the encoded frame |
54 // has been sent out. | 55 // has been sent out. |
55 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 56 void InsertRawVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
56 const base::TimeTicks& capture_time); | 57 const base::TimeTicks& capture_time); |
57 | 58 |
58 // Only called from the main cast thread. | 59 // Only called from the main cast thread. |
59 void IncomingRtcpPacket(scoped_ptr<Packet> packet); | 60 void IncomingRtcpPacket(scoped_ptr<Packet> packet); |
60 | 61 |
61 // Store rtp stats computed at the Cast transport sender. | |
62 void StoreStatistics(const transport::RtcpSenderInfo& sender_info, | |
63 base::TimeTicks time_sent, | |
64 uint32 rtp_timestamp); | |
65 | |
66 protected: | 62 protected: |
67 // Protected for testability. | 63 // Protected for testability. |
68 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); | 64 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); |
69 | 65 |
70 private: | 66 private: |
71 friend class LocalRtcpVideoSenderFeedback; | 67 friend class LocalRtcpVideoSenderFeedback; |
72 | 68 |
73 // Schedule when we should send the next RTPC report, | 69 // Schedule when we should send the next RTPC report, |
74 // via a PostDelayedTask to the main cast thread. | 70 // via a PostDelayedTask to the main cast thread. |
75 void ScheduleNextRtcpReport(); | 71 void ScheduleNextRtcpReport(); |
(...skipping 26 matching lines...) Expand all Loading... |
102 void InitializeTimers(); | 98 void InitializeTimers(); |
103 | 99 |
104 void UpdateBitrate(int32 new_bitrate); | 100 void UpdateBitrate(int32 new_bitrate); |
105 | 101 |
106 base::TimeDelta rtp_max_delay_; | 102 base::TimeDelta rtp_max_delay_; |
107 const int max_frame_rate_; | 103 const int max_frame_rate_; |
108 | 104 |
109 scoped_refptr<CastEnvironment> cast_environment_; | 105 scoped_refptr<CastEnvironment> cast_environment_; |
110 transport::CastTransportSender* const transport_sender_; | 106 transport::CastTransportSender* const transport_sender_; |
111 | 107 |
112 RtpSenderStatistics rtp_stats_; | 108 RtpTimestampHelper rtp_timestamp_helper_; |
113 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; | 109 scoped_ptr<LocalRtcpVideoSenderFeedback> rtcp_feedback_; |
114 scoped_ptr<VideoEncoder> video_encoder_; | 110 scoped_ptr<VideoEncoder> video_encoder_; |
115 scoped_ptr<Rtcp> rtcp_; | 111 scoped_ptr<Rtcp> rtcp_; |
116 uint8 max_unacked_frames_; | 112 uint8 max_unacked_frames_; |
117 int last_acked_frame_id_; | 113 int last_acked_frame_id_; |
118 int last_sent_frame_id_; | 114 int last_sent_frame_id_; |
119 int frames_in_encoder_; | 115 int frames_in_encoder_; |
120 int duplicate_ack_; | 116 int duplicate_ack_; |
121 base::TimeTicks last_send_time_; | 117 base::TimeTicks last_send_time_; |
122 base::TimeTicks last_checked_skip_count_time_; | 118 base::TimeTicks last_checked_skip_count_time_; |
(...skipping 20 matching lines...) Expand all Loading... |
143 // NOTE: Weak pointers must be invalidated before all other member variables. | 139 // NOTE: Weak pointers must be invalidated before all other member variables. |
144 base::WeakPtrFactory<VideoSender> weak_factory_; | 140 base::WeakPtrFactory<VideoSender> weak_factory_; |
145 | 141 |
146 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 142 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
147 }; | 143 }; |
148 | 144 |
149 } // namespace cast | 145 } // namespace cast |
150 } // namespace media | 146 } // namespace media |
151 | 147 |
152 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ | 148 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_SENDER_H_ |
OLD | NEW |