diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
commit | 9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/libwebrtc/moz-patch-stack/0018.patch | |
parent | Initial commit. (diff) | |
download | thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/libwebrtc/moz-patch-stack/0018.patch')
-rw-r--r-- | third_party/libwebrtc/moz-patch-stack/0018.patch | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/third_party/libwebrtc/moz-patch-stack/0018.patch b/third_party/libwebrtc/moz-patch-stack/0018.patch new file mode 100644 index 0000000000..c097e221ad --- /dev/null +++ b/third_party/libwebrtc/moz-patch-stack/0018.patch @@ -0,0 +1,81 @@ +From: Dan Minor <dminor@mozilla.com> +Date: Thu, 21 Mar 2019 15:48:00 +0000 +Subject: Bug 1535584 - Restore UpdateCodecFrameSize to vp9_impl.cc; r=bwc + +Differential Revision: https://phabricator.services.mozilla.com/D23713 +Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0898f9cfe09273e1d86c38abdd576cdf273009f0 +--- + .../codecs/vp9/libvpx_vp9_encoder.cc | 50 +++++++++++++++++++ + 1 file changed, 50 insertions(+) + +diff --git a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc +index 35b13058a2..5877373b76 100644 +--- a/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc ++++ b/modules/video_coding/codecs/vp9/libvpx_vp9_encoder.cc +@@ -1159,6 +1159,14 @@ int LibvpxVp9Encoder::Encode(const VideoFrame& input_image, + config_changed_ = false; + } + ++ if (input_image.width() != codec_.width || ++ input_image.height() != codec_.height) { ++ int ret = UpdateCodecFrameSize(input_image); ++ if (ret < 0) { ++ return ret; ++ } ++ } ++ + RTC_DCHECK_EQ(input_image.width(), raw_->d_w); + RTC_DCHECK_EQ(input_image.height(), raw_->d_h); + +@@ -1286,6 +1294,48 @@ int LibvpxVp9Encoder::Encode(const VideoFrame& input_image, + return WEBRTC_VIDEO_CODEC_OK; + } + ++int LibvpxVp9Encoder::UpdateCodecFrameSize( ++ const VideoFrame& input_image) { ++ RTC_LOG(LS_INFO) << "Reconfiging VP from " << ++ codec_.width << "x" << codec_.height << " to " << ++ input_image.width() << "x" << input_image.height(); ++ // Preserve latest bitrate/framerate setting ++ // TODO: Mozilla - see below, we need to save more state here. ++ //uint32_t old_bitrate_kbit = config_->rc_target_bitrate; ++ //uint32_t old_framerate = codec_.maxFramerate; ++ ++ codec_.width = input_image.width(); ++ codec_.height = input_image.height(); ++ ++ vpx_img_free(raw_); ++ raw_ = vpx_img_wrap(NULL, VPX_IMG_FMT_I420, codec_.width, codec_.height, ++ 1, NULL); ++ // Update encoder context for new frame size. ++ config_->g_w = codec_.width; ++ config_->g_h = codec_.height; ++ ++ // Determine number of threads based on the image size and #cores. ++ config_->g_threads = NumberOfThreads(codec_.width, codec_.height, ++ num_cores_); ++ ++ // NOTE: We would like to do this the same way vp8 does it ++ // (with vpx_codec_enc_config_set()), but that causes asserts ++ // in AQ 3 (cyclic); and in AQ 0 it works, but on a resize to smaller ++ // than 1/2 x 1/2 original it asserts in convolve(). Given these ++ // bugs in trying to do it the "right" way, we basically re-do ++ // the initialization. ++ vpx_codec_destroy(encoder_); // clean up old state ++ int result = InitAndSetControlSettings(&codec_); ++ if (result == WEBRTC_VIDEO_CODEC_OK) { ++ // TODO: Mozilla rates have become much more complicated, we need to store ++ // more state or find another way of doing this. ++ //return SetRates(old_bitrate_kbit, old_framerate); ++ RTC_CHECK(false); ++ return WEBRTC_VIDEO_CODEC_UNINITIALIZED; ++ } ++ return result; ++} ++ + bool LibvpxVp9Encoder::PopulateCodecSpecific(CodecSpecificInfo* codec_specific, + absl::optional<int>* spatial_idx, + absl::optional<int>* temporal_idx, +-- +2.34.1 + |