Skip to content

Commit fbd6a3a

Browse files
mfromanmozArchaeopteryx
authored andcommitted
Bug 1963852 - Vendor libwebrtc from ecde63eab5
Upstream commit: https://webrtc.googlesource.com/src/+/ecde63eab5b643e9d84220b8a50208b4cd8ad866 Do not crop to render resolution by default Disable cropping to render resolution by default. This functionality was added in https://webrtc-review.googlesource.com/c/src/+/381340 and https://webrtc-review.googlesource.com/c/src/+/382241 and was enabled by default to make things work with HW encoders which use render resolution to signal cropping. After discussions with AV1 folks the consensus is that encoders should not use render resolution to signal crop. Currently there is no way to signal crop in AV1 bitstream. There is a proposal for adding this info to AV1 metadata: AOMediaCodec/av1-spec#346. Bug: webrtc:405341160, b:402019802, b:405299912 Change-Id: I9cff9f2f8e7c9b8933fd0fbb100ce37221eaf084 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/382640 Reviewed-by: Danil Chapovalov <[email protected]> Commit-Queue: Sergey Silkin <[email protected]> Cr-Commit-Position: refs/heads/main@{#44228}
1 parent 9a5c55d commit fbd6a3a

File tree

4 files changed

+28
-11
lines changed

4 files changed

+28
-11
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
2-
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-05-16T17:54:26.514856+00:00.
2+
libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-05-16T17:55:29.566850+00:00.
33
# base of lastest vendoring
4-
0802e02aa2
4+
ecde63eab5

third_party/libwebrtc/modules/video_coding/codecs/av1/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ rtc_library("dav1d_decoder") {
3434

3535
deps = [
3636
"../..:video_codec_interface",
37+
"../../../../api:refcountedbase",
3738
"../../../../api:scoped_refptr",
3839
"../../../../api/environment",
3940
"../../../../api/video:encoded_image",
@@ -97,7 +98,6 @@ if (rtc_include_tests) {
9798
"../../../../api/video_codecs:video_codecs_api",
9899
"../../../../test:explicit_key_value_config",
99100
"../../../../test:test_support",
100-
"//third_party/abseil-cpp/absl/functional:any_invocable",
101101
]
102102

103103
if (enable_libaom) {

third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder.cc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,24 @@
1111
#include "modules/video_coding/codecs/av1/dav1d_decoder.h"
1212

1313
#include <algorithm>
14+
#include <cstdint>
15+
#include <memory>
16+
#include <optional>
1417

18+
#include "api/environment/environment.h"
19+
#include "api/ref_counted_base.h"
1520
#include "api/scoped_refptr.h"
1621
#include "api/video/encoded_image.h"
22+
#include "api/video/video_frame.h"
1723
#include "api/video/video_frame_buffer.h"
24+
#include "api/video_codecs/video_decoder.h"
1825
#include "common_video/include/video_frame_buffer.h"
1926
#include "modules/video_coding/include/video_error_codes.h"
2027
#include "rtc_base/logging.h"
28+
#include "third_party/dav1d/libdav1d/include/dav1d/data.h"
2129
#include "third_party/dav1d/libdav1d/include/dav1d/dav1d.h"
22-
#include "third_party/libyuv/include/libyuv/convert.h"
23-
#include "third_party/libyuv/include/libyuv/planar_functions.h"
30+
#include "third_party/dav1d/libdav1d/include/dav1d/headers.h"
31+
#include "third_party/dav1d/libdav1d/include/dav1d/picture.h"
2432

2533
namespace webrtc {
2634
namespace {
@@ -47,7 +55,7 @@ class Dav1dDecoder : public VideoDecoder {
4755
Dav1dContext* context_ = nullptr;
4856
DecodedImageCallback* decode_complete_callback_ = nullptr;
4957

50-
const bool crop_to_render_resolution_ = true;
58+
const bool crop_to_render_resolution_ = false;
5159
};
5260

5361
class ScopedDav1dData {
@@ -80,7 +88,7 @@ void NullFreeCallback(const uint8_t* /* buffer */, void* /* opaque */) {}
8088
Dav1dDecoder::Dav1dDecoder() = default;
8189

8290
Dav1dDecoder::Dav1dDecoder(const Environment& env)
83-
: crop_to_render_resolution_(!env.field_trials().IsDisabled(
91+
: crop_to_render_resolution_(env.field_trials().IsEnabled(
8492
"WebRTC-Dav1dDecoder-CropToRenderResolution")) {}
8593

8694
Dav1dDecoder::~Dav1dDecoder() {

third_party/libwebrtc/modules/video_coding/codecs/av1/dav1d_decoder_unittest.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
#include "modules/video_coding/codecs/av1/dav1d_decoder.h"
1212

13+
#include <cstdint>
1314
#include <memory>
1415
#include <optional>
15-
#include <string>
1616
#include <utility>
1717

18-
#include "absl/functional/any_invocable.h"
1918
#include "api/array_view.h"
2019
#include "api/environment/environment.h"
2120
#include "api/environment/environment_factory.h"
@@ -88,15 +87,25 @@ class TestAv1Decoder : public DecodedImageCallback {
8887
std::optional<VideoFrame> decoded_frame_;
8988
};
9089

91-
TEST(Dav1dDecoderTest, CropsToRenderResolutionByDefault) {
90+
TEST(Dav1dDecoderTest, KeepsDecodedResolutionByDefault) {
9291
TestAv1Decoder decoder(CreateEnvironment());
92+
decoder.Decode(
93+
CreateEncodedImage(kAv1FrameWith36x20EncodededAnd32x16RenderResolution));
94+
EXPECT_EQ(decoder.decoded_frame().width(), 36);
95+
EXPECT_EQ(decoder.decoded_frame().height(), 20);
96+
}
97+
98+
TEST(Dav1dDecoderTest, CropsToRenderResolutionWhenCropIsEnabled) {
99+
TestAv1Decoder decoder(
100+
CreateEnvironment(std::make_unique<ExplicitKeyValueConfig>(
101+
"WebRTC-Dav1dDecoder-CropToRenderResolution/Enabled/")));
93102
decoder.Decode(
94103
CreateEncodedImage(kAv1FrameWith36x20EncodededAnd32x16RenderResolution));
95104
EXPECT_EQ(decoder.decoded_frame().width(), 32);
96105
EXPECT_EQ(decoder.decoded_frame().height(), 16);
97106
}
98107

99-
TEST(Dav1dDecoderTest, KeepsDecodedResolutionWhenCropIsDisabled) {
108+
TEST(Dav1dDecoderTest, DoesNotCropToRenderResolutionWhenCropIsDisabled) {
100109
TestAv1Decoder decoder(
101110
CreateEnvironment(std::make_unique<ExplicitKeyValueConfig>(
102111
"WebRTC-Dav1dDecoder-CropToRenderResolution/Disabled/")));

0 commit comments

Comments
 (0)