Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: webrtc/video/vie_encoder.h

Issue 2652893015: Rename adaptation api methods, extended vie_encoder unit test. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // and produces an encoded bit stream. 43 // and produces an encoded bit stream.
44 // Usage: 44 // Usage:
45 // Instantiate. 45 // Instantiate.
46 // Call SetSink. 46 // Call SetSink.
47 // Call SetSource. 47 // Call SetSource.
48 // Call ConfigureEncoder with the codec settings. 48 // Call ConfigureEncoder with the codec settings.
49 // Call Stop() when done. 49 // Call Stop() when done.
50 class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>, 50 class ViEEncoder : public rtc::VideoSinkInterface<VideoFrame>,
51 public EncodedImageCallback, 51 public EncodedImageCallback,
52 public VCMSendStatisticsCallback, 52 public VCMSendStatisticsCallback,
53 public ScalingObserverInterface { 53 public AdaptationObserverInterface {
54 public: 54 public:
55 // Interface for receiving encoded video frames and notifications about 55 // Interface for receiving encoded video frames and notifications about
56 // configuration changes. 56 // configuration changes.
57 class EncoderSink : public EncodedImageCallback { 57 class EncoderSink : public EncodedImageCallback {
58 public: 58 public:
59 virtual void OnEncoderConfigurationChanged( 59 virtual void OnEncoderConfigurationChanged(
60 std::vector<VideoStream> streams, 60 std::vector<VideoStream> streams,
61 int min_transmit_bitrate_bps) = 0; 61 int min_transmit_bitrate_bps) = 0;
62 }; 62 };
63 63
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 uint8_t fraction_lost, 113 uint8_t fraction_lost,
114 int64_t round_trip_time_ms); 114 int64_t round_trip_time_ms);
115 115
116 protected: 116 protected:
117 // Used for testing. For example the |ScalingObserverInterface| methods must 117 // Used for testing. For example the |ScalingObserverInterface| methods must
118 // be called on |encoder_queue_|. 118 // be called on |encoder_queue_|.
119 rtc::TaskQueue* encoder_queue() { return &encoder_queue_; } 119 rtc::TaskQueue* encoder_queue() { return &encoder_queue_; }
120 120
121 // webrtc::ScalingObserverInterface implementation. 121 // webrtc::ScalingObserverInterface implementation.
122 // These methods are protected for easier testing. 122 // These methods are protected for easier testing.
123 void ScaleUp(ScaleReason reason) override; 123 void AdaptUp(AdaptReason reason) override;
124 void ScaleDown(ScaleReason reason) override; 124 void AdaptDown(AdaptReason reason) override;
125 125
126 private: 126 private:
127 class ConfigureEncoderTask; 127 class ConfigureEncoderTask;
128 class EncodeTask; 128 class EncodeTask;
129 class VideoSourceProxy; 129 class VideoSourceProxy;
130 130
131 class VideoFrameInfo { 131 class VideoFrameInfo {
132 public: 132 public:
133 VideoFrameInfo(int width, 133 VideoFrameInfo(int width,
134 int height, 134 int height,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_); 208 bool encoder_paused_and_dropped_frame_ ACCESS_ON(&encoder_queue_);
209 bool has_received_sli_ ACCESS_ON(&encoder_queue_); 209 bool has_received_sli_ ACCESS_ON(&encoder_queue_);
210 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_); 210 uint8_t picture_id_sli_ ACCESS_ON(&encoder_queue_);
211 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_); 211 bool has_received_rpsi_ ACCESS_ON(&encoder_queue_);
212 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_); 212 uint64_t picture_id_rpsi_ ACCESS_ON(&encoder_queue_);
213 Clock* const clock_; 213 Clock* const clock_;
214 // Counters used for deciding if the video resolution is currently 214 // Counters used for deciding if the video resolution is currently
215 // restricted, and if so, why. 215 // restricted, and if so, why.
216 std::vector<int> scale_counter_ ACCESS_ON(&encoder_queue_); 216 std::vector<int> scale_counter_ ACCESS_ON(&encoder_queue_);
217 // Set depending on degradation preferences 217 // Set depending on degradation preferences
218 bool scaling_enabled_ ACCESS_ON(&encoder_queue_) = false; 218 VideoSendStream::DegradationPreference degradation_preference_
219 ACCESS_ON(&encoder_queue_);
219 220
220 // Pixel count last time the resolution was requested to be changed down. 221 // Pixel count last time the resolution was requested to be changed down.
221 rtc::Optional<int> max_pixel_count_ ACCESS_ON(&encoder_queue_); 222 rtc::Optional<int> max_pixel_count_ ACCESS_ON(&encoder_queue_);
222 // Pixel count last time the resolution was requested to be changed up. 223 // Pixel count last time the resolution was requested to be changed up.
223 rtc::Optional<int> max_pixel_count_step_up_ ACCESS_ON(&encoder_queue_); 224 rtc::Optional<int> max_pixel_count_step_up_ ACCESS_ON(&encoder_queue_);
224 225
225 rtc::RaceChecker incoming_frame_race_checker_ 226 rtc::RaceChecker incoming_frame_race_checker_
226 GUARDED_BY(incoming_frame_race_checker_); 227 GUARDED_BY(incoming_frame_race_checker_);
227 Atomic32 posted_frames_waiting_for_encode_; 228 Atomic32 posted_frames_waiting_for_encode_;
228 // Used to make sure incoming time stamp is increasing for every frame. 229 // Used to make sure incoming time stamp is increasing for every frame.
(...skipping 11 matching lines...) Expand all
240 // 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
241 // 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.
242 rtc::TaskQueue encoder_queue_; 243 rtc::TaskQueue encoder_queue_;
243 244
244 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder); 245 RTC_DISALLOW_COPY_AND_ASSIGN(ViEEncoder);
245 }; 246 };
246 247
247 } // namespace webrtc 248 } // namespace webrtc
248 249
249 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_ 250 #endif // WEBRTC_VIDEO_VIE_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698