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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const VideoSendStream::DegradationPreference& degradation_preference); | 87 const VideoSendStream::DegradationPreference& degradation_preference); |
87 | 88 |
88 // Sets the |sink| that gets the encoded frames. |rotation_applied| means | 89 // Sets the |sink| that gets the encoded frames. |rotation_applied| means |
89 // that the source must support rotation. Only set |rotation_applied| if the | 90 // that the source must support rotation. Only set |rotation_applied| if the |
90 // remote side does not support the rotation extension. | 91 // remote side does not support the rotation extension. |
91 void SetSink(EncoderSink* sink, bool rotation_applied); | 92 void SetSink(EncoderSink* sink, bool rotation_applied); |
92 | 93 |
93 // TODO(perkj): Can we remove VideoCodec.startBitrate ? | 94 // TODO(perkj): Can we remove VideoCodec.startBitrate ? |
94 void SetStartBitrate(int start_bitrate_bps); | 95 void SetStartBitrate(int start_bitrate_bps); |
95 | 96 |
| 97 void SetBitrateObserver(VideoBitrateAllocationObserver* bitrate_observer); |
| 98 |
96 void ConfigureEncoder(VideoEncoderConfig config, | 99 void ConfigureEncoder(VideoEncoderConfig config, |
97 size_t max_data_payload_length, | 100 size_t max_data_payload_length, |
98 bool nack_enabled); | 101 bool nack_enabled); |
99 | 102 |
100 // Permanently stop encoding. After this method has returned, it is | 103 // Permanently stop encoding. After this method has returned, it is |
101 // guaranteed that no encoded frames will be delivered to the sink. | 104 // guaranteed that no encoded frames will be delivered to the sink. |
102 void Stop(); | 105 void Stop(); |
103 | 106 |
104 void SendKeyFrame(); | 107 void SendKeyFrame(); |
105 | 108 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 Atomic32 posted_frames_waiting_for_encode_; | 229 Atomic32 posted_frames_waiting_for_encode_; |
227 // Used to make sure incoming time stamp is increasing for every frame. | 230 // Used to make sure incoming time stamp is increasing for every frame. |
228 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); | 231 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); |
229 // Delta used for translating between NTP and internal timestamps. | 232 // Delta used for translating between NTP and internal timestamps. |
230 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); | 233 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); |
231 | 234 |
232 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); | 235 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); |
233 int captured_frame_count_ ACCESS_ON(&encoder_queue_); | 236 int captured_frame_count_ ACCESS_ON(&encoder_queue_); |
234 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); | 237 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); |
235 | 238 |
| 239 VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); |
| 240 |
236 // All public methods are proxied to |encoder_queue_|. It must must be | 241 // All public methods are proxied to |encoder_queue_|. It must must be |
237 // destroyed first to make sure no tasks are run that use other members. | 242 // destroyed first to make sure no tasks are run that use other members. |
238 rtc::TaskQueue encoder_queue_; | 243 rtc::TaskQueue encoder_queue_; |
239 | 244 |
240 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 245 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
241 }; | 246 }; |
242 | 247 |
243 } // namespace webrtc | 248 } // namespace webrtc |
244 | 249 |
245 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 250 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
OLD | NEW |