Backed out 2 changesets (bug 1868032) for causing multiple failures
Backed out changeset 5ca219e6d02a (bug 1868032) Backed out changeset 2e5e0a43e77e (bug 1868032)
This commit is contained in:
@@ -67,8 +67,7 @@ bool VideoInfo::operator==(const VideoInfo& rhs) const {
|
||||
*mCodecSpecificConfig == *rhs.mCodecSpecificConfig &&
|
||||
*mExtraData == *rhs.mExtraData && mRotation == rhs.mRotation &&
|
||||
mColorDepth == rhs.mColorDepth && mImageRect == rhs.mImageRect &&
|
||||
mAlphaPresent == rhs.mAlphaPresent &&
|
||||
mPixelAspectRatio == rhs.mPixelAspectRatio);
|
||||
mAlphaPresent == rhs.mAlphaPresent);
|
||||
}
|
||||
|
||||
nsCString VideoInfo::ToString() const {
|
||||
@@ -144,8 +143,6 @@ nsCString VideoInfo::ToString() const {
|
||||
if (mFrameRate) {
|
||||
rv.AppendPrintf(", frame rate: %dHz", mFrameRate.value());
|
||||
}
|
||||
rv.AppendPrintf(", pixel aspect ratio: %f",
|
||||
mPixelAspectRatio ? *mPixelAspectRatio : 0.0);
|
||||
return std::move(rv);
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +374,6 @@ class VideoInfo : public TrackInfo {
|
||||
mImageRect = aOther.mImageRect;
|
||||
mAlphaPresent = aOther.mAlphaPresent;
|
||||
mFrameRate = aOther.mFrameRate;
|
||||
mPixelAspectRatio = aOther.mPixelAspectRatio;
|
||||
};
|
||||
|
||||
bool operator==(const VideoInfo& rhs) const;
|
||||
@@ -485,10 +484,6 @@ class VideoInfo : public TrackInfo {
|
||||
Maybe<int32_t> GetFrameRate() const { return mFrameRate; }
|
||||
void SetFrameRate(int32_t aRate) { mFrameRate = Some(aRate); }
|
||||
|
||||
// Some formats include pixel aspect ratio information, such as the `pasp` box
|
||||
// in MP4.
|
||||
Maybe<float> mPixelAspectRatio;
|
||||
|
||||
private:
|
||||
friend struct IPC::ParamTraits<VideoInfo>;
|
||||
|
||||
|
||||
@@ -341,14 +341,6 @@ MediaResult MP4VideoInfo::Update(const Mp4parseTrackInfo* track,
|
||||
mImage.width = video->sample_info[0].image_width;
|
||||
mImage.height = video->sample_info[0].image_height;
|
||||
mRotation = ToSupportedRotation(video->rotation);
|
||||
if (video->pixel_aspect_ratio > 0) {
|
||||
double width = mImage.Width() * video->pixel_aspect_ratio;
|
||||
// Only apply the change is the value is valid.
|
||||
if (width <= std::numeric_limits<int32_t>::max()) {
|
||||
mPixelAspectRatio = Some(video->pixel_aspect_ratio);
|
||||
mDisplay.width = static_cast<int32_t>(width);
|
||||
}
|
||||
}
|
||||
Mp4parseByteData extraData = video->sample_info[0].extra_data;
|
||||
// If length is 0 we append nothing
|
||||
mExtraData->AppendElements(extraData.data, extraData.length);
|
||||
|
||||
@@ -333,11 +333,7 @@ MP4TrackDemuxer::MP4TrackDemuxer(MediaResource* aResource,
|
||||
mType = kH264;
|
||||
RefPtr<MediaByteBuffer> extraData = videoInfo->mExtraData;
|
||||
SPSData spsdata;
|
||||
// FFmpeg prioritize the display size from the container level over the
|
||||
// SPS-defined SAR. We'd like follow the same way. Only use SPS-defined SAR
|
||||
// when no pixel aspect ratio exists in the media info.
|
||||
if (!videoInfo->mPixelAspectRatio &&
|
||||
H264::DecodeSPSFromExtraData(extraData, spsdata) &&
|
||||
if (H264::DecodeSPSFromExtraData(extraData, spsdata) &&
|
||||
spsdata.pic_width > 0 && spsdata.pic_height > 0 &&
|
||||
H264::EnsureSPSIsSane(spsdata)) {
|
||||
videoInfo->mImage.width = spsdata.pic_width;
|
||||
@@ -351,18 +347,13 @@ MP4TrackDemuxer::MP4TrackDemuxer(MediaResource* aResource,
|
||||
mType = kAAC;
|
||||
} else if (videoInfo && MP4Decoder::IsHEVC(mInfo->mMimeType)) {
|
||||
mType = kHEVC;
|
||||
// FFmpeg prioritize the display size from the container level over the
|
||||
// SPS-defined SAR. We'd like follow the same way. Only use SPS-defined SAR
|
||||
// when no pixel aspect ratio exists in the media info.
|
||||
if (!videoInfo->mPixelAspectRatio) {
|
||||
if (auto rv = H265::DecodeSPSFromHVCCExtraData(videoInfo->mExtraData);
|
||||
rv.isOk()) {
|
||||
const auto sps = rv.unwrap();
|
||||
videoInfo->mImage.width = sps.GetImageSize().Width();
|
||||
videoInfo->mImage.height = sps.GetImageSize().Height();
|
||||
videoInfo->mDisplay.width = sps.GetDisplaySize().Width();
|
||||
videoInfo->mDisplay.height = sps.GetDisplaySize().Height();
|
||||
}
|
||||
if (auto rv = H265::DecodeSPSFromHVCCExtraData(videoInfo->mExtraData);
|
||||
rv.isOk()) {
|
||||
const auto sps = rv.unwrap();
|
||||
videoInfo->mImage.width = sps.GetImageSize().Width();
|
||||
videoInfo->mImage.height = sps.GetImageSize().Height();
|
||||
videoInfo->mDisplay.width = sps.GetDisplaySize().Width();
|
||||
videoInfo->mDisplay.height = sps.GetDisplaySize().Height();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,9 +54,6 @@ inline gfx::IntSize ApplyPixelAspectRatio(double aPixelAspectRatio,
|
||||
if (MOZ_UNLIKELY(width > std::numeric_limits<int32_t>::max())) {
|
||||
return aImage;
|
||||
}
|
||||
LOG("Adjust display size [%ux%u] -> [%ux%u] by applying PAR %f",
|
||||
aImage.Width(), aImage.Height(), static_cast<uint32_t>(width),
|
||||
aImage.Height(), aPixelAspectRatio);
|
||||
return gfx::IntSize(static_cast<int32_t>(width), aImage.Height());
|
||||
}
|
||||
|
||||
@@ -169,13 +166,8 @@ class H264ChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
|
||||
H264::EnsureSPSIsSane(spsdata);
|
||||
mCurrentConfig.mImage.width = spsdata.pic_width;
|
||||
mCurrentConfig.mImage.height = spsdata.pic_height;
|
||||
// FFmpeg prioritize the display size from the container level over the
|
||||
// SPS-defined SAR. We'd like follow the same way. Only use SPS-defined
|
||||
// SAR when no pixel aspect ratio exists in the media info.
|
||||
if (!mCurrentConfig.mPixelAspectRatio) {
|
||||
mCurrentConfig.mDisplay.width = spsdata.display_width;
|
||||
mCurrentConfig.mDisplay.height = spsdata.display_height;
|
||||
}
|
||||
mCurrentConfig.mDisplay.width = spsdata.display_width;
|
||||
mCurrentConfig.mDisplay.height = spsdata.display_height;
|
||||
mCurrentConfig.mColorDepth = spsdata.ColorDepth();
|
||||
mCurrentConfig.mColorSpace = Some(spsdata.ColorSpace());
|
||||
// spsdata.colour_primaries has the same values as
|
||||
@@ -317,18 +309,13 @@ class HEVCChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
|
||||
const auto sps = rv.unwrap();
|
||||
mCurrentConfig.mImage.width = sps.GetImageSize().Width();
|
||||
mCurrentConfig.mImage.height = sps.GetImageSize().Height();
|
||||
// FFmpeg prioritize the display size from the container level over the
|
||||
// SPS-defined SAR. We'd like follow the same way. Only use SPS-defined
|
||||
// SAR when no pixel aspect ratio exists in the media info.
|
||||
if (!mCurrentConfig.mPixelAspectRatio) {
|
||||
if (const auto& vui = sps.vui_parameters;
|
||||
vui && vui->HasValidAspectRatio()) {
|
||||
mCurrentConfig.mDisplay = ApplyPixelAspectRatio(
|
||||
vui->GetPixelAspectRatio(), mCurrentConfig.mImage);
|
||||
} else {
|
||||
mCurrentConfig.mDisplay.width = sps.GetDisplaySize().Width();
|
||||
mCurrentConfig.mDisplay.height = sps.GetDisplaySize().Height();
|
||||
}
|
||||
if (const auto& vui = sps.vui_parameters;
|
||||
vui && vui->HasValidAspectRatio()) {
|
||||
mCurrentConfig.mDisplay = ApplyPixelAspectRatio(
|
||||
vui->GetPixelAspectRatio(), mCurrentConfig.mImage);
|
||||
} else {
|
||||
mCurrentConfig.mDisplay.width = sps.GetDisplaySize().Width();
|
||||
mCurrentConfig.mDisplay.height = sps.GetDisplaySize().Height();
|
||||
}
|
||||
mCurrentConfig.mColorDepth = sps.ColorDepth();
|
||||
mCurrentConfig.mColorSpace = Some(sps.ColorSpace());
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Cache-Control: no-store
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Cache-Control: no-store
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Cache-Control: no-store
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Cache-Control: no-store
|
||||
@@ -59,21 +59,6 @@ support-files = [
|
||||
"aspect_ratio_5_2_hevc.mp4^headers^",
|
||||
"av1.mp4",
|
||||
"av1.mp4^headers^",
|
||||
# The following files are generated using these commands:
|
||||
# 1. create by ffmpeg
|
||||
# ffmpeg -f lavfi -i testsrc=s=720x576:d=1 -c:v libx264 -t 1 -pix_fmt yuv420p -preset veryslow -tune zerolatency -bsf:v "h264_metadata=sample_aspect_ratio=0" -movflags +faststart -brand mp42 -y avc_pasp_64_45_no_sar_in_sps.mp4
|
||||
# ffmpeg -f lavfi -i testsrc=s=720x576:d=1 -c:v libx264 -t 1 -pix_fmt yuv420p -preset veryslow -tune zerolatency -bsf:v "h264_metadata=sample_aspect_ratio=2" -movflags +faststart -brand mp42 -y avc_pasp_64_45_sps_sar_2.mp4
|
||||
# ffmpeg -f lavfi -i testsrc=s=720x576:d=1 -c:v libx265 -t 1 -pix_fmt yuv420p -preset veryslow -tune zerolatency -bsf:v "hevc_metadata=sample_aspect_ratio=0" -movflags +faststart -brand mp42 -y hevc_pasp_64_45_no_sar_in_sps.mp4
|
||||
# ffmpeg -f lavfi -i testsrc=s=720x576:d=1 -c:v libx265 -t 1 -pix_fmt yuv420p -preset veryslow -tune zerolatency -bsf:v "hevc_metadata=sample_aspect_ratio=2" -movflags +faststart -brand mp42 -y hevc_pasp_64_45_sps_sar_2.mp4
|
||||
# 2. manually modify pasp box's content in hex editor, set `h_spacing` to `0x40` and `v_spacing` to `0x2D`
|
||||
"avc_pasp_64_45_no_sar_in_sps.mp4",
|
||||
"avc_pasp_64_45_no_sar_in_sps.mp4^headers^",
|
||||
"avc_pasp_64_45_sps_sar_2.mp4",
|
||||
"avc_pasp_64_45_sps_sar_2.mp4^headers^",
|
||||
"hevc_pasp_64_45_no_sar_in_sps.mp4",
|
||||
"hevc_pasp_64_45_no_sar_in_sps.mp4^headers^",
|
||||
"hevc_pasp_64_45_sps_sar_2.mp4",
|
||||
"hevc_pasp_64_45_sps_sar_2.mp4^headers^",
|
||||
"background_video.js",
|
||||
"badtags.ogg",
|
||||
"badtags.ogg^headers^",
|
||||
@@ -884,17 +869,6 @@ scheme = "https"
|
||||
|
||||
["test_mp3_with_multiple_ID3v2.html"]
|
||||
|
||||
["test_mp4_pixel_aspect_ratio_avc.html"]
|
||||
skip-if = ["wmfme"] # media engine can't determine the correct size internally
|
||||
|
||||
["test_mp4_pixel_aspect_ratio_hevc.html"]
|
||||
run-if = [
|
||||
"os == 'win'",
|
||||
"os == 'mac' && os_version != '10.15'" # Bug 1942396
|
||||
]
|
||||
skip-if = ["!mda_gpu", "wmfme"] # media engine can't determine the correct size internally
|
||||
scheme = "https"
|
||||
|
||||
["test_networkState.html"]
|
||||
|
||||
["test_new_audio.html"]
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test pixel aspect ratio for MP4 AVC</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/**
|
||||
* This test checks whether mp4 files are played backed correctly w.r.t.
|
||||
* display size, which will be determined by SAR information from either SPS or
|
||||
* PASP box. We prefer PASP box over SPS.
|
||||
*/
|
||||
add_task(async function testMP4PixelAspectRatio() {
|
||||
const tests = [
|
||||
{
|
||||
file: 'avc_pasp_64_45_no_sar_in_sps.mp4',
|
||||
expectedWidth: 1024,
|
||||
expectedHeight: 576,
|
||||
pixelRatioFrom : "PASP Box"
|
||||
},
|
||||
{
|
||||
file: 'avc_pasp_64_45_sps_sar_2.mp4',
|
||||
expectedWidth: 1024,
|
||||
expectedHeight: 576,
|
||||
pixelRatioFrom : "PASP Box"
|
||||
},
|
||||
];
|
||||
for (let test of tests) {
|
||||
let video = document.createElement('video');
|
||||
info(`try to play ${test.file}, pixel aspect ratio from ${test.pixelRatioFrom}`);
|
||||
video.src = test.file;
|
||||
video.controls = true;
|
||||
document.body.appendChild(video);
|
||||
ok(await video.play().then(_=>true, _=>false), "video started playing");
|
||||
is(video.videoWidth, test.expectedWidth, `expect width ${test.expectedWidth}, actual width ${video.videoWidth}`);
|
||||
is(video.videoHeight, test.expectedHeight, `expect height ${test.expectedHeight}, actual height ${video.videoHeight}`);
|
||||
ok(await new Promise(r => video.onended = r).then(_=>true, _=>false),
|
||||
"video played to end");
|
||||
removeNodeAndSource(video);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,49 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test pixel aspect ratio for MP4 HEVC</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/**
|
||||
* This test checks whether mp4 files are played backed correctly w.r.t.
|
||||
* display size, which will be determined by SAR information from either SPS or
|
||||
* PASP box. We prefer PASP box over SPS.
|
||||
*/
|
||||
add_task(async function testMP4PixelAspectRatio() {
|
||||
const tests = [
|
||||
{
|
||||
file: 'hevc_pasp_64_45_no_sar_in_sps.mp4',
|
||||
expectedWidth: 1024,
|
||||
expectedHeight: 576,
|
||||
pixelRatioFrom : "PASP Box"
|
||||
},
|
||||
{
|
||||
file: 'hevc_pasp_64_45_sps_sar_2.mp4',
|
||||
expectedWidth: 1024,
|
||||
expectedHeight: 576,
|
||||
pixelRatioFrom : "PASP Box"
|
||||
},
|
||||
];
|
||||
for (let test of tests) {
|
||||
let video = document.createElement('video');
|
||||
info(`try to play ${test.file}, pixel aspect ratio from ${test.pixelRatioFrom}`);
|
||||
video.src = test.file;
|
||||
video.controls = true;
|
||||
document.body.appendChild(video);
|
||||
ok(await video.play().then(_=>true, _=>false), "video started playing");
|
||||
is(video.videoWidth, test.expectedWidth, `expect width ${test.expectedWidth}, actual width ${video.videoWidth}`);
|
||||
is(video.videoHeight, test.expectedHeight, `expect height ${test.expectedHeight}, actual height ${video.videoHeight}`);
|
||||
ok(await new Promise(r => video.onended = r).then(_=>true, _=>false),
|
||||
"video played to end");
|
||||
removeNodeAndSource(video);
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user