Bug 1706917 Comment 23 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[VideoStream::scale_resolution_down_by](https://searchfox.org/mozilla-central/rev/fb8d77331582639ea6848a61dd8ee812fac31b77/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#50)

I don't see anything setting this besides things like [bulk adjustment factors](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#25-50), [ceilings](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#100-101), and [floors](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#98-99). The [comment](https://searchfox.org/mozilla-central/rev/fb8d77331582639ea6848a61dd8ee812fac31b77/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#48-49) seems to indicate that setting this does not cause the dimensions to be further downscaled, but it is possible that failing to set this field will confuse things further down the line, possibly in subtle and hard to diagnose ways. Chromium does seem to set this. **Query: What bugs might this be causing?**
[VideoStream::scale_resolution_down_by](https://searchfox.org/mozilla-central/rev/fb8d77331582639ea6848a61dd8ee812fac31b77/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#50)

I don't see anything setting this besides things like [bulk adjustment factors](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#25-50), [ceilings](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#100-101), and [floors](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#98-99). The [comment](https://searchfox.org/mozilla-central/rev/fb8d77331582639ea6848a61dd8ee812fac31b77/third_party/libwebrtc/api/video_codecs/video_encoder_config.h#48-49) seems to indicate that setting this does not cause the dimensions to be further downscaled, but it is possible that failing to set this field will confuse things further down the line, possibly in subtle and hard to diagnose ways. Chromium does seem to set this.

**Query: What bugs might this be causing?**

If this is causing a bug, it would be related to [AlignmentAdjuster::GetAlignmentAndMaybeAdjustScaleFactors](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.cc#83), the only user of this field. This is called from [VideoStreamEncoder::ReconfigureEncoder](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/video_stream_encoder.cc#578-579) right before the call to [VideoStreamFactory::CreateEncoderStreams](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/dom/media/webrtc/libwebrtcglue/VideoStreamFactory.cpp#122). So, we might be getting our alignment calculations for simulcast wrong. I am not 100% sure what the consequences are of this, but [this comment](https://searchfox.org/mozilla-central/rev/6deb8b6af57a8b5b6b1bcb143ea498e566475d8d/third_party/libwebrtc/video/alignment_adjuster.h#25-30) hints that we could end up with bad cropping or aspect ratio.

Back to Bug 1706917 Comment 23