| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 Atomic32 posted_frames_waiting_for_encode_; | 227 Atomic32 posted_frames_waiting_for_encode_; |
| 225 // Used to make sure incoming time stamp is increasing for every frame. | 228 // Used to make sure incoming time stamp is increasing for every frame. |
| 226 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); | 229 int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); |
| 227 // Delta used for translating between NTP and internal timestamps. | 230 // Delta used for translating between NTP and internal timestamps. |
| 228 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); | 231 const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); |
| 229 | 232 |
| 230 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); | 233 int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); |
| 231 int captured_frame_count_ ACCESS_ON(&encoder_queue_); | 234 int captured_frame_count_ ACCESS_ON(&encoder_queue_); |
| 232 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); | 235 int dropped_frame_count_ ACCESS_ON(&encoder_queue_); |
| 233 | 236 |
| 237 VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); |
| 238 |
| 234 // All public methods are proxied to |encoder_queue_|. It must must be | 239 // All public methods are proxied to |encoder_queue_|. It must must be |
| 235 // destroyed first to make sure no tasks are run that use other members. | 240 // destroyed first to make sure no tasks are run that use other members. |
| 236 rtc::TaskQueue encoder_queue_; | 241 rtc::TaskQueue encoder_queue_; |
| 237 | 242 |
| 238 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); | 243 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
| 239 }; | 244 }; |
| 240 | 245 |
| 241 } // namespace webrtc | 246 } // namespace webrtc |
| 242 | 247 |
| 243 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ | 248 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |
| OLD | NEW |