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

Side by Side Diff: webrtc/media/engine/videoencodersoftwarefallbackwrapper.h

Issue 3000693003: Move kMinPixelsPerFrame constant in VideoStreamEncoder to VideoEncoder::ScalingSettings. (Closed)
Patch Set: rebase Created 3 years, 4 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool SupportsNativeHandle() const override; 45 bool SupportsNativeHandle() const override;
46 ScalingSettings GetScalingSettings() const override; 46 ScalingSettings GetScalingSettings() const override;
47 const char *ImplementationName() const override; 47 const char *ImplementationName() const override;
48 48
49 private: 49 private:
50 bool InitFallbackEncoder(); 50 bool InitFallbackEncoder();
51 51
52 // If |forced_fallback_possible_| is true: 52 // If |forced_fallback_possible_| is true:
53 // The forced fallback is requested if the target bitrate is below |low_kbps| 53 // The forced fallback is requested if the target bitrate is below |low_kbps|
54 // for more than |min_low_ms| and the input video resolution is not larger 54 // for more than |min_low_ms| and the input video resolution is not larger
55 // than |kMaxPixels|. 55 // than |kMaxPixelsStart|.
56 // If the bitrate is above |high_kbps|, the forced fallback is requested to 56 // If the bitrate is above |high_kbps| and the resolution is not smaller than
57 // immediately be stopped. 57 // |kMinPixelsStop|, the forced fallback is requested to immediately be
58 // stopped.
58 class ForcedFallbackParams { 59 class ForcedFallbackParams {
59 public: 60 public:
60 bool ShouldStart(uint32_t bitrate_kbps, const VideoCodec& codec); 61 bool ShouldStart(uint32_t bitrate_kbps, const VideoCodec& codec);
61 bool ShouldStop(uint32_t bitrate_kbps) const; 62 bool ShouldStop(uint32_t bitrate_kbps, const VideoCodec& codec) const;
62 void Reset() { start_ms.reset(); } 63 void Reset() { start_ms.reset(); }
63 bool IsValid(const VideoCodec& codec) const { 64 bool IsValid(const VideoCodec& codec) const {
64 return codec.width * codec.height <= kMaxPixels; 65 return codec.width * codec.height <= kMaxPixelsStart;
65 } 66 }
66 rtc::Optional<int64_t> start_ms; // Set when bitrate is below |low_kbps|. 67 rtc::Optional<int64_t> start_ms; // Set when bitrate is below |low_kbps|.
67 uint32_t low_kbps = 100; 68 uint32_t low_kbps = 100;
68 uint32_t high_kbps = 150; 69 uint32_t high_kbps = 150;
69 int64_t min_low_ms = 10000; 70 int64_t min_low_ms = 10000;
70 const int kMaxPixels = 320 * 240; 71 const int kMaxPixelsStart = 320 * 240;
72 const int kMinPixelsStop = 320 * 180;
71 }; 73 };
72 74
73 bool RequestForcedFallback(); 75 bool RequestForcedFallback();
74 bool TryReleaseForcedFallbackEncoder(); 76 bool TryReleaseForcedFallbackEncoder();
75 bool TryReInitForcedFallbackEncoder(); 77 bool TryReInitForcedFallbackEncoder();
76 void ValidateSettingsForForcedFallback(); 78 void ValidateSettingsForForcedFallback();
77 bool IsForcedFallbackActive() const; 79 bool IsForcedFallbackActive() const;
78 80
79 // Settings used in the last InitEncode call and used if a dynamic fallback to 81 // Settings used in the last InitEncode call and used if a dynamic fallback to
80 // software is required. 82 // software is required.
(...skipping 18 matching lines...) Expand all
99 std::string fallback_implementation_name_; 101 std::string fallback_implementation_name_;
100 EncodedImageCallback* callback_; 102 EncodedImageCallback* callback_;
101 103
102 bool forced_fallback_possible_; 104 bool forced_fallback_possible_;
103 ForcedFallbackParams forced_fallback_; 105 ForcedFallbackParams forced_fallback_;
104 }; 106 };
105 107
106 } // namespace webrtc 108 } // namespace webrtc
107 109
108 #endif // WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_ 110 #endif // WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_
OLDNEW
« no previous file with comments | « webrtc/api/video_codecs/video_encoder.cc ('k') | webrtc/media/engine/videoencodersoftwarefallbackwrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698