OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SENDER_VIDEO_SENDER_H_ | 5 #ifndef MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
6 #define MEDIA_CAST_SENDER_VIDEO_SENDER_H_ | 6 #define MEDIA_CAST_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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 private: | 63 private: |
64 // Schedule and execute periodic checks for re-sending packets. If no | 64 // Schedule and execute periodic checks for re-sending packets. If no |
65 // acknowledgements have been received for "too long," VideoSender will | 65 // acknowledgements have been received for "too long," VideoSender will |
66 // speculatively re-send certain packets of an unacked frame to kick-start | 66 // speculatively re-send certain packets of an unacked frame to kick-start |
67 // re-transmission. This is a last resort tactic to prevent the session from | 67 // re-transmission. This is a last resort tactic to prevent the session from |
68 // getting stuck after a long outage. | 68 // getting stuck after a long outage. |
69 void ScheduleNextResendCheck(); | 69 void ScheduleNextResendCheck(); |
70 void ResendCheck(); | 70 void ResendCheck(); |
71 void ResendForKickstart(); | 71 void ResendForKickstart(); |
72 | 72 |
73 // Returns true if there are too many frames in flight, as defined by the | 73 // Returns true if there are too many frames in flight, or if the media |
74 // configured target playout delay plus simple logic. When this is true, | 74 // duration of the frames in flight would be too high by sending the next |
75 // InsertRawVideoFrame() will silenty drop frames instead of sending them to | 75 // frame. The latter metric is determined from the given |capture_time| |
76 // the video encoder. | 76 // for the next frame to be encoded and sent. |
77 bool AreTooManyFramesInFlight() const; | 77 bool ShouldDropNextFrame(base::TimeTicks capture_time) const; |
78 | 78 |
79 // Called by the |video_encoder_| with the next EncodeFrame to send. | 79 // Called by the |video_encoder_| with the next EncodeFrame to send. |
80 void SendEncodedVideoFrame(int requested_bitrate_before_encode, | 80 void SendEncodedVideoFrame(int requested_bitrate_before_encode, |
81 scoped_ptr<EncodedFrame> encoded_frame); | 81 scoped_ptr<EncodedFrame> encoded_frame); |
82 // If this value is non zero then a fixed value is used for bitrate. | 82 // If this value is non zero then a fixed value is used for bitrate. |
83 // If external video encoder is used then bitrate will be fixed to | 83 // If external video encoder is used then bitrate will be fixed to |
84 // (min_bitrate + max_bitrate) / 2. | 84 // (min_bitrate + max_bitrate) / 2. |
85 const size_t fixed_bitrate_; | 85 const size_t fixed_bitrate_; |
86 | 86 |
87 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, | 87 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // NOTE: Weak pointers must be invalidated before all other member variables. | 133 // NOTE: Weak pointers must be invalidated before all other member variables. |
134 base::WeakPtrFactory<VideoSender> weak_factory_; | 134 base::WeakPtrFactory<VideoSender> weak_factory_; |
135 | 135 |
136 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 136 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
137 }; | 137 }; |
138 | 138 |
139 } // namespace cast | 139 } // namespace cast |
140 } // namespace media | 140 } // namespace media |
141 | 141 |
142 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ | 142 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
OLD | NEW |