summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/moz-patch-stack/0018.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/libwebrtc/moz-patch-stack/0018.patch
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.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.patch81
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
+