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

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

Issue 2988963002: Add support for a forced software encoder fallback. (Closed)
Patch Set: add max pixel limit 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 28 matching lines...) Expand all
39 int32_t Encode(const VideoFrame& frame, 39 int32_t Encode(const VideoFrame& frame,
40 const CodecSpecificInfo* codec_specific_info, 40 const CodecSpecificInfo* codec_specific_info,
41 const std::vector<FrameType>* frame_types) override; 41 const std::vector<FrameType>* frame_types) override;
42 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; 42 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
43 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation, 43 int32_t SetRateAllocation(const BitrateAllocation& bitrate_allocation,
44 uint32_t framerate) override; 44 uint32_t framerate) override;
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 // If |forced_fallback_enabled_| is true and the encoded resolution
50 // is <= |max_pixels|:
51 // The forced fallback is enabled if the target bitrate is below |low_kbps|
52 // for more than |min_low_ms|. If the bitrate is above |high_kbps|, the forced
sprang_webrtc 2017/08/07 08:59:12 Does same time limit apply for high_kbps?
åsapersson 2017/08/08 10:40:54 No, updated comment.
53 // fallback is disabled.
54 struct ForcedFallbackParams {
55 rtc::Optional<int64_t> start_ms;
brandtr 2017/08/04 11:16:23 IIUC, start_ms is the timestamp when we go below |
åsapersson 2017/08/08 10:40:54 Added comment.
brandtr 2017/08/09 09:05:02 Thanks. It's easier to understand now.
56 uint32_t low_kbps = 100;
57 uint32_t high_kbps = 150;
58 int64_t min_low_ms = 10000;
59 const int max_pixels = 76800; // 320 * 240
brandtr 2017/08/04 11:16:23 Maybe remove comment and write max_pixels = 320 *
åsapersson 2017/08/08 10:40:54 Done.
60 };
61
49 private: 62 private:
50 bool InitFallbackEncoder(); 63 bool InitFallbackEncoder();
51 64
65 bool StartForcedFallback();
66 bool TryReleaseForcedFallbackEncoder();
67 bool TryReInitForcedFallbackEncoder();
68 void ValidateSettingsForForcedFallback();
69
52 // Settings used in the last InitEncode call and used if a dynamic fallback to 70 // Settings used in the last InitEncode call and used if a dynamic fallback to
53 // software is required. 71 // software is required.
54 VideoCodec codec_settings_; 72 VideoCodec codec_settings_;
55 int32_t number_of_cores_; 73 int32_t number_of_cores_;
56 size_t max_payload_size_; 74 size_t max_payload_size_;
57 75
58 // The last bitrate/framerate set, and a flag for noting they are set. 76 // The last bitrate/framerate set, and a flag for noting they are set.
59 bool rates_set_; 77 bool rates_set_;
60 BitrateAllocation bitrate_allocation_; 78 BitrateAllocation bitrate_allocation_;
61 uint32_t framerate_; 79 uint32_t framerate_;
62 80
63 // The last channel parameters set, and a flag for noting they are set. 81 // The last channel parameters set, and a flag for noting they are set.
64 bool channel_parameters_set_; 82 bool channel_parameters_set_;
65 uint32_t packet_loss_; 83 uint32_t packet_loss_;
66 int64_t rtt_; 84 int64_t rtt_;
67 85
68 const cricket::VideoCodec codec_; 86 const cricket::VideoCodec codec_;
69 webrtc::VideoEncoder* const encoder_; 87 webrtc::VideoEncoder* const encoder_;
70 88
71 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; 89 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_;
72 std::string fallback_implementation_name_; 90 std::string fallback_implementation_name_;
73 EncodedImageCallback* callback_; 91 EncodedImageCallback* callback_;
92
93 bool forced_fallback_enabled_;
brandtr 2017/08/04 11:16:23 How about |forced_fallback_possible_|? This member
åsapersson 2017/08/08 10:40:54 Done.
94 ForcedFallbackParams forced_fallback_;
74 }; 95 };
75 96
76 } // namespace webrtc 97 } // namespace webrtc
77 98
78 #endif // WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_ 99 #endif // WEBRTC_MEDIA_ENGINE_VIDEOENCODERSOFTWAREFALLBACKWRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698