OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "webrtc/system_wrappers/include/atomic32.h" | 30 #include "webrtc/system_wrappers/include/atomic32.h" |
31 #include "webrtc/video/overuse_frame_detector.h" | 31 #include "webrtc/video/overuse_frame_detector.h" |
32 #include "webrtc/video_encoder.h" | 32 #include "webrtc/video_encoder.h" |
33 #include "webrtc/video_send_stream.h" | 33 #include "webrtc/video_send_stream.h" |
34 #include "webrtc/typedefs.h" | 34 #include "webrtc/typedefs.h" |
35 | 35 |
36 namespace webrtc { | 36 namespace webrtc { |
37 | 37 |
38 class ProcessThread; | 38 class ProcessThread; |
39 class SendStatisticsProxy; | 39 class SendStatisticsProxy; |
| 40 class VideoBitrateAllocationObserver; |
40 | 41 |
41 // VieEncoder represent a video encoder that accepts raw video frames as input | 42 // VieEncoder represent a video encoder that accepts raw video frames as input |
42 // and produces an encoded bit stream. | 43 // and produces an encoded bit stream. |
43 // Usage: | 44 // Usage: |
44 // Instantiate. | 45 // Instantiate. |
45 // Call SetSink. | 46 // Call SetSink. |
46 // Call SetSource. | 47 // Call SetSource. |
47 // Call ConfigureEncoder with the codec settings. | 48 // Call ConfigureEncoder with the codec settings. |
48 // Call Stop() when done. | 49 // Call Stop() when done. |
49 class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>, | 50 class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 const VideoSendStream::DegradationPreference& degradation_preference); | 85 const VideoSendStream::DegradationPreference& degradation_preference); |
85 | 86 |
86 // Sets the |sink| that gets the encoded frames. |rotation_applied| means | 87 // Sets the |sink| that gets the encoded frames. |rotation_applied| means |
87 // that the source must support rotation. Only set |rotation_applied| if the | 88 // that the source must support rotation. Only set |rotation_applied| if the |
88 // remote side does not support the rotation extension. | 89 // remote side does not support the rotation extension. |
89 void SetSink(EncoderSink* sink, bool rotation_applied); | 90 void SetSink(EncoderSink* sink, bool rotation_applied); |
90 | 91 |
91 // TODO(perkj): Can we remove VideoCodec.startBitrate ? | 92 // TODO(perkj): Can we remove VideoCodec.startBitrate ? |
92 void SetStartBitrate(int start_bitrate_bps); | 93 void SetStartBitrate(int start_bitrate_bps); |
93 | 94 |
| 95 void SetBitrateObserver(VideoBitrateAllocationObserver* bitrate_observer); |
| 96 |
94 void ConfigureEncoder(VideoEncoderConfig config, | 97 void ConfigureEncoder(VideoEncoderConfig config, |
95 size_t max_data_payload_length, | 98 size_t max_data_payload_length, |
96 bool nack_enabled); | 99 bool nack_enabled); |
97 | 100 |
98 // Permanently stop encoding. After this method has returned, it is | 101 // Permanently stop encoding. After this method has returned, it is |
99 // guaranteed that no encoded frames will be delivered to the sink. | 102 // guaranteed that no encoded frames will be delivered to the sink. |
100 void Stop(); | 103 void Stop(); |
101 | 104 |
102 void SendKeyFrame(); | 105 void SendKeyFrame(); |
103 | 106 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 Atomic32 posted_frames_waiting_for_encode_; | 225 Atomic32 posted_frames_waiting_for_encode_; |
223 // Used to make sure incoming time stamp is increasing for every frame. | 226 // Used to make sure incoming time stamp is increasing for every frame. |
224 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); | 227 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); |
225 // Delta used for translating between NTP and internal timestamps. | 228 // Delta used for translating between NTP and internal timestamps. |
226 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); | 229 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); |
227 | 230 |
228 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); | 231 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); |
229 int captured_frame_count_ ACCESS_ON(&encoder_queue_); | 232 int captured_frame_count_ ACCESS_ON(&encoder_queue_); |
230 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); | 233 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); |
231 | 234 |
| 235 VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); |
| 236 |
232 // All public methods are proxied to |encoder_queue_|. It must must be | 237 // All public methods are proxied to |encoder_queue_|. It must must be |
233 // destroyed first to make sure no tasks are run that use other members. | 238 // destroyed first to make sure no tasks are run that use other members. |
234 rtc::TaskQueue encoder_queue_; | 239 rtc::TaskQueue encoder_queue_; |
235 | 240 |
236 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 241 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
237 }; | 242 }; |
238 | 243 |
239 } // namespace webrtc | 244 } // namespace webrtc |
240 | 245 |
241 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 246 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |