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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, as defined by the |
74 // configured target playout delay plus simple logic. When this is true, | 74 // configured target playout delay plus simple logic. When this is true, |
75 // InsertRawVideoFrame() will silenty drop frames instead of sending them to | 75 // InsertRawVideoFrame() will silenty drop frames instead of sending them to |
76 // the video encoder. | 76 // the video encoder. |
77 bool AreTooManyFramesInFlight() const; | 77 bool AreTooManyFramesInFlight() 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 | |
83 // The total amount of time between a frame's capture/recording on the sender | |
84 // and its playback on the receiver (i.e., shown to a user). This is fixed as | |
85 // a value large enough to give the system sufficient time to encode, | |
86 // transmit/retransmit, receive, decode, and render; given its run-time | |
87 // environment (sender/receiver hardware performance, network conditions, | |
88 // etc.). | |
89 const base::TimeDelta target_playout_delay_; | |
90 | |
91 // Maximum number of outstanding frames before the encoding and sending of | |
92 // new frames shall halt. | |
93 const int max_unacked_frames_; | |
94 | |
95 // 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. |
96 // 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 |
97 // (min_bitrate + max_bitrate) / 2. | 84 // (min_bitrate + max_bitrate) / 2. |
98 const size_t fixed_bitrate_; | 85 const size_t fixed_bitrate_; |
99 | 86 |
100 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, | 87 // Encodes media::VideoFrame images into EncodedFrames. Per configuration, |
101 // this will point to either the internal software-based encoder or a proxy to | 88 // this will point to either the internal software-based encoder or a proxy to |
102 // a hardware-based encoder. | 89 // a hardware-based encoder. |
103 scoped_ptr<VideoEncoder> video_encoder_; | 90 scoped_ptr<VideoEncoder> video_encoder_; |
104 | 91 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // NOTE: Weak pointers must be invalidated before all other member variables. | 133 // NOTE: Weak pointers must be invalidated before all other member variables. |
147 base::WeakPtrFactory<VideoSender> weak_factory_; | 134 base::WeakPtrFactory<VideoSender> weak_factory_; |
148 | 135 |
149 DISALLOW_COPY_AND_ASSIGN(VideoSender); | 136 DISALLOW_COPY_AND_ASSIGN(VideoSender); |
150 }; | 137 }; |
151 | 138 |
152 } // namespace cast | 139 } // namespace cast |
153 } // namespace media | 140 } // namespace media |
154 | 141 |
155 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ | 142 #endif // MEDIA_CAST_SENDER_VIDEO_SENDER_H_ |
OLD | NEW |