niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
stefan@webrtc.org | 07b45a5 | 2012-02-02 08:37:48 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Peter Boström | 7623ce4 | 2015-12-09 12:13:30 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_VIDEO_VIE_ENCODER_H_ |
| 12 | #define WEBRTC_VIDEO_VIE_ENCODER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
kwiberg | 27f982b | 2016-03-01 11:52:33 -0800 | [diff] [blame] | 14 | #include <memory> |
perkj | 376b192 | 2016-05-02 11:35:24 -0700 | [diff] [blame] | 15 | #include <string> |
mflodman@webrtc.org | 02270cd | 2015-02-06 13:10:19 +0000 | [diff] [blame] | 16 | #include <vector> |
mflodman@webrtc.org | d6ec386 | 2012-10-25 11:30:29 +0000 | [diff] [blame] | 17 | |
nisse | af91689 | 2017-01-10 07:44:26 -0800 | [diff] [blame] | 18 | #include "webrtc/api/video/video_rotation.h" |
Tommi | 97888bd | 2016-01-21 23:24:59 +0100 | [diff] [blame] | 19 | #include "webrtc/base/criticalsection.h" |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 20 | #include "webrtc/base/event.h" |
| 21 | #include "webrtc/base/sequenced_task_checker.h" |
| 22 | #include "webrtc/base/task_queue.h" |
ossu | f515ab8 | 2016-12-07 04:52:58 -0800 | [diff] [blame] | 23 | #include "webrtc/call/call.h" |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 24 | #include "webrtc/common_types.h" |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 25 | #include "webrtc/common_video/include/video_bitrate_allocator.h" |
nisse | d30a111 | 2016-04-18 05:15:22 -0700 | [diff] [blame] | 26 | #include "webrtc/media/base/videosinkinterface.h" |
Henrik Kjellander | 2557b86 | 2015-11-18 22:00:21 +0100 | [diff] [blame] | 27 | #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 28 | #include "webrtc/modules/video_coding/utility/quality_scaler.h" |
Peter Boström | cd5c25c | 2016-04-21 16:48:08 +0200 | [diff] [blame] | 29 | #include "webrtc/modules/video_coding/video_coding_impl.h" |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 30 | #include "webrtc/system_wrappers/include/atomic32.h" |
ossu | f515ab8 | 2016-12-07 04:52:58 -0800 | [diff] [blame] | 31 | #include "webrtc/typedefs.h" |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 32 | #include "webrtc/video/overuse_frame_detector.h" |
| 33 | #include "webrtc/video_encoder.h" |
| 34 | #include "webrtc/video_send_stream.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 35 | |
| 36 | namespace webrtc { |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 37 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 38 | class ProcessThread; |
pbos@webrtc.org | 273a414 | 2014-12-01 15:23:21 +0000 | [diff] [blame] | 39 | class SendStatisticsProxy; |
sprang | 1a646ee | 2016-12-01 06:34:11 -0800 | [diff] [blame] | 40 | class VideoBitrateAllocationObserver; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 41 | |
perkj | bc75d97 | 2016-05-02 06:31:25 -0700 | [diff] [blame] | 42 | // VieEncoder represent a video encoder that accepts raw video frames as input |
| 43 | // and produces an encoded bit stream. |
| 44 | // Usage: |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 45 | // Instantiate. |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 46 | // Call SetSink. |
| 47 | // Call SetSource. |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 48 | // Call ConfigureEncoder with the codec settings. |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 49 | // Call Stop() when done. |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 50 | class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>, |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 51 | public EncodedImageCallback, |
| 52 | public VCMSendStatisticsCallback, |
sprang | b1ca073 | 2017-02-01 08:38:12 -0800 | [diff] [blame] | 53 | public AdaptationObserverInterface { |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 54 | public: |
Per | 512ecb3 | 2016-09-23 15:52:06 +0200 | [diff] [blame] | 55 | // Interface for receiving encoded video frames and notifications about |
| 56 | // configuration changes. |
| 57 | class EncoderSink : public EncodedImageCallback { |
| 58 | public: |
| 59 | virtual void OnEncoderConfigurationChanged( |
| 60 | std::vector<VideoStream> streams, |
| 61 | int min_transmit_bitrate_bps) = 0; |
| 62 | }; |
| 63 | |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 64 | // Downscale resolution at most 2 times for CPU reasons. |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 65 | static const int kMaxCpuDowngrades = 2; |
| 66 | |
mflodman | 0dbf009 | 2015-10-19 08:12:12 -0700 | [diff] [blame] | 67 | ViEEncoder(uint32_t number_of_cores, |
Peter Boström | 7083e11 | 2015-09-22 16:28:51 +0200 | [diff] [blame] | 68 | SendStatisticsProxy* stats_proxy, |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 69 | const VideoSendStream::Config::EncoderSettings& settings, |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 70 | rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 71 | EncodedFrameObserver* encoder_timing); |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 72 | ~ViEEncoder(); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 73 | // RegisterProcessThread register |module_process_thread| with those objects |
| 74 | // that use it. Registration has to happen on the thread where |
| 75 | // |module_process_thread| was created (libjingle's worker thread). |
| 76 | // TODO(perkj): Replace the use of |module_process_thread| with a TaskQueue. |
| 77 | void RegisterProcessThread(ProcessThread* module_process_thread); |
| 78 | void DeRegisterProcessThread(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 79 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 80 | // Sets the source that will provide I420 video frames. |
| 81 | // |degradation_preference| control whether or not resolution or frame rate |
| 82 | // may be reduced. |
| 83 | void SetSource( |
| 84 | rtc::VideoSourceInterface<VideoFrame>* source, |
| 85 | const VideoSendStream::DegradationPreference& degradation_preference); |
| 86 | |
| 87 | // Sets the |sink| that gets the encoded frames. |rotation_applied| means |
| 88 | // that the source must support rotation. Only set |rotation_applied| if the |
| 89 | // remote side does not support the rotation extension. |
| 90 | void SetSink(EncoderSink* sink, bool rotation_applied); |
mflodman@webrtc.org | 02270cd | 2015-02-06 13:10:19 +0000 | [diff] [blame] | 91 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 92 | // TODO(perkj): Can we remove VideoCodec.startBitrate ? |
| 93 | void SetStartBitrate(int start_bitrate_bps); |
mflodman@webrtc.org | 9ec883e | 2012-03-05 17:12:41 +0000 | [diff] [blame] | 94 | |
sprang | 1a646ee | 2016-12-01 06:34:11 -0800 | [diff] [blame] | 95 | void SetBitrateObserver(VideoBitrateAllocationObserver* bitrate_observer); |
| 96 | |
Per | 512ecb3 | 2016-09-23 15:52:06 +0200 | [diff] [blame] | 97 | void ConfigureEncoder(VideoEncoderConfig config, |
asapersson | 5f7226f | 2016-11-25 04:37:00 -0800 | [diff] [blame] | 98 | size_t max_data_payload_length, |
| 99 | bool nack_enabled); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 100 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 101 | // Permanently stop encoding. After this method has returned, it is |
| 102 | // guaranteed that no encoded frames will be delivered to the sink. |
| 103 | void Stop(); |
| 104 | |
Peter Boström | 233bfd2 | 2016-01-18 20:23:40 +0100 | [diff] [blame] | 105 | void SendKeyFrame(); |
pwestin@webrtc.org | 49888ce | 2012-04-27 05:25:53 +0000 | [diff] [blame] | 106 | |
Peter Boström | 0013dcc | 2016-02-19 20:42:19 +0100 | [diff] [blame] | 107 | // virtual to test EncoderStateFeedback with mocks. |
perkj | 600246e | 2016-05-04 11:26:51 -0700 | [diff] [blame] | 108 | virtual void OnReceivedIntraFrameRequest(size_t stream_index); |
| 109 | virtual void OnReceivedSLI(uint8_t picture_id); |
| 110 | virtual void OnReceivedRPSI(uint64_t picture_id); |
mflodman@webrtc.org | d6ec386 | 2012-10-25 11:30:29 +0000 | [diff] [blame] | 111 | |
mflodman | 86aabb2 | 2016-03-11 15:44:32 +0100 | [diff] [blame] | 112 | void OnBitrateUpdated(uint32_t bitrate_bps, |
stefan@webrtc.org | edeea91 | 2014-12-08 19:46:23 +0000 | [diff] [blame] | 113 | uint8_t fraction_lost, |
pkasting@chromium.org | 16825b1 | 2015-01-12 21:51:21 +0000 | [diff] [blame] | 114 | int64_t round_trip_time_ms); |
pwestin@webrtc.org | 49888ce | 2012-04-27 05:25:53 +0000 | [diff] [blame] | 115 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 116 | protected: |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 117 | // Used for testing. For example the |ScalingObserverInterface| methods must |
| 118 | // be called on |encoder_queue_|. |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 119 | rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } |
| 120 | |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 121 | // webrtc::ScalingObserverInterface implementation. |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 122 | // These methods are protected for easier testing. |
sprang | b1ca073 | 2017-02-01 08:38:12 -0800 | [diff] [blame] | 123 | void AdaptUp(AdaptReason reason) override; |
| 124 | void AdaptDown(AdaptReason reason) override; |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 125 | |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 126 | private: |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 127 | class ConfigureEncoderTask; |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 128 | class EncodeTask; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 129 | class VideoSourceProxy; |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 130 | |
kthelgason | 93f16d7 | 2017-01-16 06:15:23 -0800 | [diff] [blame] | 131 | class VideoFrameInfo { |
| 132 | public: |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 133 | VideoFrameInfo(int width, |
| 134 | int height, |
| 135 | VideoRotation rotation, |
| 136 | bool is_texture) |
| 137 | : width(width), |
| 138 | height(height), |
| 139 | rotation(rotation), |
| 140 | is_texture(is_texture) {} |
| 141 | int width; |
| 142 | int height; |
Per | 21d45d2 | 2016-10-30 21:37:57 +0100 | [diff] [blame] | 143 | VideoRotation rotation; |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 144 | bool is_texture; |
kthelgason | 93f16d7 | 2017-01-16 06:15:23 -0800 | [diff] [blame] | 145 | int pixel_count() const { return width * height; } |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 146 | }; |
| 147 | |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 148 | void ConfigureEncoderOnTaskQueue(VideoEncoderConfig config, |
asapersson | 5f7226f | 2016-11-25 04:37:00 -0800 | [diff] [blame] | 149 | size_t max_data_payload_length, |
| 150 | bool nack_enabled); |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 151 | void ReconfigureEncoder(); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 152 | |
kthelgason | 2bc6864 | 2017-02-07 07:02:22 -0800 | [diff] [blame^] | 153 | void ConfigureQualityScaler(); |
| 154 | |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 155 | // Implements VideoSinkInterface. |
| 156 | void OnFrame(const VideoFrame& video_frame) override; |
| 157 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 158 | // Implements VideoSendStatisticsCallback. |
| 159 | void SendStatistics(uint32_t bit_rate, |
| 160 | uint32_t frame_rate) override; |
| 161 | |
perkj | d52063f | 2016-09-07 06:32:18 -0700 | [diff] [blame] | 162 | void EncodeVideoFrame(const VideoFrame& frame, |
| 163 | int64_t time_when_posted_in_ms); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 164 | |
| 165 | // Implements EncodedImageCallback. |
| 166 | EncodedImageCallback::Result OnEncodedImage( |
| 167 | const EncodedImage& encoded_image, |
| 168 | const CodecSpecificInfo* codec_specific_info, |
| 169 | const RTPFragmentationHeader* fragmentation) override; |
| 170 | |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 171 | void OnDroppedFrame() override; |
| 172 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 173 | bool EncoderPaused() const; |
| 174 | void TraceFrameDropStart(); |
| 175 | void TraceFrameDropEnd(); |
| 176 | |
| 177 | rtc::Event shutdown_event_; |
stefan@webrtc.org | bfacda6 | 2013-03-27 16:36:01 +0000 | [diff] [blame] | 178 | |
pbos@webrtc.org | b238d12 | 2013-04-09 13:41:51 +0000 | [diff] [blame] | 179 | const uint32_t number_of_cores_; |
kthelgason | 2bc6864 | 2017-02-07 07:02:22 -0800 | [diff] [blame^] | 180 | // Counts how many frames we've dropped in the initial rampup phase. |
| 181 | int initial_rampup_; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 182 | |
| 183 | const std::unique_ptr<VideoSourceProxy> source_proxy_; |
Per | 512ecb3 | 2016-09-23 15:52:06 +0200 | [diff] [blame] | 184 | EncoderSink* sink_; |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 185 | const VideoSendStream::Config::EncoderSettings settings_; |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 186 | const VideoCodecType codec_type_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 187 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 188 | vcm::VideoSender video_sender_ ACCESS_ON(&encoder_queue_); |
perkj | d52063f | 2016-09-07 06:32:18 -0700 | [diff] [blame] | 189 | OveruseFrameDetector overuse_detector_ ACCESS_ON(&encoder_queue_); |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 190 | std::unique_ptr<QualityScaler> quality_scaler_ ACCESS_ON(&encoder_queue_); |
pwestin@webrtc.org | 49888ce | 2012-04-27 05:25:53 +0000 | [diff] [blame] | 191 | |
Peter Boström | 7083e11 | 2015-09-22 16:28:51 +0200 | [diff] [blame] | 192 | SendStatisticsProxy* const stats_proxy_; |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 193 | rtc::VideoSinkInterface<VideoFrame>* const pre_encode_callback_; |
Peter Boström | 7083e11 | 2015-09-22 16:28:51 +0200 | [diff] [blame] | 194 | ProcessThread* module_process_thread_; |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 195 | rtc::ThreadChecker module_process_thread_checker_; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 196 | // |thread_checker_| checks that public methods that are related to lifetime |
| 197 | // of ViEEncoder are called on the same thread. |
| 198 | rtc::ThreadChecker thread_checker_; |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 199 | |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 200 | VideoEncoderConfig encoder_config_ ACCESS_ON(&encoder_queue_); |
Erik Språng | 08127a9 | 2016-11-16 16:41:30 +0100 | [diff] [blame] | 201 | std::unique_ptr<VideoBitrateAllocator> rate_allocator_ |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 202 | ACCESS_ON(&encoder_queue_); |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 203 | |
perkj | fa10b55 | 2016-10-02 23:45:26 -0700 | [diff] [blame] | 204 | // Set when ConfigureEncoder has been called in order to lazy reconfigure the |
| 205 | // encoder on the next frame. |
| 206 | bool pending_encoder_reconfiguration_ ACCESS_ON(&encoder_queue_); |
| 207 | rtc::Optional<VideoFrameInfo> last_frame_info_ ACCESS_ON(&encoder_queue_); |
Per | a48ddb7 | 2016-09-29 11:48:50 +0200 | [diff] [blame] | 208 | uint32_t encoder_start_bitrate_bps_ ACCESS_ON(&encoder_queue_); |
| 209 | size_t max_data_payload_length_ ACCESS_ON(&encoder_queue_); |
asapersson | 5f7226f | 2016-11-25 04:37:00 -0800 | [diff] [blame] | 210 | bool nack_enabled_ ACCESS_ON(&encoder_queue_); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 211 | uint32_t last_observed_bitrate_bps_ ACCESS_ON(&encoder_queue_); |
| 212 | bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); |
| 213 | bool has_received_sli_ ACCESS_ON(&encoder_queue_); |
| 214 | uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); |
| 215 | bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); |
| 216 | uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); |
| 217 | Clock* const clock_; |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 218 | // Counters used for deciding if the video resolution is currently |
| 219 | // restricted, and if so, why. |
kthelgason | 0cd27ba | 2016-12-19 06:32:16 -0800 | [diff] [blame] | 220 | std::vector<int> scale_counter_ ACCESS_ON(&encoder_queue_); |
kthelgason | 876222f | 2016-11-29 01:44:11 -0800 | [diff] [blame] | 221 | // Set depending on degradation preferences |
sprang | b1ca073 | 2017-02-01 08:38:12 -0800 | [diff] [blame] | 222 | VideoSendStream::DegradationPreference degradation_preference_ |
| 223 | ACCESS_ON(&encoder_queue_); |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 224 | |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 225 | // Pixel count last time the resolution was requested to be changed down. |
| 226 | rtc::Optional<int> max_pixel_count_ ACCESS_ON(&encoder_queue_); |
| 227 | // Pixel count last time the resolution was requested to be changed up. |
| 228 | rtc::Optional<int> max_pixel_count_step_up_ ACCESS_ON(&encoder_queue_); |
| 229 | |
| 230 | rtc::RaceChecker incoming_frame_race_checker_ |
| 231 | GUARDED_BY(incoming_frame_race_checker_); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 232 | Atomic32 posted_frames_waiting_for_encode_; |
| 233 | // Used to make sure incoming time stamp is increasing for every frame. |
| 234 | int64_t last_captured_timestamp_ GUARDED_BY(incoming_frame_race_checker_); |
| 235 | // Delta used for translating between NTP and internal timestamps. |
perkj | 803d97f | 2016-11-01 11:45:46 -0700 | [diff] [blame] | 236 | const int64_t delta_ntp_internal_ms_ GUARDED_BY(incoming_frame_race_checker_); |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 237 | |
asapersson | 6ffb67d | 2016-09-12 00:10:45 -0700 | [diff] [blame] | 238 | int64_t last_frame_log_ms_ GUARDED_BY(incoming_frame_race_checker_); |
| 239 | int captured_frame_count_ ACCESS_ON(&encoder_queue_); |
| 240 | int dropped_frame_count_ ACCESS_ON(&encoder_queue_); |
| 241 | |
sprang | 1a646ee | 2016-12-01 06:34:11 -0800 | [diff] [blame] | 242 | VideoBitrateAllocationObserver* bitrate_observer_ ACCESS_ON(&encoder_queue_); |
sprang | 57c2fff | 2017-01-16 06:24:02 -0800 | [diff] [blame] | 243 | rtc::Optional<int64_t> last_parameters_update_ms_ ACCESS_ON(&encoder_queue_); |
sprang | 1a646ee | 2016-12-01 06:34:11 -0800 | [diff] [blame] | 244 | |
perkj | 26091b1 | 2016-09-01 01:17:40 -0700 | [diff] [blame] | 245 | // All public methods are proxied to |encoder_queue_|. It must must be |
| 246 | // destroyed first to make sure no tasks are run that use other members. |
| 247 | rtc::TaskQueue encoder_queue_; |
perkj | a49cbd3 | 2016-09-16 07:53:41 -0700 | [diff] [blame] | 248 | |
| 249 | RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 250 | }; |
mflodman@webrtc.org | 84d1783 | 2011-12-01 17:02:23 +0000 | [diff] [blame] | 251 | |
| 252 | } // namespace webrtc |
| 253 | |
Peter Boström | 7623ce4 | 2015-12-09 12:13:30 +0100 | [diff] [blame] | 254 | #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ |