diff --git a/.gitignore b/.gitignore index e69de29..821c45c 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,424 @@ +firefox-langpacks-3.6.4-20100622.tar.bz2 +firefox-3.6.4.source.tar.bz2 +/firefox-3.6.9.source.tar.bz2 +/firefox-langpacks-3.6.9-20100906.tar.bz2 +/firefox-3.6.11.source.tar.bz2 +/firefox-langpacks-3.6.11-20101019.tar.bz2 +/firefox-3.6.12.source.tar.bz2 +/firefox-langpacks-3.6.12-20101027.tar.bz2 +/firefox-3.6.13.source.tar.bz2 +/firefox-langpacks-3.6.13-20101210.tar.bz2 +/firefox-3.6.14.source.tar.bz2 +/firefox-langpacks-3.6.14-20110301.tar.bz2 +/firefox-3.6.15.source.tar.bz2 +/firefox-langpacks-3.6.15-20110307.tar.bz2 +/firefox-3.6.16.source.tar.bz2 +/firefox-langpacks-3.6.16-20110322.tar.xz +/firefox-langpacks-3.6.17-20110428.tar.xz +/firefox-3.6.17.source.tar.bz2 +/firefox-3.6.18.source.tar.bz2 +/firefox-langpacks-3.6.18-20110621.tar.xz +/firefox-3.6.22.source.tar.bz2 +/firefox-langpacks-3.6.22-20110906.tar.xz +/firefox-langpacks-3.6.20-20110816.tar.xz +/firefox-3.6.20.source.tar.bz2 +/firefox-7.0.source.tar.bz2 +/firefox-langpacks-7.0-20110927.tar.xz +/firefox-7.0.1.source.tar.bz2 +/firefox-langpacks-7.0.1-20110930.tar.xz +/firefox-8.0.source.tar.bz2 +/firefox-langpacks-8.0-20111108.tar.xz +/firefox-9.0b5.source.tar.bz2 +/firefox-langpacks-9.0b5-20111215.tar.xz +/firefox-9.0.source.tar.bz2 +/firefox-langpacks-9.0-20111220.tar.xz +/firefox-9.0.1.source.tar.bz2 +/firefox-langpacks-9.0.1-20111223.tar.xz +/firefox-10.0.source.tar.bz2 +/firefox-langpacks-10.0-20120131.tar.xz +/firefox-10.0.1.source.tar.bz2 +/firefox-langpacks-10.0.1-20120209.tar.xz +/firefox-11.0.source.tar.bz2 +/firefox-langpacks-11.0-20120313.tar.xz +/firefox-12.0.source.tar.bz2 +/firefox-langpacks-12.0-20120424.tar.xz +/firefox-13.0.source.tar.bz2 +/firefox-langpacks-13.0-20120604.tar.xz +/firefox-13.0.1.source.tar.bz2 +/firefox-langpacks-13.0.1-20120616.tar.xz +/firefox-14.0.1.source.tar.bz2 +/firefox-langpacks-14.0.1-20120716.tar.xz +/firefox-15.0.source.tar.bz2 +/firefox-langpacks-15.0-20120827.tar.xz +/firefox-15.0.1.source.tar.bz2 +/firefox-langpacks-15.0.1-20120911.tar.xz +/firefox-16.0.source.tar.bz2 +/firefox-langpacks-16.0-20121008.tar.xz +/firefox-16.0.1.source.tar.bz2 +/firefox-langpacks-16.0.1-20121011.tar.xz +/firefox-16.0.2.source.tar.bz2 +/firefox-langpacks-16.0.2-20121026.tar.xz +/firefox-langpacks-17.0-20121119.tar.xz +/firefox-17.0.source.tar.bz2 +/firefox-17.0.1.source.tar.bz2 +/firefox-langpacks-17.0.1-20121129.tar.xz +/firefox-langpacks-18.0-20130109.tar.xz +/firefox-18.0.source.tar.bz2 +/firefox-18.0.1.source.tar.bz2 +/firefox-langpacks-18.0.1-20130125.tar.xz +/firefox-18.0.2.source.tar.bz2 +/firefox-langpacks-18.0.2-20130206.tar.xz +/firefox-19.0.source.tar.bz2 +/firefox-langpacks-19.0-20130219.tar.xz +/firefox-19.0.2.source.tar.bz2 +/firefox-langpacks-19.0.2-20130311.tar.xz +/firefox-langpacks-20.0-20130401.tar.xz +/firefox-20.0.source.tar.bz2 +/firefox-21.0.source.tar.bz2 +/firefox-langpacks-21.0-20130514.tar.xz +/firefox-22.0.source.tar.bz2 +/firefox-langpacks-22.0-20130621.tar.xz +/firefox-23.0.source.tar.bz2 +/firefox-langpacks-23.0-20130731.tar.xz +/firefox-langpacks-23.0-20130805.tar.xz +/firefox-23.0.1.source.tar.bz2 +/firefox-langpacks-23.0.1-20130819.tar.xz +/firefox-langpacks-24.0-20130913.tar.xz +/firefox-24.0.source.tar.bz2 +/firefox-25.0.source.tar.bz2 +/firefox-langpacks-25.0-20131024.tar.xz +/firefox-langpacks-25.0-20131030.tar.xz +/firefox-26.0.source.tar.bz2 +/firefox-langpacks-26.0-20131209.tar.xz +/firefox-27.0.source.tar.bz2 +/firefox-langpacks-27.0-20140203.tar.xz +/firefox-27.0.1.source.tar.bz2 +/firefox-langpacks-27.0.1-20140224.tar.xz +/firefox-28.0.source.tar.bz2 +/firefox-langpacks-28.0-20140318.tar.xz +/firefox-29.0.source.tar.bz2 +/firefox-langpacks-29.0-20140422.tar.xz +/firefox-29.0.1.source.tar.bz2 +/firefox-langpacks-29.0.1-20140514.tar.xz +/firefox-30.0.source.tar.bz2 +/firefox-langpacks-30.0-20140604.tar.xz +/firefox-31.0.source.tar.bz2 +/firefox-langpacks-31.0-20140717.tar.xz +/firefox-32.0.source.tar.bz2 +/firefox-langpacks-32.0-20140826.tar.xz +/firefox-32.0.1.source.tar.bz2 +/firefox-langpacks-32.0.1-20140915.tar.xz +/firefox-32.0.2.source.tar.bz2 +/firefox-langpacks-32.0.2-20140918.tar.xz +/firefox-langpacks-33.0-20141014.tar.xz +/firefox-33.0.source.tar.bz2 +/firefox-33.1.source.tar.bz2 +/firefox-langpacks-33.1-20141111.tar.xz +/firefox-34.0.source.tar.bz2 +/firefox-langpacks-34.0-20141201.tar.xz +/firefox-35.0.source.tar.bz2 +/firefox-langpacks-35.0-20150106.tar.xz +/firefox-langpacks-35.0-20150109.tar.xz +/firefox-35.0.1.source.tar.bz2 +/firefox-langpacks-35.0.1-20150123.tar.xz +/firefox-36.0.source.tar.bz2 +/firefox-langpacks-36.0-20150220.tar.xz +/firefox-36.0.1.source.tar.bz2 +/firefox-langpacks-36.0.1-20150309.tar.xz +/firefox-36.0.3.source.tar.bz2 +/firefox-langpacks-36.0.3-20150320.tar.xz +/firefox-36.0.4.source.tar.bz2 +/firefox-langpacks-36.0.4-20150321.tar.xz +/firefox-langpacks-37.0-20150327.tar.xz +/firefox-37.0.source.tar.bz2 +/firefox-langpacks-37.0.1-20150407.tar.xz +/firefox-37.0.1.source.tar.bz2 +/firefox-37.0.2.source.tar.bz2 +/firefox-langpacks-37.0.2-20150416.tar.xz +/firefox-38.0.source.tar.bz2 +/firefox-langpacks-38.0-20150505.tar.bz2 +/firefox-langpacks-38.0-20150505.tar.xz +/firefox-langpacks-38.0-20150511.tar.xz +/firefox-38.0.1.source.tar.bz2 +/firefox-langpacks-38.0.1-20150518.tar.xz +/firefox-38.0.5.source.tar.bz2 +/firefox-langpacks-38.0.5-20150603.tar.xz +/firefox-39.0.source.tar.bz2 +/firefox-langpacks-39.0-20150623.tar.xz +/firefox-langpacks-39.0-20150625.tar.xz +/firefox-langpacks-39.0-20150630.tar.xz +/firefox-langpacks-39.0-20150702.tar.xz +/firefox-39.0.3.source.tar.bz2 +/firefox-langpacks-39.0.3-20150806.tar.xz +/firefox-40.0.source.tar.bz2 +/firefox-langpacks-40.0-20150807.tar.xz +/firefox-langpacks-40.0-20150811.tar.xz +/firefox-40.0.3.source.tar.bz2 +/firefox-langpacks-40.0.3-20150827.tar.xz +/firefox-41.0.source.tar.xz +/firefox-langpacks-41.0-20150915.tar.xz +/firefox-langpacks-41.0-20150917.tar.xz +/firefox-langpacks-41.0-20150918.tar.xz +/firefox-langpacks-41.0.1-20150929.tar.xz +/firefox-41.0.1.source.tar.xz +/firefox-langpacks-41.0.1-20150930.tar.xz +/firefox-41.0.2.source.tar.xz +/firefox-langpacks-41.0.2-20151015.tar.xz +/firefox-42.0.source.tar.xz +/firefox-langpacks-42.0-20151029.tar.xz +/firefox-langpacks-42.0-20151030.tar.xz +/firefox-43.0.source.tar.xz +/firefox-langpacks-43.0-20151210.tar.xz +/firefox-43.0.3.source.tar.xz +/firefox-langpacks-43.0.3-20151229.tar.xz +/firefox-43.0.4.source.tar.xz +/firefox-langpacks-43.0.4-20160114.tar.xz +/firefox-44.0.source.tar.xz +/firefox-langpacks-44.0-20160121.tar.xz +/firefox-langpacks-44.0-20160125.tar.xz +/firefox-44.0.1.source.tar.xz +/firefox-langpacks-44.0.1-20160205.tar.xz +/firefox-langpacks-44.0.1-20160208.tar.xz +/firefox-44.0.2.source.tar.xz +/firefox-langpacks-44.0.2-20160210.tar.xz +/firefox-langpacks-44.0.2-20160211.tar.xz +/firefox-45.0.source.tar.xz +/firefox-langpacks-45.0-20160302.tar.xz +/firefox-langpacks-45.0-20160304.tar.xz +/firefox-langpacks-45.0.1-20160316.tar.xz +/firefox-45.0.1.source.tar.xz +/firefox-45.0.2.source.tar.xz +/firefox-langpacks-45.0.2-20160411.tar.xz +/firefox-46.0.source.tar.xz +/firefox-langpacks-46.0-20160425.tar.xz +/firefox-46.0.1.source.tar.xz +/firefox-langpacks-46.0.1-20160503.tar.xz +/firefox-47.0.source.tar.xz +/firefox-langpacks-47.0-20160601.tar.xz +/firefox-langpacks-47.0-20160603.tar.xz +/firefox-langpacks-47.0-20160606.tar.xz +/firefox-47.0.1.source.tar.xz +/firefox-langpacks-47.0.1-20160711.tar.xz +/firefox-langpacks-48.0-20160726.tar.xz +/firefox-48.0.source.tar.xz +/firefox-langpacks-48.0-20160727.tar.xz +/firefox-langpacks-48.0.1-20160819.tar.xz +/firefox-48.0.1.source.tar.xz +/firefox-49.0.source.tar.xz +/firefox-langpacks-49.0-20160906.tar.xz +/firefox-langpacks-49.0-20160908.tar.xz +/firefox-langpacks-49.0-20160919.tar.xz +/firefox-49.0.2.source.tar.xz +/firefox-langpacks-49.0.2-20161031.tar.xz +/firefox-50.0.source.tar.xz +/firefox-langpacks-50.0-20161110.tar.xz +/firefox-50.0.1.source.tar.xz +/firefox-langpacks-50.0.1-20161128.tar.xz +/firefox-50.0.2.source.tar.xz +/firefox-langpacks-50.0.2-20161130.tar.xz +/firefox-50.1.0.source.tar.xz +/firefox-langpacks-50.1.0-20161213.tar.xz +/firefox-51.0.source.tar.xz +/firefox-langpacks-51.0-20170118.tar.xz +/firefox-langpacks-51.0-20170119.tar.xz +/firefox-51.0.1.source.tar.xz +/firefox-langpacks-51.0.1-20170125.tar.xz +/firefox-langpacks-51.0.1-20170126.tar.xz +/firefox-52.0.source.tar.xz +/firefox-langpacks-52.0-20170303.tar.xz +/firefox-52.0.2.source.tar.xz +/firefox-langpacks-52.0.2-20170329.tar.xz +/firefox-53.0.2.source.tar.xz +/firefox-langpacks-53.0.2-20170505.tar.xz +/firefox-53.0.3.source.tar.xz +/firefox-langpacks-53.0.3-20170526.tar.xz +/firefox-54.0.source.tar.xz +/firefox-langpacks-54.0-20170608.tar.xz +/firefox-langpacks-54.0-20170613.tar.xz +/firefox-54.0.1.source.tar.xz +/firefox-langpacks-54.0.1-20170725.tar.xz +/firefox-55.0.source.tar.xz +/firefox-langpacks-55.0-20170802.tar.xz +/firefox-langpacks-55.0-20170807.tar.xz +/firefox-55.0.1.source.tar.xz +/firefox-langpacks-55.0.1-20170814.tar.xz +/firefox-55.0.2.source.tar.xz +/firefox-langpacks-55.0.2-20170818.tar.xz +/firefox-55.0.3.source.tar.xz +/firefox-langpacks-55.0.3-20170901.tar.xz +/firefox-56.0.source.tar.xz +/firefox-langpacks-56.0-20170925.tar.xz +/firefox-langpacks-56.0-20170927.tar.xz +/firefox-57.0b5.source.tar.xz +/firefox-langpacks-57.0b5-20171005.tar.xz +/firefox-57.0b6.source.tar.xz +/firefox-langpacks-57.0b6-20171009.tar.xz +/firefox-57.0b7.source.tar.xz +/firefox-langpacks-57.0b7-20171011.tar.xz +/firefox-57.0b8.source.tar.xz +/firefox-langpacks-57.0b8-20171016.tar.xz +/firefox-57.0b9.source.tar.xz +/firefox-langpacks-57.0b9-20171019.tar.xz +/firefox-57.0b11.source.tar.xz +/firefox-langpacks-57.0b11-20171024.tar.xz +/firefox-57.0b12.source.tar.xz +/firefox-langpacks-57.0b12-20171030.tar.xz +/firefox-57.0b14.source.tar.xz +/firefox-langpacks-57.0b14-20171106.tar.xz +/firefox-57.0.source.tar.xz +/firefox-langpacks-57.0-20171109.tar.xz +/firefox-langpacks-57.0-20171113.tar.xz +/firefox-57.0.1.source.tar.xz +/firefox-langpacks-57.0.1-20171130.tar.xz +/firefox-57.0.3.source.tar.xz +/firefox-langpacks-57.0.3-20180102.tar.xz +/firefox-57.0.4.source.tar.xz +/firefox-langpacks-57.0.4-20180104.tar.xz +/firefox-58.0.source.tar.xz +/firefox-langpacks-58.0-20180123.tar.xz +/firefox-58.0.1.source.tar.xz +/firefox-langpacks-58.0.1-20180130.tar.xz +/2f6a4d2cf42c9d59626061d45c043817cb220814.tar.bz2 +/firefox-langpacks-59.0-20180306.tar.xz +/c61f5f5ead48c78a80c80db5c489bdc7cfaf8175.tar.bz2 +/firefox-langpacks-59.0-20180312.tar.xz +/firefox-langpacks-59.0.1-20180317.tar.xz +/3db9e3d52b17563efca181ccbb50deb8660c59ae.tar.bz2 +/239e434d6d2b8e1e2b697c3416d1e96d48fe98e5.tar.bz2 +/firefox-langpacks-59.0.2-20180327.tar.xz +/firefox-60.0b13.source.tar.xz +/firefox-langpacks-60.0b13-20180418.tar.xz +/firefox-60.0b15.source.tar.xz +/firefox-langpacks-60.0b15-20180426.tar.xz +/firefox-60.0b16.source.tar.xz +/firefox-langpacks-60.0b16-20180427.tar.xz +/firefox-60.0.source.tar.xz +/firefox-langpacks-60.0-20180502.tar.xz +/firefox-langpacks-60.0-20180507.tar.xz +/firefox-60.0.1.source.tar.xz +/firefox-langpacks-60.0.1-20180523.tar.xz +/firefox-60.0.2.source.tar.xz +/firefox-langpacks-60.0.2-20180611.tar.xz +/firefox-61.0.source.tar.xz +/firefox-langpacks-61.0-20180619.tar.xz +/firefox-langpacks-61.0-20180622.tar.xz +/firefox-61.0.1.source.tar.xz +/firefox-langpacks-61.0.1-20180710.tar.xz +/firefox-langpacks-61.0.2-20180809.tar.xz +/firefox-61.0.2.source.tar.xz +/firefox-langpacks-62.0-20180828.tar.xz +/firefox-62.0.source.tar.xz +/firefox-62.0.2.source.tar.xz +/firefox-langpacks-62.0.2-20180924.tar.xz +/firefox-62.0.3.source.tar.xz +/firefox-langpacks-62.0.3-20181002.tar.xz +/firefox-63.0.source.tar.xz +/firefox-langpacks-63.0-20181018.tar.xz +/cbindgen-vendor.tar.xz +/firefox-langpacks-63.0.1-20181101.tar.xz +/firefox-63.0.1.source.tar.xz +/firefox-63.0.3.source.tar.xz +/firefox-langpacks-63.0.3-20181115.tar.xz +/firefox-64.0.source.tar.xz +/firefox-langpacks-64.0-20181204.tar.xz +/firefox-64.0.2.source.tar.xz +/firefox-langpacks-64.0.2-20190110.tar.xz +/firefox-65.0.source.tar.xz +/firefox-langpacks-65.0-20190128.tar.xz +/firefox-65.0.1.source.tar.xz +/firefox-langpacks-65.0.1-20190215.tar.xz +/firefox-65.0.2.source.tar.xz +/firefox-langpacks-65.0.2-20190301.tar.xz +/firefox-66.0.source.tar.xz +/firefox-langpacks-66.0-20190312.tar.xz +/firefox-langpacks-66.0-20190315.tar.xz +/firefox-66.0.1.source.tar.xz +/firefox-langpacks-66.0.1-20190322.tar.xz +/firefox-66.0.2.source.tar.xz +/firefox-langpacks-66.0.2-20190401.tar.xz +/firefox-langpacks-66.0.3-20190410.tar.xz +/firefox-66.0.3.source.tar.xz +/firefox-langpacks-66.0.4-20190505.tar.xz +/firefox-66.0.4.source.tar.xz +/firefox-66.0.5.source.tar.xz +/firefox-langpacks-66.0.5-20190508.tar.xz +/firefox-67.0.source.tar.xz +/firefox-langpacks-67.0-20190515.tar.xz +/firefox-langpacks-67.0-20190517.tar.xz +/firefox-67.0.2.source.tar.xz +/firefox-langpacks-67.0.2-20190611.tar.xz +/firefox-langpacks-67.0.3-20190618.tar.xz +/firefox-67.0.3.source.tar.xz +/firefox-67.0.4.source.tar.xz +/firefox-langpacks-67.0.4-20190620.tar.xz +/firefox-68.0.source.tar.xz +/firefox-langpacks-68.0-20190702.tar.xz +/firefox-langpacks-68.0-20190708.tar.xz +/firefox-68.0.1.source.tar.xz +/firefox-langpacks-68.0.1-20190722.tar.xz +/firefox-68.0.2.source.tar.xz +/firefox-langpacks-68.0.2-20190814.tar.xz +/firefox-69.0.source.tar.xz +/firefox-langpacks-69.0-20190829.tar.xz +/firefox-69.0.1.source.tar.xz +/firefox-langpacks-69.0.1-20190918.tar.xz +/firefox-langpacks-69.0.2-20191003.tar.xz +/firefox-69.0.2.source.tar.xz +/firefox-69.0.3.source.tar.xz +/firefox-langpacks-69.0.3-20191010.tar.xz +/firefox-70.0.source.tar.xz +/firefox-langpacks-70.0-20191018.tar.xz +/firefox-70.0.1.source.tar.xz +/firefox-langpacks-70.0.1-20191101.tar.xz +/firefox-71.0b12.source.tar.xz +/firefox-71.0.source.tar.xz +/firefox-langpacks-71.0-20191126.tar.xz +/firefox-langpacks-71.0-20191202.tar.xz +/firefox-72.0.source.tar.xz +/firefox-langpacks-72.0-20200103.tar.xz +/firefox-langpacks-72.0-20200106.tar.xz +/firefox-72.0.1.source.tar.xz +/firefox-langpacks-72.0.1-20200108.tar.xz +/firefox-72.0.2.source.tar.xz +/firefox-langpacks-72.0.2-20200120.tar.xz +/firefox-73.0.source.tar.xz +/firefox-langpacks-73.0-20200211.tar.xz +/firefox-73.0.1.source.tar.xz +/firefox-langpacks-73.0.1-20200220.tar.xz +/firefox-74.0.source.tar.xz +/firefox-langpacks-74.0-20200303.tar.xz +/firefox-langpacks-74.0-20200309.tar.xz +/firefox-langpacks-74.0-20200310.tar.xz +/firefox-74.0.1.source.tar.xz +/firefox-langpacks-74.0.1-20200404.tar.xz +/firefox-75.0.source.tar.xz +/firefox-langpacks-75.0-20200406.tar.xz +/firefox-76.0.source.tar.xz +/firefox-langpacks-76.0-20200502.tar.xz +/firefox-76.0.1.source.tar.xz +/firefox-langpacks-76.0.1-20200508.tar.xz +/firefox-77.0.source.tar.xz +/firefox-langpacks-77.0-20200529.tar.xz +/firefox-langpacks-77.0-20200602.tar.xz +/firefox-77.0.1.source.tar.xz +/firefox-langpacks-77.0.1-20200603.tar.xz +/firefox-78.0.source.tar.xz +/firefox-langpacks-78.0-20200629.tar.xz +/firefox-78.0.1.source.tar.xz +/firefox-langpacks-78.0.1-20200701.tar.xz +/firefox-78.0.2.source.tar.xz +/firefox-langpacks-78.0.2-20200709.tar.xz +/firefox-79.0.source.tar.xz +/firefox-langpacks-79.0-20200727.tar.xz +/firefox-80.0.source.tar.xz +/firefox-langpacks-80.0-20200818.tar.xz +/firefox-langpacks-80.0-20200820.tar.xz +/firefox-80.0.1.source.tar.xz +/firefox-langpacks-80.0.1-20200901.tar.xz +/firefox-81.0.source.tar.xz +/firefox-langpacks-81.0-20200915.tar.xz +/firefox-langpacks-81.0-20200921.tar.xz +/firefox-81.0.1.source.tar.xz +/firefox-langpacks-81.0.1-20200930.tar.xz +/firefox-81.0.2.source.tar.xz +/firefox-langpacks-81.0.2-20201012.tar.xz diff --git a/build-aarch64-skia.patch b/build-aarch64-skia.patch new file mode 100644 index 0000000..a63e3e8 --- /dev/null +++ b/build-aarch64-skia.patch @@ -0,0 +1,45 @@ +diff -up firefox-72.0/gfx/skia/skia/include/private/SkHalf.h.aarch64-skia firefox-72.0/gfx/skia/skia/include/private/SkHalf.h +--- firefox-72.0/gfx/skia/skia/include/private/SkHalf.h.aarch64-skia 2020-01-02 22:33:02.000000000 +0100 ++++ firefox-72.0/gfx/skia/skia/include/private/SkHalf.h 2020-01-03 09:00:37.537296105 +0100 +@@ -40,7 +40,7 @@ static inline Sk4h SkFloatToHalf_finite_ + + static inline Sk4f SkHalfToFloat_finite_ftz(uint64_t rgba) { + Sk4h hs = Sk4h::Load(&rgba); +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t fs; + asm ("fcvtl %[fs].4s, %[hs].4h \n" // vcvt_f32_f16(...) + : [fs] "=w" (fs) // =w: write-only NEON register +@@ -62,7 +62,7 @@ static inline Sk4f SkHalfToFloat_finite_ + } + + static inline Sk4h SkFloatToHalf_finite_ftz(const Sk4f& fs) { +-#if !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) ++#if 0 // !defined(SKNX_NO_SIMD) && defined(SK_CPU_ARM64) + float32x4_t vec = fs.fVec; + asm ("fcvtn %[vec].4h, %[vec].4s \n" // vcvt_f16_f32(vec) + : [vec] "+w" (vec)); // +w: read-write NEON register +diff -up firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h +--- firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h.aarch64-skia 2020-01-03 09:00:37.538296107 +0100 ++++ firefox-72.0/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h 2020-01-03 10:11:41.259219508 +0100 +@@ -1087,7 +1087,7 @@ SI F from_half(U16 h) { + } + + SI U16 to_half(F f) { +-#if defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ ++#if 0 //defined(JUMPER_IS_NEON) && defined(SK_CPU_ARM64) \ + && !defined(SK_BUILD_FOR_GOOGLE3) // Temporary workaround for some Google3 builds. + return vcvt_f16_f32(f); + +diff -up firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.aarch64-skia firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h +--- firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h.aarch64-skia 2020-01-03 09:00:37.538296107 +0100 ++++ firefox-72.0/gfx/skia/skia/third_party/skcms/src/Transform_inl.h 2020-01-03 10:11:53.513250979 +0100 +@@ -183,8 +183,6 @@ SI F F_from_Half(U16 half) { + SI U16 Half_from_F(F f) { + #if defined(USING_NEON_FP16) + return bit_pun(f); +-#elif defined(USING_NEON_F16C) +- return (U16)vcvt_f16_f32(f); + #elif defined(USING_AVX512F) + return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION ); + #elif defined(USING_AVX_F16C) diff --git a/build-arm-libaom.patch b/build-arm-libaom.patch new file mode 100644 index 0000000..985f01d --- /dev/null +++ b/build-arm-libaom.patch @@ -0,0 +1,12 @@ +diff -up firefox-73.0/media/libaom/moz.build.old firefox-73.0/media/libaom/moz.build +--- firefox-73.0/media/libaom/moz.build.old 2020-02-07 23:13:28.000000000 +0200 ++++ firefox-73.0/media/libaom/moz.build 2020-02-17 10:30:08.509805092 +0200 +@@ -55,7 +55,7 @@ elif CONFIG['CPU_ARCH'] == 'arm': + + for f in SOURCES: + if f.endswith('neon.c'): +- SOURCES[f].flags += CONFIG['VPX_ASFLAGS'] ++ SOURCES[f].flags += CONFIG['NEON_FLAGS'] + + if CONFIG['OS_TARGET'] == 'Android': + # For cpu-features.h diff --git a/build-arm-libopus.patch b/build-arm-libopus.patch new file mode 100644 index 0000000..1b3f31b --- /dev/null +++ b/build-arm-libopus.patch @@ -0,0 +1,12 @@ +diff -up firefox-66.0/media/libopus/silk/arm/arm_silk_map.c.old firefox-66.0/media/libopus/silk/arm/arm_silk_map.c +--- firefox-66.0/media/libopus/silk/arm/arm_silk_map.c.old 2019-03-12 21:07:35.356677522 +0100 ++++ firefox-66.0/media/libopus/silk/arm/arm_silk_map.c 2019-03-12 21:07:42.937693394 +0100 +@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE. + # include "config.h" + #endif + +-#include "main_FIX.h" ++#include "fixed/main_FIX.h" + #include "NSQ.h" + #include "SigProc_FIX.h" + diff --git a/build-arm-wasm.patch b/build-arm-wasm.patch new file mode 100644 index 0000000..bd841ab --- /dev/null +++ b/build-arm-wasm.patch @@ -0,0 +1,21 @@ +diff -up firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp +--- firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old 2020-01-17 23:34:41.000000000 +0200 ++++ firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp 2020-02-02 08:07:54.670341986 +0200 +@@ -249,7 +249,16 @@ using mozilla::DebugOnly; + #endif + + #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS +-# include ++struct user_vfp { ++ unsigned long long fpregs[32]; ++ unsigned long fpscr; ++}; ++ ++struct user_vfp_exc { ++ unsigned long fpexc; ++ unsigned long fpinst; ++ unsigned long fpinst2; ++}; + #endif + + #if defined(ANDROID) diff --git a/build-cacheFlush-missing.patch b/build-cacheFlush-missing.patch new file mode 100644 index 0000000..51c368c --- /dev/null +++ b/build-cacheFlush-missing.patch @@ -0,0 +1,13 @@ +diff -up firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm firefox-55.0.3/js/src/jit/ExecutableAllocator.h +--- firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm 2017-09-05 11:32:12.235909468 +0200 ++++ firefox-55.0.3/js/src/jit/ExecutableAllocator.h 2017-09-05 11:32:46.157916575 +0200 +@@ -219,7 +219,7 @@ class ExecutableAllocator + + static void poisonCode(JSRuntime* rt, JitPoisonRangeVector& ranges); + +-#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) ++#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) || defined(JS_CODEGEN_NONE) + static void cacheFlush(void*, size_t) + { + } +diff -up firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d.wasm firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d diff --git a/build-cubeb-pulse-arm.patch b/build-cubeb-pulse-arm.patch new file mode 100644 index 0000000..008208c --- /dev/null +++ b/build-cubeb-pulse-arm.patch @@ -0,0 +1,4946 @@ +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/Cargo.toml.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/Cargo.toml +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/Cargo.toml.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/Cargo.toml 2017-08-04 13:37:46.383821740 +0200 +@@ -7,7 +7,11 @@ description = "Cubeb backed for PulseAud + [features] + pulse-dlopen = ["pulse-ffi/dlopen"] + ++[lib] ++crate-type = ["staticlib", "rlib"] ++ + [dependencies] + cubeb-ffi = { path = "cubeb-ffi" } + pulse-ffi = { path = "pulse-ffi" } ++pulse = { path = "pulse-rs" } + semver = "^0.6" +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/cubeb-ffi/src/ffi.rs 2017-08-04 13:37:46.384821737 +0200 +@@ -11,45 +11,45 @@ pub enum Context {} + pub enum Stream {} + + // These need to match cubeb_sample_format +-pub const SAMPLE_S16LE: c_int = 0; +-pub const SAMPLE_S16BE: c_int = 1; +-pub const SAMPLE_FLOAT32LE: c_int = 2; +-pub const SAMPLE_FLOAT32BE: c_int = 3; + pub type SampleFormat = c_int; ++pub const SAMPLE_S16LE: SampleFormat = 0; ++pub const SAMPLE_S16BE: SampleFormat = 1; ++pub const SAMPLE_FLOAT32LE: SampleFormat = 2; ++pub const SAMPLE_FLOAT32BE: SampleFormat = 3; + + #[cfg(target_endian = "little")] +-pub const SAMPLE_S16NE: c_int = SAMPLE_S16LE; ++pub const SAMPLE_S16NE: SampleFormat = SAMPLE_S16LE; + #[cfg(target_endian = "little")] +-pub const SAMPLE_FLOAT32NE: c_int = SAMPLE_FLOAT32LE; ++pub const SAMPLE_FLOAT32NE: SampleFormat = SAMPLE_FLOAT32LE; + #[cfg(target_endian = "big")] +-pub const SAMPLE_S16NE: c_int = SAMPLE_S16BE; ++pub const SAMPLE_S16NE: SampleFormat = SAMPLE_S16BE; + #[cfg(target_endian = "big")] +-pub const SAMPLE_FLOAT32NE: c_int = SAMPLE_FLOAT32BE; ++pub const SAMPLE_FLOAT32NE: SampleFormat = SAMPLE_FLOAT32BE; + + pub type DeviceId = *const c_void; + + // These need to match cubeb_channel_layout +-pub const LAYOUT_UNDEFINED: c_int = 0; +-pub const LAYOUT_DUAL_MONO: c_int = 1; +-pub const LAYOUT_DUAL_MONO_LFE: c_int = 2; +-pub const LAYOUT_MONO: c_int = 3; +-pub const LAYOUT_MONO_LFE: c_int = 4; +-pub const LAYOUT_STEREO: c_int = 5; +-pub const LAYOUT_STEREO_LFE: c_int = 6; +-pub const LAYOUT_3F: c_int = 7; +-pub const LAYOUT_3F_LFE: c_int = 8; +-pub const LAYOUT_2F1: c_int = 9; +-pub const LAYOUT_2F1_LFE: c_int = 10; +-pub const LAYOUT_3F1: c_int = 11; +-pub const LAYOUT_3F1_LFE: c_int = 12; +-pub const LAYOUT_2F2: c_int = 13; +-pub const LAYOUT_2F2_LFE: c_int = 14; +-pub const LAYOUT_3F2: c_int = 15; +-pub const LAYOUT_3F2_LFE: c_int = 16; +-pub const LAYOUT_3F3R_LFE: c_int = 17; +-pub const LAYOUT_3F4_LFE: c_int = 18; +-pub const LAYOUT_MAX: c_int = 19; + pub type ChannelLayout = c_int; ++pub const LAYOUT_UNDEFINED: ChannelLayout = 0; ++pub const LAYOUT_DUAL_MONO: ChannelLayout = 1; ++pub const LAYOUT_DUAL_MONO_LFE: ChannelLayout = 2; ++pub const LAYOUT_MONO: ChannelLayout = 3; ++pub const LAYOUT_MONO_LFE: ChannelLayout = 4; ++pub const LAYOUT_STEREO: ChannelLayout = 5; ++pub const LAYOUT_STEREO_LFE: ChannelLayout = 6; ++pub const LAYOUT_3F: ChannelLayout = 7; ++pub const LAYOUT_3F_LFE: ChannelLayout = 8; ++pub const LAYOUT_2F1: ChannelLayout = 9; ++pub const LAYOUT_2F1_LFE: ChannelLayout = 10; ++pub const LAYOUT_3F1: ChannelLayout = 11; ++pub const LAYOUT_3F1_LFE: ChannelLayout = 12; ++pub const LAYOUT_2F2: ChannelLayout = 13; ++pub const LAYOUT_2F2_LFE: ChannelLayout = 14; ++pub const LAYOUT_3F2: ChannelLayout = 15; ++pub const LAYOUT_3F2_LFE: ChannelLayout = 16; ++pub const LAYOUT_3F3R_LFE: ChannelLayout = 17; ++pub const LAYOUT_3F4_LFE: ChannelLayout = 18; ++pub const LAYOUT_MAX: ChannelLayout = 256; + + #[repr(C)] + #[derive(Clone, Copy, Debug)] +@@ -77,11 +77,11 @@ impl Default for Device { + } + + // These need to match cubeb_state +-pub const STATE_STARTED: c_int = 0; +-pub const STATE_STOPPED: c_int = 1; +-pub const STATE_DRAINED: c_int = 2; +-pub const STATE_ERROR: c_int = 3; + pub type State = c_int; ++pub const STATE_STARTED: State = 0; ++pub const STATE_STOPPED: State = 1; ++pub const STATE_DRAINED: State = 2; ++pub const STATE_ERROR: State = 3; + + pub const OK: i32 = 0; + pub const ERROR: i32 = -1; +@@ -249,32 +249,42 @@ pub struct LayoutMap { + } + + // cubeb_mixer.h ++pub type Channel = c_int; + + // These need to match cubeb_channel +-pub const CHANNEL_INVALID: c_int = -1; +-pub const CHANNEL_MONO: c_int = 0; +-pub const CHANNEL_LEFT: c_int = 1; +-pub const CHANNEL_RIGHT: c_int = 2; +-pub const CHANNEL_CENTER: c_int = 3; +-pub const CHANNEL_LS: c_int = 4; +-pub const CHANNEL_RS: c_int = 5; +-pub const CHANNEL_RLS: c_int = 6; +-pub const CHANNEL_RCENTER: c_int = 7; +-pub const CHANNEL_RRS: c_int = 8; +-pub const CHANNEL_LFE: c_int = 9; +-pub const CHANNEL_MAX: c_int = 256; +-pub type Channel = c_int; ++pub const CHANNEL_INVALID: Channel = -1; ++pub const CHANNEL_MONO: Channel = 0; ++pub const CHANNEL_LEFT: Channel = 1; ++pub const CHANNEL_RIGHT: Channel = 2; ++pub const CHANNEL_CENTER: Channel = 3; ++pub const CHANNEL_LS: Channel = 4; ++pub const CHANNEL_RS: Channel = 5; ++pub const CHANNEL_RLS: Channel = 6; ++pub const CHANNEL_RCENTER: Channel = 7; ++pub const CHANNEL_RRS: Channel = 8; ++pub const CHANNEL_LFE: Channel = 9; ++pub const CHANNEL_MAX: Channel = 10; + + #[repr(C)] ++#[derive(Clone, Copy, Debug)] + pub struct ChannelMap { + pub channels: c_uint, +- pub map: [Channel; 256], ++ pub map: [Channel; CHANNEL_MAX as usize], + } + impl ::std::default::Default for ChannelMap { + fn default() -> Self { + ChannelMap { + channels: 0, +- map: unsafe { ::std::mem::zeroed() }, ++ map: [CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID, ++ CHANNEL_INVALID], + } + } + } +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_funcs.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_funcs.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_funcs.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_funcs.rs 2017-08-04 13:37:46.384821737 +0200 +@@ -8,8 +8,8 @@ macro_rules! cstr { + + #[cfg(not(feature = "dlopen"))] + mod static_fns { +- use std::os::raw::{c_char, c_double, c_int, c_float, c_uint, c_void}; + use super::*; ++ use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void}; + + #[link(name = "pulse")] + extern "C" { +@@ -62,6 +62,7 @@ mod static_fns { + userdata: *mut c_void) + -> *mut pa_operation; + pub fn pa_context_set_state_callback(c: *mut pa_context, cb: pa_context_notify_cb_t, userdata: *mut c_void); ++ pub fn pa_context_errno(c: *mut pa_context) -> c_int; + pub fn pa_context_set_subscribe_callback(c: *mut pa_context, + cb: pa_context_subscribe_cb_t, + userdata: *mut c_void); +@@ -70,6 +71,7 @@ mod static_fns { + cb: pa_context_success_cb_t, + userdata: *mut c_void) + -> *mut pa_operation; ++ pub fn pa_context_ref(c: *mut pa_context) -> *mut pa_context; + pub fn pa_context_unref(c: *mut pa_context); + pub fn pa_cvolume_set(a: *mut pa_cvolume, channels: c_uint, v: pa_volume_t) -> *mut pa_cvolume; + pub fn pa_cvolume_set_balance(v: *mut pa_cvolume, +@@ -80,12 +82,20 @@ mod static_fns { + pub fn pa_mainloop_api_once(m: *mut pa_mainloop_api, + callback: pa_mainloop_api_once_cb_t, + userdata: *mut c_void); +- pub fn pa_operation_get_state(o: *const pa_operation) -> pa_operation_state_t; ++ pub fn pa_strerror(error: pa_error_code_t) -> *const c_char; ++ pub fn pa_operation_ref(o: *mut pa_operation) -> *mut pa_operation; + pub fn pa_operation_unref(o: *mut pa_operation); ++ pub fn pa_operation_cancel(o: *mut pa_operation); ++ pub fn pa_operation_get_state(o: *const pa_operation) -> pa_operation_state_t; ++ pub fn pa_operation_set_state_callback(o: *mut pa_operation, ++ cb: pa_operation_notify_cb_t, ++ userdata: *mut c_void); + pub fn pa_proplist_gets(p: *mut pa_proplist, key: *const c_char) -> *const c_char; + pub fn pa_rtclock_now() -> pa_usec_t; + pub fn pa_stream_begin_write(p: *mut pa_stream, data: *mut *mut c_void, nbytes: *mut usize) -> c_int; + pub fn pa_stream_cancel_write(p: *mut pa_stream) -> c_int; ++ pub fn pa_stream_is_suspended(s: *const pa_stream) -> c_int; ++ pub fn pa_stream_is_corked(s: *const pa_stream) -> c_int; + pub fn pa_stream_connect_playback(s: *mut pa_stream, + dev: *const c_char, + attr: *const pa_buffer_attr, +@@ -112,6 +122,7 @@ mod static_fns { + pub fn pa_stream_get_latency(s: *const pa_stream, r_usec: *mut pa_usec_t, negative: *mut c_int) -> c_int; + pub fn pa_stream_get_sample_spec(s: *const pa_stream) -> *const pa_sample_spec; + pub fn pa_stream_get_state(p: *const pa_stream) -> pa_stream_state_t; ++ pub fn pa_stream_get_context(s: *const pa_stream) -> *mut pa_context; + pub fn pa_stream_get_time(s: *const pa_stream, r_usec: *mut pa_usec_t) -> c_int; + pub fn pa_stream_new(c: *mut pa_context, + name: *const c_char, +@@ -123,6 +134,7 @@ mod static_fns { + pub fn pa_stream_set_state_callback(s: *mut pa_stream, cb: pa_stream_notify_cb_t, userdata: *mut c_void); + pub fn pa_stream_set_write_callback(p: *mut pa_stream, cb: pa_stream_request_cb_t, userdata: *mut c_void); + pub fn pa_stream_set_read_callback(p: *mut pa_stream, cb: pa_stream_request_cb_t, userdata: *mut c_void); ++ pub fn pa_stream_ref(s: *mut pa_stream) -> *mut pa_stream; + pub fn pa_stream_unref(s: *mut pa_stream); + pub fn pa_stream_update_timing_info(p: *mut pa_stream, + cb: pa_stream_success_cb_t, +@@ -148,8 +160,6 @@ mod static_fns { + pub fn pa_threaded_mainloop_unlock(m: *mut pa_threaded_mainloop); + pub fn pa_threaded_mainloop_wait(m: *mut pa_threaded_mainloop); + pub fn pa_usec_to_bytes(t: pa_usec_t, spec: *const pa_sample_spec) -> usize; +- pub fn pa_xfree(ptr: *mut c_void); +- pub fn pa_xstrdup(str: *const c_char) -> *mut c_char; + pub fn pa_xrealloc(ptr: *mut c_void, size: usize) -> *mut c_void; + } + } +@@ -159,9 +169,9 @@ pub use self::static_fns::*; + + #[cfg(feature = "dlopen")] + mod dynamic_fns { +- use std::os::raw::{c_char, c_double, c_int, c_float, c_uint, c_void}; +- use libc::{dlclose, dlopen, dlsym, RTLD_LAZY}; + use super::*; ++ use libc::{RTLD_LAZY, dlclose, dlopen, dlsym}; ++ use std::os::raw::{c_char, c_double, c_float, c_int, c_uint, c_void}; + + #[derive(Debug)] + pub struct LibLoader { +@@ -287,6 +297,13 @@ mod dynamic_fns { + } + fp + }; ++ PA_CONTEXT_ERRNO = { ++ let fp = dlsym(h, cstr!("pa_context_errno")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_CONTEXT_SET_SUBSCRIBE_CALLBACK = { + let fp = dlsym(h, cstr!("pa_context_set_subscribe_callback")); + if fp.is_null() { +@@ -301,6 +318,13 @@ mod dynamic_fns { + } + fp + }; ++ PA_CONTEXT_REF = { ++ let fp = dlsym(h, cstr!("pa_context_ref")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_CONTEXT_UNREF = { + let fp = dlsym(h, cstr!("pa_context_unref")); + if fp.is_null() { +@@ -336,8 +360,15 @@ mod dynamic_fns { + } + fp + }; +- PA_OPERATION_GET_STATE = { +- let fp = dlsym(h, cstr!("pa_operation_get_state")); ++ PA_STRERROR = { ++ let fp = dlsym(h, cstr!("pa_strerror")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; ++ PA_OPERATION_REF = { ++ let fp = dlsym(h, cstr!("pa_operation_ref")); + if fp.is_null() { + return None; + } +@@ -350,6 +381,27 @@ mod dynamic_fns { + } + fp + }; ++ PA_OPERATION_CANCEL = { ++ let fp = dlsym(h, cstr!("pa_operation_cancel")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; ++ PA_OPERATION_GET_STATE = { ++ let fp = dlsym(h, cstr!("pa_operation_get_state")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; ++ PA_OPERATION_SET_STATE_CALLBACK = { ++ let fp = dlsym(h, cstr!("pa_operation_set_state_callback")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_PROPLIST_GETS = { + let fp = dlsym(h, cstr!("pa_proplist_gets")); + if fp.is_null() { +@@ -378,6 +430,20 @@ mod dynamic_fns { + } + fp + }; ++ PA_STREAM_IS_SUSPENDED = { ++ let fp = dlsym(h, cstr!("pa_stream_is_suspended")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; ++ PA_STREAM_IS_CORKED = { ++ let fp = dlsym(h, cstr!("pa_stream_is_corked")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_STREAM_CONNECT_PLAYBACK = { + let fp = dlsym(h, cstr!("pa_stream_connect_playback")); + if fp.is_null() { +@@ -462,6 +528,13 @@ mod dynamic_fns { + } + fp + }; ++ PA_STREAM_GET_CONTEXT = { ++ let fp = dlsym(h, cstr!("pa_stream_get_context")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_STREAM_GET_TIME = { + let fp = dlsym(h, cstr!("pa_stream_get_time")); + if fp.is_null() { +@@ -511,6 +584,13 @@ mod dynamic_fns { + } + fp + }; ++ PA_STREAM_REF = { ++ let fp = dlsym(h, cstr!("pa_stream_ref")); ++ if fp.is_null() { ++ return None; ++ } ++ fp ++ }; + PA_STREAM_UNREF = { + let fp = dlsym(h, cstr!("pa_stream_unref")); + if fp.is_null() { +@@ -623,20 +703,6 @@ mod dynamic_fns { + } + fp + }; +- PA_XFREE = { +- let fp = dlsym(h, cstr!("pa_xfree")); +- if fp.is_null() { +- return None; +- } +- fp +- }; +- PA_XSTRDUP = { +- let fp = dlsym(h, cstr!("pa_xstrdup")); +- if fp.is_null() { +- return None; +- } +- fp +- }; + PA_XREALLOC = { + let fp = dlsym(h, cstr!("pa_xrealloc")); + if fp.is_null() { +@@ -837,6 +903,12 @@ mod dynamic_fns { + *mut c_void)>(PA_CONTEXT_SET_STATE_CALLBACK))(c, cb, userdata) + } + ++ static mut PA_CONTEXT_ERRNO: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_context_errno(c: *mut pa_context) -> c_int { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_context) -> c_int>(PA_CONTEXT_ERRNO))(c) ++ } ++ + static mut PA_CONTEXT_SET_SUBSCRIBE_CALLBACK: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_context_set_subscribe_callback(c: *mut pa_context, +@@ -863,6 +935,12 @@ mod dynamic_fns { + -> *mut pa_operation>(PA_CONTEXT_SUBSCRIBE))(c, m, cb, userdata) + } + ++ static mut PA_CONTEXT_REF: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_context_ref(c: *mut pa_context) -> *mut pa_context { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_context) -> *mut pa_context>(PA_CONTEXT_REF))(c) ++ } ++ + static mut PA_CONTEXT_UNREF: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_context_unref(c: *mut pa_context) { +@@ -907,6 +985,30 @@ mod dynamic_fns { + *mut c_void)>(PA_MAINLOOP_API_ONCE))(m, callback, userdata) + } + ++ static mut PA_STRERROR: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_strerror(error: pa_error_code_t) -> *const c_char { ++ (::std::mem::transmute::<_, extern "C" fn(pa_error_code_t) -> *const c_char>(PA_STRERROR))(error) ++ } ++ ++ static mut PA_OPERATION_REF: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_operation_ref(o: *mut pa_operation) -> *mut pa_operation { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_operation) -> *mut pa_operation>(PA_OPERATION_REF))(o) ++ } ++ ++ static mut PA_OPERATION_UNREF: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_operation_unref(o: *mut pa_operation) { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_operation)>(PA_OPERATION_UNREF))(o) ++ } ++ ++ static mut PA_OPERATION_CANCEL: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_operation_cancel(o: *mut pa_operation) { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_operation)>(PA_OPERATION_CANCEL))(o) ++ } ++ + static mut PA_OPERATION_GET_STATE: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_operation_get_state(o: *const pa_operation) -> pa_operation_state_t { +@@ -915,10 +1017,15 @@ mod dynamic_fns { + -> pa_operation_state_t>(PA_OPERATION_GET_STATE))(o) + } + +- static mut PA_OPERATION_UNREF: *mut ::libc::c_void = 0 as *mut _; ++ static mut PA_OPERATION_SET_STATE_CALLBACK: *mut ::libc::c_void = 0 as *mut _; + #[inline] +- pub unsafe fn pa_operation_unref(o: *mut pa_operation) { +- (::std::mem::transmute::<_, extern "C" fn(*mut pa_operation)>(PA_OPERATION_UNREF))(o) ++ pub unsafe fn pa_operation_set_state_callback(o: *mut pa_operation, ++ cb: pa_operation_notify_cb_t, ++ userdata: *mut c_void) { ++ (::std::mem::transmute::<_, ++ extern "C" fn(*mut pa_operation, ++ pa_operation_notify_cb_t, ++ *mut c_void)>(PA_OPERATION_SET_STATE_CALLBACK))(o, cb, userdata) + } + + static mut PA_PROPLIST_GETS: *mut ::libc::c_void = 0 as *mut _; +@@ -951,6 +1058,18 @@ mod dynamic_fns { + (::std::mem::transmute::<_, extern "C" fn(*mut pa_stream) -> c_int>(PA_STREAM_CANCEL_WRITE))(p) + } + ++ static mut PA_STREAM_IS_SUSPENDED: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_stream_is_suspended(s: *const pa_stream) -> c_int { ++ (::std::mem::transmute::<_, extern "C" fn(*const pa_stream) -> c_int>(PA_STREAM_IS_SUSPENDED))(s) ++ } ++ ++ static mut PA_STREAM_IS_CORKED: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_stream_is_corked(s: *const pa_stream) -> c_int { ++ (::std::mem::transmute::<_, extern "C" fn(*const pa_stream) -> c_int>(PA_STREAM_IS_CORKED))(s) ++ } ++ + static mut PA_STREAM_CONNECT_PLAYBACK: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_stream_connect_playback(s: *mut pa_stream, +@@ -1066,6 +1185,12 @@ mod dynamic_fns { + (::std::mem::transmute::<_, extern "C" fn(*const pa_stream) -> pa_stream_state_t>(PA_STREAM_GET_STATE))(p) + } + ++ static mut PA_STREAM_GET_CONTEXT: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_stream_get_context(s: *const pa_stream) -> *mut pa_context { ++ (::std::mem::transmute::<_, extern "C" fn(*const pa_stream) -> *mut pa_context>(PA_STREAM_GET_CONTEXT))(s) ++ } ++ + static mut PA_STREAM_GET_TIME: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_stream_get_time(s: *const pa_stream, r_usec: *mut pa_usec_t) -> c_int { +@@ -1132,6 +1257,12 @@ mod dynamic_fns { + *mut c_void)>(PA_STREAM_SET_READ_CALLBACK))(p, cb, userdata) + } + ++ static mut PA_STREAM_REF: *mut ::libc::c_void = 0 as *mut _; ++ #[inline] ++ pub unsafe fn pa_stream_ref(s: *mut pa_stream) -> *mut pa_stream { ++ (::std::mem::transmute::<_, extern "C" fn(*mut pa_stream) -> *mut pa_stream>(PA_STREAM_REF))(s) ++ } ++ + static mut PA_STREAM_UNREF: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_stream_unref(s: *mut pa_stream) { +@@ -1253,18 +1384,6 @@ mod dynamic_fns { + spec) + } + +- static mut PA_XFREE: *mut ::libc::c_void = 0 as *mut _; +- #[inline] +- pub unsafe fn pa_xfree(ptr: *mut c_void) { +- (::std::mem::transmute::<_, extern "C" fn(*mut c_void)>(PA_XFREE))(ptr) +- } +- +- static mut PA_XSTRDUP: *mut ::libc::c_void = 0 as *mut _; +- #[inline] +- pub unsafe fn pa_xstrdup(str: *const c_char) -> *mut c_char { +- (::std::mem::transmute::<_, extern "C" fn(*const c_char) -> *mut c_char>(PA_XSTRDUP))(str) +- } +- + static mut PA_XREALLOC: *mut ::libc::c_void = 0 as *mut _; + #[inline] + pub unsafe fn pa_xrealloc(ptr: *mut c_void, size: usize) -> *mut c_void { +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_types.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_types.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_types.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-ffi/src/ffi_types.rs 2017-08-04 13:37:46.384821737 +0200 +@@ -1,6 +1,6 @@ + #![allow(non_camel_case_types)] + +-use std::os::raw::{c_char, c_int, c_long, c_ulong, c_void}; ++use std::os::raw::{c_char, c_int, c_long, c_uint, c_ulong, c_void}; + + /* automatically generated by rust-bindgen */ + pub const PA_RATE_MAX: u32 = 48000 * 8; +@@ -74,10 +74,10 @@ pub const PA_OPERATION_DONE: c_int = 1; + pub const PA_OPERATION_CANCELLED: c_int = 2; + pub type pa_operation_state_t = c_int; + +-pub const PA_CONTEXT_NOFLAGS: c_int = 0; +-pub const PA_CONTEXT_NOAUTOSPAWN: c_int = 1; +-pub const PA_CONTEXT_NOFAIL: c_int = 2; +-pub type pa_context_flags_t = c_int; ++pub const PA_CONTEXT_NOFLAGS: c_uint = 0; ++pub const PA_CONTEXT_NOAUTOSPAWN: c_uint = 1; ++pub const PA_CONTEXT_NOFAIL: c_uint = 2; ++pub type pa_context_flags_t = c_uint; + + pub const PA_DIRECTION_OUTPUT: c_int = 1; + pub const PA_DIRECTION_INPUT: c_int = 2; +@@ -93,28 +93,28 @@ pub const PA_STREAM_RECORD: c_int = 2; + pub const PA_STREAM_UPLOAD: c_int = 3; + pub type pa_stream_direction_t = c_int; + +-pub const PA_STREAM_NOFLAGS: c_int = 0x0_0000; +-pub const PA_STREAM_START_CORKED: c_int = 0x0_0001; +-pub const PA_STREAM_INTERPOLATE_TIMING: c_int = 0x0_0002; +-pub const PA_STREAM_NOT_MONOTONIC: c_int = 0x0_0004; +-pub const PA_STREAM_AUTO_TIMING_UPDATE: c_int = 0x0_0008; +-pub const PA_STREAM_NO_REMAP_CHANNELS: c_int = 0x0_0010; +-pub const PA_STREAM_NO_REMIX_CHANNELS: c_int = 0x0_0020; +-pub const PA_STREAM_FIX_FORMAT: c_int = 0x0_0040; +-pub const PA_STREAM_FIX_RATE: c_int = 0x0_0080; +-pub const PA_STREAM_FIX_CHANNELS: c_int = 0x0_0100; +-pub const PA_STREAM_DONT_MOVE: c_int = 0x0_0200; +-pub const PA_STREAM_VARIABLE_RATE: c_int = 0x0_0400; +-pub const PA_STREAM_PEAK_DETECT: c_int = 0x0_0800; +-pub const PA_STREAM_START_MUTED: c_int = 0x0_1000; +-pub const PA_STREAM_ADJUST_LATENCY: c_int = 0x0_2000; +-pub const PA_STREAM_EARLY_REQUESTS: c_int = 0x0_4000; +-pub const PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND: c_int = 0x0_8000; +-pub const PA_STREAM_START_UNMUTED: c_int = 0x1_0000; +-pub const PA_STREAM_FAIL_ON_SUSPEND: c_int = 0x2_0000; +-pub const PA_STREAM_RELATIVE_VOLUME: c_int = 0x4_0000; +-pub const PA_STREAM_PASSTHROUGH: c_int = 0x8_0000; +-pub type pa_stream_flags_t = c_int; ++pub const PA_STREAM_NOFLAGS: c_uint = 0x0_0000; ++pub const PA_STREAM_START_CORKED: c_uint = 0x0_0001; ++pub const PA_STREAM_INTERPOLATE_TIMING: c_uint = 0x0_0002; ++pub const PA_STREAM_NOT_MONOTONIC: c_uint = 0x0_0004; ++pub const PA_STREAM_AUTO_TIMING_UPDATE: c_uint = 0x0_0008; ++pub const PA_STREAM_NO_REMAP_CHANNELS: c_uint = 0x0_0010; ++pub const PA_STREAM_NO_REMIX_CHANNELS: c_uint = 0x0_0020; ++pub const PA_STREAM_FIX_FORMAT: c_uint = 0x0_0040; ++pub const PA_STREAM_FIX_RATE: c_uint = 0x0_0080; ++pub const PA_STREAM_FIX_CHANNELS: c_uint = 0x0_0100; ++pub const PA_STREAM_DONT_MOVE: c_uint = 0x0_0200; ++pub const PA_STREAM_VARIABLE_RATE: c_uint = 0x0_0400; ++pub const PA_STREAM_PEAK_DETECT: c_uint = 0x0_0800; ++pub const PA_STREAM_START_MUTED: c_uint = 0x0_1000; ++pub const PA_STREAM_ADJUST_LATENCY: c_uint = 0x0_2000; ++pub const PA_STREAM_EARLY_REQUESTS: c_uint = 0x0_4000; ++pub const PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND: c_uint = 0x0_8000; ++pub const PA_STREAM_START_UNMUTED: c_uint = 0x1_0000; ++pub const PA_STREAM_FAIL_ON_SUSPEND: c_uint = 0x2_0000; ++pub const PA_STREAM_RELATIVE_VOLUME: c_uint = 0x4_0000; ++pub const PA_STREAM_PASSTHROUGH: c_uint = 0x8_0000; ++pub type pa_stream_flags_t = c_uint; + + #[repr(C)] + #[derive(Clone, Copy, Debug)] +@@ -162,19 +162,19 @@ pub const PA_ERR_BUSY: c_int = 26; + pub const PA_ERR_MAX: c_int = 27; + pub type pa_error_code_t = c_int; + +-pub const PA_SUBSCRIPTION_MASK_NULL: c_int = 0; +-pub const PA_SUBSCRIPTION_MASK_SINK: c_int = 1; +-pub const PA_SUBSCRIPTION_MASK_SOURCE: c_int = 2; +-pub const PA_SUBSCRIPTION_MASK_SINK_INPUT: c_int = 4; +-pub const PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT: c_int = 8; +-pub const PA_SUBSCRIPTION_MASK_MODULE: c_int = 16; +-pub const PA_SUBSCRIPTION_MASK_CLIENT: c_int = 32; +-pub const PA_SUBSCRIPTION_MASK_SAMPLE_CACHE: c_int = 64; +-pub const PA_SUBSCRIPTION_MASK_SERVER: c_int = 128; +-pub const PA_SUBSCRIPTION_MASK_AUTOLOAD: c_int = 256; +-pub const PA_SUBSCRIPTION_MASK_CARD: c_int = 512; +-pub const PA_SUBSCRIPTION_MASK_ALL: c_int = 767; +-pub type pa_subscription_mask_t = c_int; ++pub const PA_SUBSCRIPTION_MASK_NULL: c_uint = 0x0; ++pub const PA_SUBSCRIPTION_MASK_SINK: c_uint = 0x1; ++pub const PA_SUBSCRIPTION_MASK_SOURCE: c_uint = 0x2; ++pub const PA_SUBSCRIPTION_MASK_SINK_INPUT: c_uint = 0x4; ++pub const PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT: c_uint = 0x8; ++pub const PA_SUBSCRIPTION_MASK_MODULE: c_uint = 0x10; ++pub const PA_SUBSCRIPTION_MASK_CLIENT: c_uint = 0x20; ++pub const PA_SUBSCRIPTION_MASK_SAMPLE_CACHE: c_uint = 0x40; ++pub const PA_SUBSCRIPTION_MASK_SERVER: c_uint = 0x80; ++pub const PA_SUBSCRIPTION_MASK_AUTOLOAD: c_uint = 0x100; ++pub const PA_SUBSCRIPTION_MASK_CARD: c_uint = 0x200; ++pub const PA_SUBSCRIPTION_MASK_ALL: c_uint = 0x3FF; ++pub type pa_subscription_mask_t = c_uint; + + pub const PA_SUBSCRIPTION_EVENT_SINK: c_int = 0; + pub const PA_SUBSCRIPTION_EVENT_SOURCE: c_int = 1; +@@ -244,17 +244,17 @@ pub const PA_SEEK_RELATIVE_ON_READ: c_in + pub const PA_SEEK_RELATIVE_END: c_int = 3; + pub type pa_seek_mode_t = c_int; + +-pub const PA_SINK_NOFLAGS: c_int = 0; +-pub const PA_SINK_HW_VOLUME_CTRL: c_int = 1; +-pub const PA_SINK_LATENCY: c_int = 2; +-pub const PA_SINK_HARDWARE: c_int = 4; +-pub const PA_SINK_NETWORK: c_int = 8; +-pub const PA_SINK_HW_MUTE_CTRL: c_int = 16; +-pub const PA_SINK_DECIBEL_VOLUME: c_int = 32; +-pub const PA_SINK_FLAT_VOLUME: c_int = 64; +-pub const PA_SINK_DYNAMIC_LATENCY: c_int = 128; +-pub const PA_SINK_SET_FORMATS: c_int = 256; +-pub type pa_sink_flags_t = c_int; ++pub const PA_SINK_NOFLAGS: c_uint = 0x000; ++pub const PA_SINK_HW_VOLUME_CTRL: c_uint = 0x001; ++pub const PA_SINK_LATENCY: c_uint = 0x002; ++pub const PA_SINK_HARDWARE: c_uint = 0x004; ++pub const PA_SINK_NETWORK: c_uint = 0x008; ++pub const PA_SINK_HW_MUTE_CTRL: c_uint = 0x010; ++pub const PA_SINK_DECIBEL_VOLUME: c_uint = 0x020; ++pub const PA_SINK_FLAT_VOLUME: c_uint = 0x040; ++pub const PA_SINK_DYNAMIC_LATENCY: c_uint = 0x080; ++pub const PA_SINK_SET_FORMATS: c_uint = 0x100; ++pub type pa_sink_flags_t = c_uint; + + pub const PA_SINK_INVALID_STATE: c_int = -1; + pub const PA_SINK_RUNNING: c_int = 0; +@@ -264,16 +264,16 @@ pub const PA_SINK_INIT: c_int = -2; + pub const PA_SINK_UNLINKED: c_int = -3; + pub type pa_sink_state_t = c_int; + +-pub const PA_SOURCE_NOFLAGS: c_int = 0x00; +-pub const PA_SOURCE_HW_VOLUME_CTRL: c_int = 0x01; +-pub const PA_SOURCE_LATENCY: c_int = 0x02; +-pub const PA_SOURCE_HARDWARE: c_int = 0x04; +-pub const PA_SOURCE_NETWORK: c_int = 0x08; +-pub const PA_SOURCE_HW_MUTE_CTRL: c_int = 0x10; +-pub const PA_SOURCE_DECIBEL_VOLUME: c_int = 0x20; +-pub const PA_SOURCE_DYNAMIC_LATENCY: c_int = 0x40; +-pub const PA_SOURCE_FLAT_VOLUME: c_int = 0x80; +-pub type pa_source_flags_t = c_int; ++pub const PA_SOURCE_NOFLAGS: c_uint = 0x00; ++pub const PA_SOURCE_HW_VOLUME_CTRL: c_uint = 0x01; ++pub const PA_SOURCE_LATENCY: c_uint = 0x02; ++pub const PA_SOURCE_HARDWARE: c_uint = 0x04; ++pub const PA_SOURCE_NETWORK: c_uint = 0x08; ++pub const PA_SOURCE_HW_MUTE_CTRL: c_uint = 0x10; ++pub const PA_SOURCE_DECIBEL_VOLUME: c_uint = 0x20; ++pub const PA_SOURCE_DYNAMIC_LATENCY: c_uint = 0x40; ++pub const PA_SOURCE_FLAT_VOLUME: c_uint = 0x80; ++pub type pa_source_flags_t = c_uint; + + pub const PA_SOURCE_INVALID_STATE: c_int = -1; + pub const PA_SOURCE_RUNNING: c_int = 0; +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/Cargo.toml.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/Cargo.toml +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/Cargo.toml.cubeb-pulse-arm 2017-08-04 13:37:46.384821737 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/Cargo.toml 2017-08-04 13:37:46.384821737 +0200 +@@ -0,0 +1,8 @@ ++[package] ++name = "pulse" ++version = "0.1.0" ++authors = ["Dan Glastonbury "] ++ ++[dependencies] ++bitflags = "^0.7.0" ++pulse-ffi = { path = "../pulse-ffi" } +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/context.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/context.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/context.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/context.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,394 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ::*; ++use ffi; ++use std::ffi::CStr; ++use std::os::raw::{c_int, c_void}; ++use std::ptr; ++use util::UnwrapCStr; ++ ++// A note about `wrapped` functions ++// ++// C FFI demands `unsafe extern fn(*mut pa_context, ...) -> i32`, etc, ++// but we want to allow such callbacks to be safe. This means no ++// `unsafe` or `extern`, and callbacks should be called with a safe ++// wrapper of `*mut pa_context`. Since the callback doesn't take ++// ownership, this is `&Context`. `fn wrapped(...)` defines a ++// function that converts from our safe signature to the unsafe ++// signature. ++// ++// Currently, we use a property of Rust, namely that each function ++// gets its own unique type. These unique types can't be written ++// directly, so we use generic and a type parameter, and let the Rust ++// compiler fill in the name for us: ++// ++// fn get_sink_input_info(&self, ..., _: CB, ...) -> ... ++// where CB: Fn(&Context, *const SinkInputInfo, i32, *mut c_void) ++// ++// Because we aren't storing or passing any state, we assert, at run-time :-(, ++// that our functions are zero-sized: ++// ++// assert!(mem::size_of::() == 0); ++// ++// We need to obtain a value of type F in order to call it. Since we ++// can't name the function, we have to unsafely construct that value ++// somehow - we do this using mem::uninitialized. Then, we call that ++// function with a reference to the Context, and save the result: ++// ++// | generate value || call it | ++// let result = ::std::mem::uninitialized::()(&mut object); ++// ++// Lastly, since our Object is an owned type, we need to avoid ++// dropping it, then return the result we just generated. ++// ++// mem::forget(object); ++// result ++ ++// Aid in returning Operation from callbacks ++macro_rules! op_or_err { ++ ($self_:ident, $e:expr) => {{ ++ let o = unsafe { $e }; ++ if o.is_null() { ++ Err(ErrorCode::from_error_code($self_.errno())) ++ } else { ++ Ok(unsafe { operation::from_raw_ptr(o) }) ++ } ++ }} ++} ++ ++#[repr(C)] ++#[derive(Debug)] ++pub struct Context(*mut ffi::pa_context); ++ ++impl Context { ++ pub fn new<'a, OPT>(api: &MainloopApi, name: OPT) -> Option ++ where OPT: Into> ++ { ++ let ptr = unsafe { ffi::pa_context_new(api.raw_mut(), name.unwrap_cstr()) }; ++ if ptr.is_null() { ++ None ++ } else { ++ Some(Context(ptr)) ++ } ++ } ++ ++ #[doc(hidden)] ++ pub fn raw_mut(&self) -> &mut ffi::pa_context { ++ unsafe { &mut *self.0 } ++ } ++ ++ pub fn unref(self) { ++ unsafe { ++ ffi::pa_context_unref(self.raw_mut()); ++ } ++ } ++ ++ pub fn clear_state_callback(&self) { ++ unsafe { ++ ffi::pa_context_set_state_callback(self.raw_mut(), None, ptr::null_mut()); ++ } ++ } ++ ++ pub fn set_state_callback(&self, _: CB, userdata: *mut c_void) ++ where CB: Fn(&Context, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, userdata: *mut c_void) ++ where F: Fn(&Context, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ unsafe { ++ ffi::pa_context_set_state_callback(self.raw_mut(), Some(wrapped::), userdata); ++ } ++ } ++ ++ pub fn errno(&self) -> ffi::pa_error_code_t { ++ unsafe { ffi::pa_context_errno(self.raw_mut()) } ++ } ++ ++ pub fn get_state(&self) -> ContextState { ++ ContextState::try_from(unsafe { ++ ffi::pa_context_get_state(self.raw_mut()) ++ }).expect("pa_context_get_state returned invalid ContextState") ++ } ++ ++ pub fn connect<'a, OPT>(&self, server: OPT, flags: ContextFlags, api: *const ffi::pa_spawn_api) -> Result<()> ++ where OPT: Into> ++ { ++ let r = unsafe { ++ ffi::pa_context_connect(self.raw_mut(), ++ server.into().unwrap_cstr(), ++ flags.into(), ++ api) ++ }; ++ error_result!((), r) ++ } ++ ++ pub fn disconnect(&self) { ++ unsafe { ++ ffi::pa_context_disconnect(self.raw_mut()); ++ } ++ } ++ ++ ++ pub fn drain(&self, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, userdata: *mut c_void) ++ where F: Fn(&Context, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_drain(self.raw_mut(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn rttime_new(&self, usec: USec, _: CB, userdata: *mut c_void) -> *mut ffi::pa_time_event ++ where CB: Fn(&MainloopApi, *mut ffi::pa_time_event, &TimeVal, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(a: *mut ffi::pa_mainloop_api, ++ e: *mut ffi::pa_time_event, ++ tv: *const TimeVal, ++ userdata: *mut c_void) ++ where F: Fn(&MainloopApi, *mut ffi::pa_time_event, &TimeVal, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let api = mainloop_api::from_raw_ptr(a); ++ let timeval = &*tv; ++ let result = uninitialized::()(&api, e, timeval, userdata); ++ forget(api); ++ ++ result ++ } ++ ++ unsafe { ffi::pa_context_rttime_new(self.raw_mut(), usec, Some(wrapped::), userdata) } ++ } ++ ++ pub fn get_server_info(&self, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, &ServerInfo, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, i: *const ffi::pa_server_info, userdata: *mut c_void) ++ where F: Fn(&Context, &ServerInfo, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ debug_assert_ne!(i, ptr::null_mut()); ++ let info = &*i; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, info, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_get_server_info(self.raw_mut(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn get_sink_info_by_name(&self, name: &CStr, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, *const SinkInfo, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, ++ info: *const ffi::pa_sink_info, ++ eol: c_int, ++ userdata: *mut c_void) ++ where F: Fn(&Context, *const SinkInfo, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, info, eol, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_get_sink_info_by_name(self.raw_mut(), name.as_ptr(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn get_sink_info_list(&self, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, *const SinkInfo, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, ++ info: *const ffi::pa_sink_info, ++ eol: c_int, ++ userdata: *mut c_void) ++ where F: Fn(&Context, *const SinkInfo, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, info, eol, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_get_sink_info_list(self.raw_mut(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn get_sink_input_info(&self, idx: u32, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, *const SinkInputInfo, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, ++ info: *const ffi::pa_sink_input_info, ++ eol: c_int, ++ userdata: *mut c_void) ++ where F: Fn(&Context, *const SinkInputInfo, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, info, eol, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_get_sink_input_info(self.raw_mut(), idx, Some(wrapped::), userdata)) ++ } ++ ++ pub fn get_source_info_list(&self, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, *const SourceInfo, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, ++ info: *const ffi::pa_source_info, ++ eol: c_int, ++ userdata: *mut c_void) ++ where F: Fn(&Context, *const SourceInfo, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, info, eol, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_get_source_info_list(self.raw_mut(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn set_sink_input_volume(&self, ++ idx: u32, ++ volume: &CVolume, ++ _: CB, ++ userdata: *mut c_void) ++ -> Result ++ where CB: Fn(&Context, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, success: c_int, userdata: *mut c_void) ++ where F: Fn(&Context, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, success, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_set_sink_input_volume(self.raw_mut(), idx, volume, Some(wrapped::), userdata)) ++ } ++ ++ pub fn subscribe(&self, m: SubscriptionMask, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Context, i32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, success: c_int, userdata: *mut c_void) ++ where F: Fn(&Context, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let result = uninitialized::()(&ctx, success, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ op_or_err!(self, ++ ffi::pa_context_subscribe(self.raw_mut(), m.into(), Some(wrapped::), userdata)) ++ } ++ ++ pub fn clear_subscribe_callback(&self) { ++ unsafe { ++ ffi::pa_context_set_subscribe_callback(self.raw_mut(), None, ptr::null_mut()); ++ } ++ } ++ ++ pub fn set_subscribe_callback(&self, _: CB, userdata: *mut c_void) ++ where CB: Fn(&Context, SubscriptionEvent, u32, *mut c_void) ++ { ++ debug_assert_eq!(::std::mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(c: *mut ffi::pa_context, ++ t: ffi::pa_subscription_event_type_t, ++ idx: u32, ++ userdata: *mut c_void) ++ where F: Fn(&Context, SubscriptionEvent, u32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let ctx = context::from_raw_ptr(c); ++ let event = SubscriptionEvent::try_from(t) ++ .expect("pa_context_subscribe_cb_t passed invalid pa_subscription_event_type_t"); ++ let result = uninitialized::()(&ctx, event, idx, userdata); ++ forget(ctx); ++ ++ result ++ } ++ ++ unsafe { ++ ffi::pa_context_set_subscribe_callback(self.raw_mut(), Some(wrapped::), userdata); ++ } ++ } ++} ++ ++#[doc(hidden)] ++pub unsafe fn from_raw_ptr(ptr: *mut ffi::pa_context) -> Context { ++ Context(ptr) ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/error.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/error.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/error.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/error.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,56 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ffi; ++use std::ffi::CStr; ++ ++#[macro_export] ++macro_rules! error_result { ++ ($t:expr, $err:expr) => { ++ if $err >= 0 { ++ Ok($t) ++ } else { ++ Err(ErrorCode::from_error_result($err)) ++ } ++ } ++} ++ ++#[derive(Debug, PartialEq)] ++pub struct ErrorCode { ++ err: ffi::pa_error_code_t, ++} ++ ++impl ErrorCode { ++ pub fn from_error_result(err: i32) -> Self { ++ debug_assert!(err < 0); ++ ErrorCode { ++ err: (-err) as ffi::pa_error_code_t, ++ } ++ } ++ ++ pub fn from_error_code(err: ffi::pa_error_code_t) -> Self { ++ debug_assert!(err > 0); ++ ErrorCode { ++ err: err, ++ } ++ } ++ ++ fn desc(&self) -> &'static str { ++ let cstr = unsafe { CStr::from_ptr(ffi::pa_strerror(self.err)) }; ++ cstr.to_str().unwrap() ++ } ++} ++ ++impl ::std::error::Error for ErrorCode { ++ fn description(&self) -> &str { ++ self.desc() ++ } ++} ++ ++impl ::std::fmt::Display for ErrorCode { ++ fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { ++ write!(f, "{:?}: {}", self, self.desc()) ++ } ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/lib.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/lib.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/lib.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/lib.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,653 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++#[macro_use] ++extern crate bitflags; ++extern crate pulse_ffi as ffi; ++ ++#[macro_use] ++mod error; ++mod context; ++mod mainloop_api; ++mod operation; ++mod proplist; ++mod stream; ++mod threaded_mainloop; ++mod util; ++ ++pub use context::Context; ++pub use error::ErrorCode; ++pub use ffi::pa_buffer_attr as BufferAttr; ++pub use ffi::pa_channel_map as ChannelMap; ++pub use ffi::pa_cvolume as CVolume; ++pub use ffi::pa_sample_spec as SampleSpec; ++pub use ffi::pa_server_info as ServerInfo; ++pub use ffi::pa_sink_info as SinkInfo; ++pub use ffi::pa_sink_input_info as SinkInputInfo; ++pub use ffi::pa_source_info as SourceInfo; ++pub use ffi::pa_usec_t as USec; ++pub use ffi::pa_volume_t as Volume; ++pub use ffi::timeval as TimeVal; ++pub use mainloop_api::MainloopApi; ++pub use operation::Operation; ++pub use proplist::Proplist; ++use std::os::raw::{c_char, c_uint}; ++pub use stream::Stream; ++pub use threaded_mainloop::ThreadedMainloop; ++ ++#[allow(non_camel_case_types)] ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SampleFormat { ++ Invalid = ffi::PA_SAMPLE_INVALID, ++ U8 = ffi::PA_SAMPLE_U8, ++ Alaw = ffi::PA_SAMPLE_ALAW, ++ Ulaw = ffi::PA_SAMPLE_ULAW, ++ Signed16LE = ffi::PA_SAMPLE_S16LE, ++ Signed16BE = ffi::PA_SAMPLE_S16BE, ++ Float32LE = ffi::PA_SAMPLE_FLOAT32LE, ++ Float32BE = ffi::PA_SAMPLE_FLOAT32BE, ++ Signed32LE = ffi::PA_SAMPLE_S32LE, ++ Signed32BE = ffi::PA_SAMPLE_S32BE, ++ Signed24LE = ffi::PA_SAMPLE_S24LE, ++ Signed24BE = ffi::PA_SAMPLE_S24BE, ++ Signed24_32LE = ffi::PA_SAMPLE_S24_32LE, ++ Signed23_32BE = ffi::PA_SAMPLE_S24_32BE, ++} ++ ++impl Default for SampleFormat { ++ fn default() -> Self { ++ SampleFormat::Invalid ++ } ++} ++ ++impl Into for SampleFormat { ++ fn into(self) -> ffi::pa_sample_format_t { ++ self as ffi::pa_sample_format_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum ContextState { ++ Unconnected = ffi::PA_CONTEXT_UNCONNECTED, ++ Connecting = ffi::PA_CONTEXT_CONNECTING, ++ Authorizing = ffi::PA_CONTEXT_AUTHORIZING, ++ SettingName = ffi::PA_CONTEXT_SETTING_NAME, ++ Ready = ffi::PA_CONTEXT_READY, ++ Failed = ffi::PA_CONTEXT_FAILED, ++ Terminated = ffi::PA_CONTEXT_TERMINATED, ++} ++ ++impl ContextState { ++ // This function implements the PA_CONTENT_IS_GOOD macro from pulse/def.h ++ // It must match the version from PA headers. ++ pub fn is_good(self) -> bool { ++ match self { ++ ContextState::Connecting | ++ ContextState::Authorizing | ++ ContextState::SettingName | ++ ContextState::Ready => true, ++ _ => false, ++ } ++ } ++ ++ pub fn try_from(x: ffi::pa_context_state_t) -> Option { ++ if x >= ffi::PA_CONTEXT_UNCONNECTED && x <= ffi::PA_CONTEXT_TERMINATED { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Default for ContextState { ++ fn default() -> Self { ++ ContextState::Unconnected ++ } ++} ++ ++impl Into for ContextState { ++ fn into(self) -> ffi::pa_context_state_t { ++ self as ffi::pa_context_state_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum StreamState { ++ Unconnected = ffi::PA_STREAM_UNCONNECTED, ++ Creating = ffi::PA_STREAM_CREATING, ++ Ready = ffi::PA_STREAM_READY, ++ Failed = ffi::PA_STREAM_FAILED, ++ Terminated = ffi::PA_STREAM_TERMINATED, ++} ++ ++impl StreamState { ++ // This function implements the PA_STREAM_IS_GOOD macro from pulse/def.h ++ // It must match the version from PA headers. ++ pub fn is_good(self) -> bool { ++ match self { ++ StreamState::Creating | StreamState::Ready => true, ++ _ => false, ++ } ++ } ++ ++ pub fn try_from(x: ffi::pa_stream_state_t) -> Option { ++ if x >= ffi::PA_STREAM_UNCONNECTED && x <= ffi::PA_STREAM_TERMINATED { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Default for StreamState { ++ fn default() -> Self { ++ StreamState::Unconnected ++ } ++} ++ ++impl Into for StreamState { ++ fn into(self) -> ffi::pa_stream_state_t { ++ self as ffi::pa_stream_state_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum OperationState { ++ Running = ffi::PA_OPERATION_RUNNING, ++ Done = ffi::PA_OPERATION_DONE, ++ Cancelled = ffi::PA_OPERATION_CANCELLED, ++} ++ ++impl OperationState { ++ pub fn try_from(x: ffi::pa_operation_state_t) -> Option { ++ if x >= ffi::PA_OPERATION_RUNNING && x <= ffi::PA_OPERATION_CANCELLED { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for OperationState { ++ fn into(self) -> ffi::pa_operation_state_t { ++ self as ffi::pa_operation_state_t ++ } ++} ++ ++bitflags! { ++ pub flags ContextFlags: u32 { ++ const CONTEXT_FLAGS_NOAUTOSPAWN = ffi::PA_CONTEXT_NOAUTOSPAWN, ++ const CONTEXT_FLAGS_NOFAIL = ffi::PA_CONTEXT_NOFAIL, ++ } ++} ++ ++impl Into for ContextFlags { ++ fn into(self) -> ffi::pa_context_flags_t { ++ self.bits() as ffi::pa_context_flags_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum DeviceType { ++ Sink = ffi::PA_DEVICE_TYPE_SINK, ++ Source = ffi::PA_DEVICE_TYPE_SOURCE, ++} ++ ++impl DeviceType { ++ pub fn try_from(x: ffi::pa_device_type_t) -> Option { ++ if x >= ffi::PA_DEVICE_TYPE_SINK && x <= ffi::PA_DEVICE_TYPE_SOURCE { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for DeviceType { ++ fn into(self) -> ffi::pa_device_type_t { ++ self as ffi::pa_device_type_t ++ } ++} ++ ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum StreamDirection { ++ NoDirection = ffi::PA_STREAM_NODIRECTION, ++ Playback = ffi::PA_STREAM_PLAYBACK, ++ Record = ffi::PA_STREAM_RECORD, ++ StreamUpload = ffi::PA_STREAM_UPLOAD, ++} ++ ++impl StreamDirection { ++ pub fn try_from(x: ffi::pa_stream_direction_t) -> Option { ++ if x >= ffi::PA_STREAM_NODIRECTION && x <= ffi::PA_STREAM_UPLOAD { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for StreamDirection { ++ fn into(self) -> ffi::pa_stream_direction_t { ++ self as ffi::pa_stream_direction_t ++ } ++} ++ ++bitflags! { ++ pub flags StreamFlags : u32 { ++ const STREAM_START_CORKED = ffi::PA_STREAM_START_CORKED, ++ const STREAM_INTERPOLATE_TIMING = ffi::PA_STREAM_INTERPOLATE_TIMING, ++ const STREAM_NOT_MONOTONIC = ffi::PA_STREAM_NOT_MONOTONIC, ++ const STREAM_AUTO_TIMING_UPDATE = ffi::PA_STREAM_AUTO_TIMING_UPDATE, ++ const STREAM_NO_REMAP_CHANNELS = ffi::PA_STREAM_NO_REMAP_CHANNELS, ++ const STREAM_NO_REMIX_CHANNELS = ffi::PA_STREAM_NO_REMIX_CHANNELS, ++ const STREAM_FIX_FORMAT = ffi::PA_STREAM_FIX_FORMAT, ++ const STREAM_FIX_RATE = ffi::PA_STREAM_FIX_RATE, ++ const STREAM_FIX_CHANNELS = ffi::PA_STREAM_FIX_CHANNELS, ++ const STREAM_DONT_MOVE = ffi::PA_STREAM_DONT_MOVE, ++ const STREAM_VARIABLE_RATE = ffi::PA_STREAM_VARIABLE_RATE, ++ const STREAM_PEAK_DETECT = ffi::PA_STREAM_PEAK_DETECT, ++ const STREAM_START_MUTED = ffi::PA_STREAM_START_MUTED, ++ const STREAM_ADJUST_LATENCY = ffi::PA_STREAM_ADJUST_LATENCY, ++ const STREAM_EARLY_REQUESTS = ffi::PA_STREAM_EARLY_REQUESTS, ++ const STREAM_DONT_INHIBIT_AUTO_SUSPEND = ffi::PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND, ++ const STREAM_START_UNMUTED = ffi::PA_STREAM_START_UNMUTED, ++ const STREAM_FAIL_ON_SUSPEND = ffi::PA_STREAM_FAIL_ON_SUSPEND, ++ const STREAM_RELATIVE_VOLUME = ffi::PA_STREAM_RELATIVE_VOLUME, ++ const STREAM_PASSTHROUGH = ffi::PA_STREAM_PASSTHROUGH, ++ } ++} ++ ++impl StreamFlags { ++ pub fn try_from(x: ffi::pa_stream_flags_t) -> Option { ++ if (x & ++ !(ffi::PA_STREAM_NOFLAGS | ffi::PA_STREAM_START_CORKED | ffi::PA_STREAM_INTERPOLATE_TIMING | ++ ffi::PA_STREAM_NOT_MONOTONIC | ffi::PA_STREAM_AUTO_TIMING_UPDATE | ++ ffi::PA_STREAM_NO_REMAP_CHANNELS | ++ ffi::PA_STREAM_NO_REMIX_CHANNELS | ffi::PA_STREAM_FIX_FORMAT | ffi::PA_STREAM_FIX_RATE | ++ ffi::PA_STREAM_FIX_CHANNELS | ++ ffi::PA_STREAM_DONT_MOVE | ffi::PA_STREAM_VARIABLE_RATE | ffi::PA_STREAM_PEAK_DETECT | ++ ffi::PA_STREAM_START_MUTED | ffi::PA_STREAM_ADJUST_LATENCY | ++ ffi::PA_STREAM_EARLY_REQUESTS | ++ ffi::PA_STREAM_DONT_INHIBIT_AUTO_SUSPEND | ++ ffi::PA_STREAM_START_UNMUTED | ffi::PA_STREAM_FAIL_ON_SUSPEND | ++ ffi::PA_STREAM_RELATIVE_VOLUME | ffi::PA_STREAM_PASSTHROUGH)) == 0 { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for StreamFlags { ++ fn into(self) -> ffi::pa_stream_flags_t { ++ self.bits() as ffi::pa_stream_flags_t ++ } ++} ++ ++bitflags!{ ++ pub flags SubscriptionMask : u32 { ++ const SUBSCRIPTION_MASK_SINK = ffi::PA_SUBSCRIPTION_MASK_SINK, ++ const SUBSCRIPTION_MASK_SOURCE = ffi::PA_SUBSCRIPTION_MASK_SOURCE, ++ const SUBSCRIPTION_MASK_SINK_INPUT = ffi::PA_SUBSCRIPTION_MASK_SINK_INPUT, ++ const SUBSCRIPTION_MASK_SOURCE_OUTPUT = ffi::PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, ++ const SUBSCRIPTION_MASK_MODULE = ffi::PA_SUBSCRIPTION_MASK_MODULE, ++ const SUBSCRIPTION_MASK_CLIENT = ffi::PA_SUBSCRIPTION_MASK_CLIENT, ++ const SUBSCRIPTION_MASK_SAMPLE_CACHE = ffi::PA_SUBSCRIPTION_MASK_SAMPLE_CACHE, ++ const SUBSCRIPTION_MASK_SERVER = ffi::PA_SUBSCRIPTION_MASK_SERVER, ++ const SUBSCRIPTION_MASK_AUTOLOAD = ffi::PA_SUBSCRIPTION_MASK_AUTOLOAD, ++ const SUBSCRIPTION_MASK_CARD = ffi::PA_SUBSCRIPTION_MASK_CARD, ++ } ++} ++ ++impl SubscriptionMask { ++ pub fn try_from(x: ffi::pa_subscription_mask_t) -> Option { ++ if (x & !ffi::PA_SUBSCRIPTION_MASK_ALL) == 0 { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for SubscriptionMask { ++ fn into(self) -> ffi::pa_subscription_mask_t { ++ self.bits() as ffi::pa_subscription_mask_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SubscriptionEventFacility { ++ Sink = ffi::PA_SUBSCRIPTION_EVENT_SINK, ++ Source = ffi::PA_SUBSCRIPTION_EVENT_SOURCE, ++ SinkInput = ffi::PA_SUBSCRIPTION_EVENT_SINK_INPUT, ++ SourceOutput = ffi::PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT, ++ Module = ffi::PA_SUBSCRIPTION_EVENT_MODULE, ++ Client = ffi::PA_SUBSCRIPTION_EVENT_CLIENT, ++ SampleCache = ffi::PA_SUBSCRIPTION_EVENT_SAMPLE_CACHE, ++ Server = ffi::PA_SUBSCRIPTION_EVENT_SERVER, ++ Autoload = ffi::PA_SUBSCRIPTION_EVENT_AUTOLOAD, ++ Card = ffi::PA_SUBSCRIPTION_EVENT_CARD, ++} ++ ++#[repr(C)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SubscriptionEventType { ++ New, ++ Change, ++ Remove, ++} ++ ++#[repr(C)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub struct SubscriptionEvent(ffi::pa_subscription_event_type_t); ++impl SubscriptionEvent { ++ pub fn try_from(x: ffi::pa_subscription_event_type_t) -> Option { ++ if (x & !(ffi::PA_SUBSCRIPTION_EVENT_TYPE_MASK | ffi::PA_SUBSCRIPTION_EVENT_FACILITY_MASK)) == 0 { ++ Some(SubscriptionEvent(x)) ++ } else { ++ None ++ } ++ } ++ ++ pub fn event_facility(self) -> SubscriptionEventFacility { ++ unsafe { ::std::mem::transmute(self.0 & ffi::PA_SUBSCRIPTION_EVENT_FACILITY_MASK) } ++ } ++ ++ pub fn event_type(self) -> SubscriptionEventType { ++ unsafe { ::std::mem::transmute(((self.0 & ffi::PA_SUBSCRIPTION_EVENT_TYPE_MASK) >> 4)) } ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SeekMode { ++ Relative = ffi::PA_SEEK_RELATIVE, ++ Absolute = ffi::PA_SEEK_ABSOLUTE, ++ RelativeOnRead = ffi::PA_SEEK_RELATIVE_ON_READ, ++ RelativeEnd = ffi::PA_SEEK_RELATIVE_END, ++} ++ ++impl SeekMode { ++ pub fn try_from(x: ffi::pa_seek_mode_t) -> Option { ++ if x >= ffi::PA_SEEK_RELATIVE && x <= ffi::PA_SEEK_RELATIVE_END { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for SeekMode { ++ fn into(self) -> ffi::pa_seek_mode_t { ++ self as ffi::pa_seek_mode_t ++ } ++} ++ ++bitflags! { ++ pub flags SinkFlags: u32 { ++ const SINK_HW_VOLUME_CTRL = ffi::PA_SINK_HW_VOLUME_CTRL, ++ const SINK_LATENCY = ffi::PA_SINK_LATENCY, ++ const SINK_HARDWARE = ffi::PA_SINK_HARDWARE, ++ const SINK_NETWORK = ffi::PA_SINK_NETWORK, ++ const SINK_HW_MUTE_CTRL = ffi::PA_SINK_HW_MUTE_CTRL, ++ const SINK_DECIBEL_VOLUME = ffi::PA_SINK_DECIBEL_VOLUME, ++ const SINK_FLAT_VOLUME = ffi::PA_SINK_FLAT_VOLUME, ++ const SINK_DYNAMIC_LATENCY = ffi::PA_SINK_DYNAMIC_LATENCY, ++ const SINK_SET_FORMATS = ffi::PA_SINK_SET_FORMATS, ++ } ++} ++ ++impl SinkFlags { ++ pub fn try_from(x: ffi::pa_sink_flags_t) -> Option { ++ if (x & ++ !(ffi::PA_SOURCE_NOFLAGS | ffi::PA_SOURCE_HW_VOLUME_CTRL | ffi::PA_SOURCE_LATENCY | ++ ffi::PA_SOURCE_HARDWARE | ffi::PA_SOURCE_NETWORK | ffi::PA_SOURCE_HW_MUTE_CTRL | ++ ffi::PA_SOURCE_DECIBEL_VOLUME | ++ ffi::PA_SOURCE_DYNAMIC_LATENCY | ffi::PA_SOURCE_FLAT_VOLUME)) == 0 { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SinkState { ++ InvalidState = ffi::PA_SINK_INVALID_STATE, ++ Running = ffi::PA_SINK_RUNNING, ++ Idle = ffi::PA_SINK_IDLE, ++ Suspended = ffi::PA_SINK_SUSPENDED, ++ Init = ffi::PA_SINK_INIT, ++ Unlinked = ffi::PA_SINK_UNLINKED, ++} ++ ++bitflags!{ ++ pub flags SourceFlags: u32 { ++ const SOURCE_FLAGS_HW_VOLUME_CTRL = ffi::PA_SOURCE_HW_VOLUME_CTRL, ++ const SOURCE_FLAGS_LATENCY = ffi::PA_SOURCE_LATENCY, ++ const SOURCE_FLAGS_HARDWARE = ffi::PA_SOURCE_HARDWARE, ++ const SOURCE_FLAGS_NETWORK = ffi::PA_SOURCE_NETWORK, ++ const SOURCE_FLAGS_HW_MUTE_CTRL = ffi::PA_SOURCE_HW_MUTE_CTRL, ++ const SOURCE_FLAGS_DECIBEL_VOLUME = ffi::PA_SOURCE_DECIBEL_VOLUME, ++ const SOURCE_FLAGS_DYNAMIC_LATENCY = ffi::PA_SOURCE_DYNAMIC_LATENCY, ++ const SOURCE_FLAGS_FLAT_VOLUME = ffi::PA_SOURCE_FLAT_VOLUME, ++ } ++} ++ ++impl Into for SourceFlags { ++ fn into(self) -> ffi::pa_source_flags_t { ++ self.bits() as ffi::pa_source_flags_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum SourceState { ++ InvalidState = ffi::PA_SOURCE_INVALID_STATE, ++ Running = ffi::PA_SOURCE_RUNNING, ++ Idle = ffi::PA_SOURCE_IDLE, ++ Suspended = ffi::PA_SOURCE_SUSPENDED, ++ Init = ffi::PA_SOURCE_INIT, ++ Unlinked = ffi::PA_SOURCE_UNLINKED, ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum PortAvailable { ++ Unknown = ffi::PA_PORT_AVAILABLE_UNKNOWN, ++ No = ffi::PA_PORT_AVAILABLE_NO, ++ Yes = ffi::PA_PORT_AVAILABLE_YES, ++} ++ ++impl PortAvailable { ++ pub fn try_from(x: ffi::pa_port_available_t) -> Option { ++ if x >= ffi::PA_PORT_AVAILABLE_UNKNOWN && x <= ffi::PA_PORT_AVAILABLE_YES { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Into for PortAvailable { ++ fn into(self) -> ffi::pa_port_available_t { ++ self as ffi::pa_port_available_t ++ } ++} ++ ++#[repr(i32)] ++#[derive(Clone, Copy, Debug, PartialEq, Eq)] ++pub enum ChannelPosition { ++ Invalid = ffi::PA_CHANNEL_POSITION_INVALID, ++ Mono = ffi::PA_CHANNEL_POSITION_MONO, ++ FrontLeft = ffi::PA_CHANNEL_POSITION_FRONT_LEFT, ++ FrontRight = ffi::PA_CHANNEL_POSITION_FRONT_RIGHT, ++ FrontCenter = ffi::PA_CHANNEL_POSITION_FRONT_CENTER, ++ RearCenter = ffi::PA_CHANNEL_POSITION_REAR_CENTER, ++ RearLeft = ffi::PA_CHANNEL_POSITION_REAR_LEFT, ++ RearRight = ffi::PA_CHANNEL_POSITION_REAR_RIGHT, ++ LowFreqEffects = ffi::PA_CHANNEL_POSITION_LFE, ++ FrontLeftOfCenter = ffi::PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, ++ FrontRightOfCenter = ffi::PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, ++ SideLeft = ffi::PA_CHANNEL_POSITION_SIDE_LEFT, ++ SideRight = ffi::PA_CHANNEL_POSITION_SIDE_RIGHT, ++ Aux0 = ffi::PA_CHANNEL_POSITION_AUX0, ++ Aux1 = ffi::PA_CHANNEL_POSITION_AUX1, ++ Aux2 = ffi::PA_CHANNEL_POSITION_AUX2, ++ Aux3 = ffi::PA_CHANNEL_POSITION_AUX3, ++ Aux4 = ffi::PA_CHANNEL_POSITION_AUX4, ++ Aux5 = ffi::PA_CHANNEL_POSITION_AUX5, ++ Aux6 = ffi::PA_CHANNEL_POSITION_AUX6, ++ Aux7 = ffi::PA_CHANNEL_POSITION_AUX7, ++ Aux8 = ffi::PA_CHANNEL_POSITION_AUX8, ++ Aux9 = ffi::PA_CHANNEL_POSITION_AUX9, ++ Aux10 = ffi::PA_CHANNEL_POSITION_AUX10, ++ Aux11 = ffi::PA_CHANNEL_POSITION_AUX11, ++ Aux12 = ffi::PA_CHANNEL_POSITION_AUX12, ++ Aux13 = ffi::PA_CHANNEL_POSITION_AUX13, ++ Aux14 = ffi::PA_CHANNEL_POSITION_AUX14, ++ Aux15 = ffi::PA_CHANNEL_POSITION_AUX15, ++ Aux16 = ffi::PA_CHANNEL_POSITION_AUX16, ++ Aux17 = ffi::PA_CHANNEL_POSITION_AUX17, ++ Aux18 = ffi::PA_CHANNEL_POSITION_AUX18, ++ Aux19 = ffi::PA_CHANNEL_POSITION_AUX19, ++ Aux20 = ffi::PA_CHANNEL_POSITION_AUX20, ++ Aux21 = ffi::PA_CHANNEL_POSITION_AUX21, ++ Aux22 = ffi::PA_CHANNEL_POSITION_AUX22, ++ Aux23 = ffi::PA_CHANNEL_POSITION_AUX23, ++ Aux24 = ffi::PA_CHANNEL_POSITION_AUX24, ++ Aux25 = ffi::PA_CHANNEL_POSITION_AUX25, ++ Aux26 = ffi::PA_CHANNEL_POSITION_AUX26, ++ Aux27 = ffi::PA_CHANNEL_POSITION_AUX27, ++ Aux28 = ffi::PA_CHANNEL_POSITION_AUX28, ++ Aux29 = ffi::PA_CHANNEL_POSITION_AUX29, ++ Aux30 = ffi::PA_CHANNEL_POSITION_AUX30, ++ Aux31 = ffi::PA_CHANNEL_POSITION_AUX31, ++ TopCenter = ffi::PA_CHANNEL_POSITION_TOP_CENTER, ++ TopFrontLeft = ffi::PA_CHANNEL_POSITION_TOP_FRONT_LEFT, ++ TopFrontRight = ffi::PA_CHANNEL_POSITION_TOP_FRONT_RIGHT, ++ TopFrontCenter = ffi::PA_CHANNEL_POSITION_TOP_FRONT_CENTER, ++ TopRearLeft = ffi::PA_CHANNEL_POSITION_TOP_REAR_LEFT, ++ TopRearRight = ffi::PA_CHANNEL_POSITION_TOP_REAR_RIGHT, ++ TopRearCenter = ffi::PA_CHANNEL_POSITION_TOP_REAR_CENTER, ++} ++ ++impl ChannelPosition { ++ pub fn try_from(x: ffi::pa_channel_position_t) -> Option { ++ if x >= ffi::PA_CHANNEL_POSITION_INVALID && x < ffi::PA_CHANNEL_POSITION_MAX { ++ Some(unsafe { ::std::mem::transmute(x) }) ++ } else { ++ None ++ } ++ } ++} ++ ++impl Default for ChannelPosition { ++ fn default() -> Self { ++ ChannelPosition::Invalid ++ } ++} ++ ++impl Into for ChannelPosition { ++ fn into(self) -> ffi::pa_channel_position_t { ++ self as ffi::pa_channel_position_t ++ } ++} ++pub type Result = ::std::result::Result; ++ ++pub trait CVolumeExt { ++ fn set(&mut self, channels: c_uint, v: Volume); ++ fn set_balance(&mut self, map: &ChannelMap, new_balance: f32); ++} ++ ++impl CVolumeExt for CVolume { ++ fn set(&mut self, channels: c_uint, v: Volume) { ++ unsafe { ++ ffi::pa_cvolume_set(self, channels, v); ++ } ++ } ++ ++ fn set_balance(&mut self, map: &ChannelMap, new_balance: f32) { ++ unsafe { ++ ffi::pa_cvolume_set_balance(self, map, new_balance); ++ } ++ } ++} ++ ++pub trait ChannelMapExt { ++ fn init() -> ChannelMap; ++ fn can_balance(&self) -> bool; ++} ++ ++impl ChannelMapExt for ChannelMap { ++ fn init() -> ChannelMap { ++ let mut cm = ChannelMap::default(); ++ unsafe { ++ ffi::pa_channel_map_init(&mut cm); ++ } ++ cm ++ } ++ fn can_balance(&self) -> bool { ++ unsafe { ffi::pa_channel_map_can_balance(self) > 0 } ++ } ++} ++ ++pub trait ProplistExt { ++ fn proplist(&self) -> Proplist; ++} ++ ++impl ProplistExt for SinkInfo { ++ fn proplist(&self) -> Proplist { ++ unsafe { proplist::from_raw_ptr(self.proplist) } ++ } ++} ++ ++impl ProplistExt for SourceInfo { ++ fn proplist(&self) -> Proplist { ++ unsafe { proplist::from_raw_ptr(self.proplist) } ++ } ++} ++ ++pub trait SampleSpecExt { ++ fn frame_size(&self) -> usize; ++} ++ ++impl SampleSpecExt for SampleSpec { ++ fn frame_size(&self) -> usize { ++ unsafe { ffi::pa_frame_size(self) } ++ } ++} ++ ++pub trait USecExt { ++ fn to_bytes(self, spec: &SampleSpec) -> usize; ++} ++ ++impl USecExt for USec { ++ fn to_bytes(self, spec: &SampleSpec) -> usize { ++ unsafe { ffi::pa_usec_to_bytes(self, spec) } ++ } ++} ++ ++pub fn library_version() -> *const c_char { ++ unsafe { ffi::pa_get_library_version() } ++} ++ ++pub fn sw_volume_from_linear(vol: f64) -> Volume { ++ unsafe { ffi::pa_sw_volume_from_linear(vol) } ++} ++ ++pub fn rtclock_now() -> USec { ++ unsafe { ffi::pa_rtclock_now() } ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/mainloop_api.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/mainloop_api.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/mainloop_api.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/mainloop_api.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,58 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ffi; ++use std::mem; ++use std::os::raw::c_void; ++ ++ ++#[allow(non_camel_case_types)] ++type pa_once_cb_t = Option; ++fn wrap_once_cb(_: F) -> pa_once_cb_t ++ where F: Fn(&MainloopApi, *mut c_void) ++{ ++ assert!(mem::size_of::() == 0); ++ ++ unsafe extern "C" fn wrapped(m: *mut ffi::pa_mainloop_api, userdata: *mut c_void) ++ where F: Fn(&MainloopApi, *mut c_void) ++ { ++ let api = from_raw_ptr(m); ++ let result = mem::transmute::<_, &F>(&())(&api, userdata); ++ mem::forget(api); ++ result ++ } ++ ++ Some(wrapped::) ++} ++ ++pub struct MainloopApi(*mut ffi::pa_mainloop_api); ++ ++impl MainloopApi { ++ pub fn raw_mut(&self) -> &mut ffi::pa_mainloop_api { ++ unsafe { &mut *self.0 } ++ } ++ ++ pub fn once(&self, cb: CB, userdata: *mut c_void) ++ where CB: Fn(&MainloopApi, *mut c_void) ++ { ++ let wrapped = wrap_once_cb(cb); ++ unsafe { ++ ffi::pa_mainloop_api_once(self.raw_mut(), wrapped, userdata); ++ } ++ } ++ ++ pub fn time_free(&self, e: *mut ffi::pa_time_event) { ++ unsafe { ++ if let Some(f) = self.raw_mut().time_free { ++ f(e); ++ } ++ } ++ } ++} ++ ++pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_mainloop_api) -> MainloopApi { ++ MainloopApi(raw) ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/operation.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/operation.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/operation.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/operation.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,43 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ffi; ++ ++#[derive(Debug)] ++pub struct Operation(*mut ffi::pa_operation); ++ ++impl Operation { ++ pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_operation) -> Operation { ++ Operation(raw) ++ } ++ ++ pub fn cancel(&mut self) { ++ unsafe { ++ ffi::pa_operation_cancel(self.0); ++ } ++ } ++ ++ pub fn get_state(&self) -> ffi::pa_operation_state_t { ++ unsafe { ffi::pa_operation_get_state(self.0) } ++ } ++} ++ ++impl Clone for Operation { ++ fn clone(&self) -> Self { ++ Operation(unsafe { ffi::pa_operation_ref(self.0) }) ++ } ++} ++ ++impl Drop for Operation { ++ fn drop(&mut self) { ++ unsafe { ++ ffi::pa_operation_unref(self.0); ++ } ++ } ++} ++ ++pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_operation) -> Operation { ++ Operation::from_raw_ptr(raw) ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/proplist.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/proplist.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/proplist.rs.cubeb-pulse-arm 2017-08-04 13:37:46.385821734 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/proplist.rs 2017-08-04 13:37:46.385821734 +0200 +@@ -0,0 +1,31 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ffi; ++use std::ffi::{CStr, CString}; ++ ++#[derive(Debug)] ++pub struct Proplist(*mut ffi::pa_proplist); ++ ++impl Proplist { ++ pub fn gets(&self, key: T) -> Option<&CStr> ++ where T: Into> ++ { ++ let key = match CString::new(key) { ++ Ok(k) => k, ++ _ => return None, ++ }; ++ let r = unsafe { ffi::pa_proplist_gets(self.0, key.as_ptr()) }; ++ if r.is_null() { ++ None ++ } else { ++ Some(unsafe { CStr::from_ptr(r) }) ++ } ++ } ++} ++ ++pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_proplist) -> Proplist { ++ return Proplist(raw); ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/stream.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/stream.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/stream.rs.cubeb-pulse-arm 2017-08-04 13:37:46.386821731 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/stream.rs 2017-08-04 13:37:46.386821731 +0200 +@@ -0,0 +1,367 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ::*; ++use context; ++use ffi; ++use operation; ++use std::ffi::CStr; ++use std::mem; ++use std::os::raw::{c_int, c_void}; ++use std::ptr; ++use util::*; ++ ++#[derive(Debug)] ++pub struct Stream(*mut ffi::pa_stream); ++ ++impl Stream { ++ pub fn new<'a, CM>(c: &Context, name: &::std::ffi::CStr, ss: &SampleSpec, map: CM) -> Option ++ where CM: Into> ++ { ++ let ptr = unsafe { ++ ffi::pa_stream_new(c.raw_mut(), ++ name.as_ptr(), ++ ss as *const _, ++ to_ptr(map.into())) ++ }; ++ if ptr.is_null() { ++ None ++ } else { ++ Some(Stream(ptr)) ++ } ++ } ++ ++ #[doc(hidden)] ++ pub fn raw_mut(&self) -> &mut ffi::pa_stream { ++ unsafe { &mut *self.0 } ++ } ++ ++ pub fn unref(self) { ++ unsafe { ++ ffi::pa_stream_unref(self.raw_mut()); ++ } ++ } ++ ++ pub fn get_state(&self) -> StreamState { ++ StreamState::try_from(unsafe { ++ ffi::pa_stream_get_state(self.raw_mut()) ++ }).expect("pa_stream_get_state returned invalid StreamState") ++ } ++ ++ pub fn get_context(&self) -> Option { ++ let ptr = unsafe { ffi::pa_stream_get_context(self.raw_mut()) }; ++ if ptr.is_null() { ++ return None; ++ } ++ ++ let ctx = unsafe { context::from_raw_ptr(ptr) }; ++ Some(ctx) ++ } ++ ++ pub fn get_index(&self) -> u32 { ++ unsafe { ffi::pa_stream_get_index(self.raw_mut()) } ++ } ++ ++ pub fn get_device_name<'a>(&'a self) -> Result<&'a CStr> { ++ let r = unsafe { ffi::pa_stream_get_device_name(self.raw_mut()) }; ++ if r.is_null() { ++ let err = if let Some(c) = self.get_context() { ++ c.errno() ++ } else { ++ ffi::PA_ERR_UNKNOWN ++ }; ++ return Err(ErrorCode::from_error_code(err)); ++ } ++ Ok(unsafe { CStr::from_ptr(r) }) ++ } ++ ++ pub fn is_suspended(&self) -> Result { ++ let r = unsafe { ffi::pa_stream_is_suspended(self.raw_mut()) }; ++ error_result!(r != 0, r) ++ } ++ ++ pub fn is_corked(&self) -> Result { ++ let r = unsafe { ffi::pa_stream_is_corked(self.raw_mut()) }; ++ error_result!(r != 0, r) ++ } ++ ++ pub fn connect_playback<'a, D, A, V, S>(&self, ++ dev: D, ++ attr: A, ++ flags: StreamFlags, ++ volume: V, ++ sync_stream: S) ++ -> Result<()> ++ where D: Into>, ++ A: Into>, ++ V: Into>, ++ S: Into> ++ { ++ let r = unsafe { ++ ffi::pa_stream_connect_playback(self.raw_mut(), ++ str_to_ptr(dev.into()), ++ to_ptr(attr.into()), ++ flags.into(), ++ to_ptr(volume.into()), ++ map_to_mut_ptr(sync_stream.into(), |p| p.0)) ++ }; ++ error_result!((), r) ++ } ++ ++ pub fn connect_record<'a, D, A>(&self, dev: D, attr: A, flags: StreamFlags) -> Result<()> ++ where D: Into>, ++ A: Into> ++ { ++ let r = unsafe { ++ ffi::pa_stream_connect_record(self.raw_mut(), ++ str_to_ptr(dev.into()), ++ to_ptr(attr.into()), ++ flags.into()) ++ }; ++ error_result!((), r) ++ } ++ ++ pub fn disconnect(&self) -> Result<()> { ++ let r = unsafe { ffi::pa_stream_disconnect(self.raw_mut()) }; ++ error_result!((), r) ++ } ++ ++ pub fn begin_write(&self, req_bytes: usize) -> Result<(*mut c_void, usize)> { ++ let mut data: *mut c_void = ptr::null_mut(); ++ let mut nbytes = req_bytes; ++ let r = unsafe { ffi::pa_stream_begin_write(self.raw_mut(), &mut data, &mut nbytes) }; ++ error_result!((data, nbytes), r) ++ } ++ ++ pub fn cancel_write(&self) -> Result<()> { ++ let r = unsafe { ffi::pa_stream_cancel_write(self.raw_mut()) }; ++ error_result!((), r) ++ } ++ ++ pub fn write(&self, data: *const c_void, nbytes: usize, offset: i64, seek: SeekMode) -> Result<()> { ++ let r = unsafe { ffi::pa_stream_write(self.raw_mut(), data, nbytes, None, offset, seek.into()) }; ++ error_result!((), r) ++ } ++ ++ pub unsafe fn peek(&self, data: *mut *const c_void, length: *mut usize) -> Result<()> { ++ let r = ffi::pa_stream_peek(self.raw_mut(), data, length); ++ error_result!((), r) ++ } ++ ++ pub fn drop(&self) -> Result<()> { ++ let r = unsafe { ffi::pa_stream_drop(self.raw_mut()) }; ++ error_result!((), r) ++ } ++ ++ pub fn writable_size(&self) -> Result { ++ let r = unsafe { ffi::pa_stream_writable_size(self.raw_mut()) }; ++ if r == ::std::usize::MAX { ++ let err = if let Some(c) = self.get_context() { ++ c.errno() ++ } else { ++ ffi::PA_ERR_UNKNOWN ++ }; ++ return Err(ErrorCode::from_error_code(err)); ++ } ++ Ok(r) ++ } ++ ++ pub fn readable_size(&self) -> Result { ++ let r = unsafe { ffi::pa_stream_readable_size(self.raw_mut()) }; ++ if r == ::std::usize::MAX { ++ let err = if let Some(c) = self.get_context() { ++ c.errno() ++ } else { ++ ffi::PA_ERR_UNKNOWN ++ }; ++ return Err(ErrorCode::from_error_code(err)); ++ } ++ Ok(r) ++ } ++ ++ pub fn update_timing_info(&self, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Stream, i32, *mut c_void) ++ { ++ debug_assert_eq!(mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(s: *mut ffi::pa_stream, success: c_int, userdata: *mut c_void) ++ where F: Fn(&Stream, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let mut stm = stream::from_raw_ptr(s); ++ let result = uninitialized::()(&mut stm, success, userdata); ++ forget(stm); ++ ++ result ++ } ++ ++ let r = unsafe { ffi::pa_stream_update_timing_info(self.raw_mut(), Some(wrapped::), userdata) }; ++ if r.is_null() { ++ let err = if let Some(c) = self.get_context() { ++ c.errno() ++ } else { ++ ffi::PA_ERR_UNKNOWN ++ }; ++ return Err(ErrorCode::from_error_code(err)); ++ } ++ Ok(unsafe { operation::from_raw_ptr(r) }) ++ } ++ ++ pub fn clear_state_callback(&self) { ++ unsafe { ++ ffi::pa_stream_set_state_callback(self.raw_mut(), None, ptr::null_mut()); ++ } ++ } ++ ++ pub fn set_state_callback(&self, _: CB, userdata: *mut c_void) ++ where CB: Fn(&Stream, *mut c_void) ++ { ++ debug_assert_eq!(mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(s: *mut ffi::pa_stream, userdata: *mut c_void) ++ where F: Fn(&Stream, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let mut stm = stream::from_raw_ptr(s); ++ let result = uninitialized::()(&mut stm, userdata); ++ forget(stm); ++ ++ result ++ } ++ ++ unsafe { ++ ffi::pa_stream_set_state_callback(self.raw_mut(), Some(wrapped::), userdata); ++ } ++ } ++ ++ pub fn clear_write_callback(&self) { ++ unsafe { ++ ffi::pa_stream_set_write_callback(self.raw_mut(), None, ptr::null_mut()); ++ } ++ } ++ ++ pub fn set_write_callback(&self, _: CB, userdata: *mut c_void) ++ where CB: Fn(&Stream, usize, *mut c_void) ++ { ++ debug_assert_eq!(mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(s: *mut ffi::pa_stream, nbytes: usize, userdata: *mut c_void) ++ where F: Fn(&Stream, usize, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let mut stm = stream::from_raw_ptr(s); ++ let result = uninitialized::()(&mut stm, nbytes, userdata); ++ forget(stm); ++ ++ result ++ } ++ ++ unsafe { ++ ffi::pa_stream_set_write_callback(self.raw_mut(), Some(wrapped::), userdata); ++ } ++ } ++ ++ pub fn clear_read_callback(&self) { ++ unsafe { ++ ffi::pa_stream_set_read_callback(self.raw_mut(), None, ptr::null_mut()); ++ } ++ } ++ ++ pub fn set_read_callback(&self, _: CB, userdata: *mut c_void) ++ where CB: Fn(&Stream, usize, *mut c_void) ++ { ++ debug_assert_eq!(mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(s: *mut ffi::pa_stream, nbytes: usize, userdata: *mut c_void) ++ where F: Fn(&Stream, usize, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let mut stm = stream::from_raw_ptr(s); ++ let result = uninitialized::()(&mut stm, nbytes, userdata); ++ forget(stm); ++ ++ result ++ } ++ ++ unsafe { ++ ffi::pa_stream_set_read_callback(self.raw_mut(), Some(wrapped::), userdata); ++ } ++ } ++ ++ pub fn cork(&self, b: i32, _: CB, userdata: *mut c_void) -> Result ++ where CB: Fn(&Stream, i32, *mut c_void) ++ { ++ debug_assert_eq!(mem::size_of::(), 0); ++ ++ // See: A note about `wrapped` functions ++ unsafe extern "C" fn wrapped(s: *mut ffi::pa_stream, success: c_int, userdata: *mut c_void) ++ where F: Fn(&Stream, i32, *mut c_void) ++ { ++ use std::mem::{forget, uninitialized}; ++ let mut stm = stream::from_raw_ptr(s); ++ let result = uninitialized::()(&mut stm, success, userdata); ++ forget(stm); ++ ++ result ++ } ++ ++ let r = unsafe { ffi::pa_stream_cork(self.raw_mut(), b, Some(wrapped::), userdata) }; ++ if r.is_null() { ++ let err = if let Some(c) = self.get_context() { ++ c.errno() ++ } else { ++ ffi::PA_ERR_UNKNOWN ++ }; ++ return Err(ErrorCode::from_error_code(err)); ++ } ++ Ok(unsafe { operation::from_raw_ptr(r) }) ++ } ++ ++ pub fn get_time(&self) -> Result<(u64)> { ++ let mut usec: u64 = 0; ++ let r = unsafe { ffi::pa_stream_get_time(self.raw_mut(), &mut usec) }; ++ error_result!(usec, r) ++ } ++ ++ pub fn get_latency(&self) -> Result<(u64, bool)> { ++ let mut usec: u64 = 0; ++ let mut negative: i32 = 0; ++ let r = unsafe { ffi::pa_stream_get_latency(self.raw_mut(), &mut usec, &mut negative) }; ++ error_result!((usec, negative != 0), r) ++ } ++ ++ pub fn get_sample_spec(&self) -> &SampleSpec { ++ unsafe { ++ let ptr = ffi::pa_stream_get_sample_spec(self.raw_mut()); ++ debug_assert!(!ptr.is_null()); ++ &*ptr ++ } ++ } ++ ++ pub fn get_channel_map(&self) -> &ChannelMap { ++ unsafe { ++ let ptr = ffi::pa_stream_get_channel_map(self.raw_mut()); ++ debug_assert!(!ptr.is_null()); ++ &*ptr ++ } ++ } ++ ++ pub fn get_buffer_attr(&self) -> &BufferAttr { ++ unsafe { ++ let ptr = ffi::pa_stream_get_buffer_attr(self.raw_mut()); ++ debug_assert!(!ptr.is_null()); ++ &*ptr ++ } ++ } ++} ++ ++#[doc(hidden)] ++pub unsafe fn from_raw_ptr(ptr: *mut ffi::pa_stream) -> Stream { ++ Stream(ptr) ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/threaded_mainloop.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/threaded_mainloop.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/threaded_mainloop.rs.cubeb-pulse-arm 2017-08-04 13:37:46.386821731 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/threaded_mainloop.rs 2017-08-04 13:37:46.386821731 +0200 +@@ -0,0 +1,92 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use ErrorCode; ++use Result; ++use ffi; ++use mainloop_api; ++use mainloop_api::MainloopApi; ++ ++#[derive(Debug)] ++pub struct ThreadedMainloop(*mut ffi::pa_threaded_mainloop); ++ ++impl ThreadedMainloop { ++ pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_threaded_mainloop) -> Self { ++ ThreadedMainloop(raw) ++ } ++ ++ pub fn new() -> Self { ++ unsafe { ThreadedMainloop::from_raw_ptr(ffi::pa_threaded_mainloop_new()) } ++ } ++ ++ pub fn raw_mut(&self) -> &mut ffi::pa_threaded_mainloop { ++ unsafe { &mut *self.0 } ++ } ++ ++ pub fn is_null(&self) -> bool { ++ self.0.is_null() ++ } ++ ++ pub fn start(&self) -> Result<()> { ++ match unsafe { ffi::pa_threaded_mainloop_start(self.raw_mut()) } { ++ 0 => Ok(()), ++ _ => Err(ErrorCode::from_error_code(ffi::PA_ERR_UNKNOWN)), ++ } ++ } ++ ++ pub fn stop(&self) { ++ unsafe { ++ ffi::pa_threaded_mainloop_stop(self.raw_mut()); ++ } ++ } ++ ++ pub fn lock(&self) { ++ unsafe { ++ ffi::pa_threaded_mainloop_lock(self.raw_mut()); ++ } ++ } ++ ++ pub fn unlock(&self) { ++ unsafe { ++ ffi::pa_threaded_mainloop_unlock(self.raw_mut()); ++ } ++ } ++ ++ pub fn wait(&self) { ++ unsafe { ++ ffi::pa_threaded_mainloop_wait(self.raw_mut()); ++ } ++ } ++ ++ pub fn signal(&self) { ++ unsafe { ++ ffi::pa_threaded_mainloop_signal(self.raw_mut(), 0); ++ } ++ } ++ ++ pub fn get_api(&self) -> MainloopApi { ++ unsafe { mainloop_api::from_raw_ptr(ffi::pa_threaded_mainloop_get_api(self.raw_mut())) } ++ } ++ ++ pub fn in_thread(&self) -> bool { ++ unsafe { ffi::pa_threaded_mainloop_in_thread(self.raw_mut()) != 0 } ++ } ++} ++ ++impl ::std::default::Default for ThreadedMainloop { ++ fn default() -> Self { ++ ThreadedMainloop(::std::ptr::null_mut()) ++ } ++} ++ ++impl ::std::ops::Drop for ThreadedMainloop { ++ fn drop(&mut self) { ++ if !self.is_null() { ++ unsafe { ++ ffi::pa_threaded_mainloop_free(self.raw_mut()); ++ } ++ } ++ } ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/util.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/util.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/util.rs.cubeb-pulse-arm 2017-08-04 13:37:46.386821731 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/pulse-rs/src/util.rs 2017-08-04 13:37:46.386821731 +0200 +@@ -0,0 +1,41 @@ ++// Copyright © 2017 Mozilla Foundation ++// ++// This program is made available under an ISC-style license. See the ++// accompanying file LICENSE for details. ++ ++use std::ffi::CStr; ++use std::os::raw::c_char; ++use std::ptr; ++ ++pub trait UnwrapCStr { ++ fn unwrap_cstr(self) -> *const c_char; ++} ++ ++impl<'a, U> UnwrapCStr for U ++ where U: Into> ++{ ++ fn unwrap_cstr(self) -> *const c_char { ++ self.into().map(|o| o.as_ptr()).unwrap_or(0 as *const _) ++ } ++} ++ ++pub fn map_to_mut_ptr *mut U>(t: Option<&mut T>, f: F) -> *mut U { ++ match t { ++ Some(x) => f(x), ++ None => ptr::null_mut(), ++ } ++} ++ ++pub fn str_to_ptr(s: Option<&CStr>) -> *const c_char { ++ match s { ++ Some(x) => x.as_ptr(), ++ None => ptr::null(), ++ } ++} ++ ++pub fn to_ptr(t: Option<&T>) -> *const T { ++ match t { ++ Some(x) => x as *const T, ++ None => ptr::null(), ++ } ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/README.md.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/README.md +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/README.md.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/README.md 2017-08-04 13:37:46.383821740 +0200 +@@ -3,3 +3,4 @@ + Implementation of PulseAudio backend for Cubeb written in Rust. + + [![Travis Build Status](https://travis-ci.org/djg/cubeb-pulse-rs.svg?branch=master)](https://travis-ci.org/djg/cubeb-pulse-rs) ++[![Travis Build Status](https://travis-ci.org/djg/cubeb-pulse-rs.svg?branch=dev)](https://travis-ci.org/djg/cubeb-pulse-rs) +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/README_MOZILLA.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/README_MOZILLA +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/README_MOZILLA.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/README_MOZILLA 2017-08-04 13:37:46.383821740 +0200 +@@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla + + The cubeb-pulse-rs git repository is: https://github.com/djg/cubeb-pulse-rs.git + +-The git commit ID used was dbcd7f96aea8d249a4b78f9a7597768c9dff22eb (2017-04-25 11:42:10 +1000) ++The git commit ID used was 64515819cdf54a16626df5dce5f5c7cb1220d53b (2017-06-19 17:41:30 +1000) +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/context.rs 2017-08-04 13:50:38.145480458 +0200 +@@ -4,67 +4,60 @@ + // accompanying file LICENSE for details. + + use backend::*; +-use backend::cork_state::CorkState; + use capi::PULSE_OPS; + use cubeb; ++use pulse::{self, ProplistExt}; + use pulse_ffi::*; + use semver; + use std::default::Default; +-use std::ffi::CStr; ++use std::ffi::{CStr, CString}; + use std::mem; +-use std::os::raw::{c_char, c_int, c_void}; ++use std::os::raw::{c_char, c_void}; + use std::ptr; + +-macro_rules! dup_str { +- ($Dst: expr, $Src: expr) => { +- if !$Dst.is_null() { +- pa_xfree($Dst as *mut _); +- } +- +- $Dst = pa_xstrdup($Src); +- } +-} +- +-fn pa_channel_to_cubeb_channel(channel: pa_channel_position_t) -> cubeb::Channel { +- assert_ne!(channel, PA_CHANNEL_POSITION_INVALID); ++fn pa_channel_to_cubeb_channel(channel: pulse::ChannelPosition) -> cubeb::Channel { ++ use pulse::ChannelPosition; ++ assert_ne!(channel, ChannelPosition::Invalid); + match channel { +- PA_CHANNEL_POSITION_MONO => cubeb::CHANNEL_MONO, +- PA_CHANNEL_POSITION_FRONT_LEFT => cubeb::CHANNEL_LEFT, +- PA_CHANNEL_POSITION_FRONT_RIGHT => cubeb::CHANNEL_RIGHT, +- PA_CHANNEL_POSITION_FRONT_CENTER => cubeb::CHANNEL_CENTER, +- PA_CHANNEL_POSITION_SIDE_LEFT => cubeb::CHANNEL_LS, +- PA_CHANNEL_POSITION_SIDE_RIGHT => cubeb::CHANNEL_RS, +- PA_CHANNEL_POSITION_REAR_LEFT => cubeb::CHANNEL_RLS, +- PA_CHANNEL_POSITION_REAR_CENTER => cubeb::CHANNEL_RCENTER, +- PA_CHANNEL_POSITION_REAR_RIGHT => cubeb::CHANNEL_RRS, +- PA_CHANNEL_POSITION_LFE => cubeb::CHANNEL_LFE, ++ ChannelPosition::Mono => cubeb::CHANNEL_MONO, ++ ChannelPosition::FrontLeft => cubeb::CHANNEL_LEFT, ++ ChannelPosition::FrontRight => cubeb::CHANNEL_RIGHT, ++ ChannelPosition::FrontCenter => cubeb::CHANNEL_CENTER, ++ ChannelPosition::SideLeft => cubeb::CHANNEL_LS, ++ ChannelPosition::SideRight => cubeb::CHANNEL_RS, ++ ChannelPosition::RearLeft => cubeb::CHANNEL_RLS, ++ ChannelPosition::RearCenter => cubeb::CHANNEL_RCENTER, ++ ChannelPosition::RearRight => cubeb::CHANNEL_RRS, ++ ChannelPosition::LowFreqEffects => cubeb::CHANNEL_LFE, + _ => cubeb::CHANNEL_INVALID, + } + } + +-fn channel_map_to_layout(cm: &pa_channel_map) -> cubeb::ChannelLayout { ++fn channel_map_to_layout(cm: &pulse::ChannelMap) -> cubeb::ChannelLayout { ++ use pulse::ChannelPosition; + let mut cubeb_map: cubeb::ChannelMap = Default::default(); + cubeb_map.channels = cm.channels as u32; + for i in 0usize..cm.channels as usize { +- cubeb_map.map[i] = pa_channel_to_cubeb_channel(cm.map[i]); ++ cubeb_map.map[i] = pa_channel_to_cubeb_channel(ChannelPosition::try_from(cm.map[i]) ++ .unwrap_or(ChannelPosition::Invalid)); + } + unsafe { cubeb::cubeb_channel_map_to_layout(&cubeb_map) } + } + + #[derive(Debug)] + pub struct DefaultInfo { +- pub sample_spec: pa_sample_spec, +- pub channel_map: pa_channel_map, +- pub flags: pa_sink_flags_t, ++ pub sample_spec: pulse::SampleSpec, ++ pub channel_map: pulse::ChannelMap, ++ pub flags: pulse::SinkFlags, + } + + #[derive(Debug)] + pub struct Context { + pub ops: *const cubeb::Ops, +- pub mainloop: *mut pa_threaded_mainloop, +- pub context: *mut pa_context, ++ pub mainloop: pulse::ThreadedMainloop, ++ pub context: Option, + pub default_sink_info: Option, +- pub context_name: *const c_char, ++ pub context_name: Option, + pub collection_changed_callback: cubeb::DeviceCollectionChangedCallback, + pub collection_changed_user_ptr: *mut c_void, + pub error: bool, +@@ -82,7 +75,7 @@ impl Drop for Context { + + impl Context { + #[cfg(feature = "pulse-dlopen")] +- fn _new(name: *const i8) -> Result> { ++ fn _new(name: Option) -> Result> { + let libpulse = unsafe { open() }; + if libpulse.is_none() { + return Err(cubeb::ERROR); +@@ -91,12 +84,12 @@ impl Context { + let ctx = Box::new(Context { + ops: &PULSE_OPS, + libpulse: libpulse.unwrap(), +- mainloop: unsafe { pa_threaded_mainloop_new() }, +- context: 0 as *mut _, ++ mainloop: pulse::ThreadedMainloop::new(), ++ context: None, + default_sink_info: None, + context_name: name, + collection_changed_callback: None, +- collection_changed_user_ptr: 0 as *mut _, ++ collection_changed_user_ptr: ptr::null_mut(), + error: true, + version_0_9_8: false, + version_2_0_0: false, +@@ -106,15 +99,15 @@ impl Context { + } + + #[cfg(not(feature = "pulse-dlopen"))] +- fn _new(name: *const i8) -> Result> { ++ fn _new(name: Option) -> Result> { + Ok(Box::new(Context { + ops: &PULSE_OPS, +- mainloop: unsafe { pa_threaded_mainloop_new() }, +- context: 0 as *mut _, ++ mainloop: pulse::ThreadedMainloop::new(), ++ context: None, + default_sink_info: None, + context_name: name, + collection_changed_callback: None, +- collection_changed_user_ptr: 0 as *mut _, ++ collection_changed_user_ptr: ptr::null_mut(), + error: true, + version_0_9_8: false, + version_2_0_0: false, +@@ -122,53 +115,66 @@ impl Context { + } + + pub fn new(name: *const c_char) -> Result> { ++ fn server_info_cb(context: &pulse::Context, info: &pulse::ServerInfo, u: *mut c_void) { ++ fn sink_info_cb(_: &pulse::Context, i: *const pulse::SinkInfo, eol: i32, u: *mut c_void) { ++ let mut ctx = unsafe { &mut *(u as *mut Context) }; ++ if eol == 0 { ++ let info = unsafe { &*i }; ++ let flags = pulse::SinkFlags::try_from(info.flags).expect("SinkInfo contains invalid flags"); ++ ctx.default_sink_info = Some(DefaultInfo { ++ sample_spec: info.sample_spec, ++ channel_map: info.channel_map, ++ flags: flags, ++ }); ++ } ++ ctx.mainloop.signal(); ++ } ++ ++ let _ = context.get_sink_info_by_name(unsafe { CStr::from_ptr(info.default_sink_name) }, ++ sink_info_cb, ++ u); ++ } ++ ++ let name = super::try_cstr_from(name).map(|s| s.to_owned()); + let mut ctx = try!(Context::_new(name)); + +- unsafe { pa_threaded_mainloop_start(ctx.mainloop) }; ++ if ctx.mainloop.start().is_err() { ++ ctx.destroy(); ++ return Err(cubeb::ERROR); ++ } + +- if ctx.pulse_context_init() != cubeb::OK { ++ if ctx.context_init() != cubeb::OK { + ctx.destroy(); + return Err(cubeb::ERROR); + } + +- unsafe { +- /* server_info_callback performs a second async query, +- * which is responsible for initializing default_sink_info +- * and signalling the mainloop to end the wait. */ +- pa_threaded_mainloop_lock(ctx.mainloop); +- let o = pa_context_get_server_info(ctx.context, +- Some(server_info_callback), +- ctx.as_mut() as *mut Context as *mut _); +- if !o.is_null() { +- ctx.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); ++ ctx.mainloop.lock(); ++ /* server_info_callback performs a second async query, ++ * which is responsible for initializing default_sink_info ++ * and signalling the mainloop to end the wait. */ ++ let user_data: *mut c_void = ctx.as_mut() as *mut _ as *mut _; ++ if let Some(ref context) = ctx.context { ++ if let Ok(o) = context.get_server_info(server_info_cb, user_data) { ++ ctx.operation_wait(None, &o); + } +- pa_threaded_mainloop_unlock(ctx.mainloop); +- assert!(ctx.default_sink_info.is_some()); + } ++ assert!(ctx.default_sink_info.is_some()); ++ ctx.mainloop.unlock(); + + // Return the result. + Ok(ctx) + } + + pub fn destroy(&mut self) { +- if !self.context.is_null() { +- unsafe { self.pulse_context_destroy() }; +- } +- assert!(self.context.is_null()); ++ self.context_destroy(); + + if !self.mainloop.is_null() { +- unsafe { +- pa_threaded_mainloop_stop(self.mainloop); +- pa_threaded_mainloop_free(self.mainloop); +- self.mainloop = ptr::null_mut(); +- } ++ self.mainloop.stop(); + } +- assert!(self.mainloop.is_null()); + } + + pub fn new_stream(&mut self, +- stream_name: *const c_char, ++ stream_name: &CStr, + input_device: cubeb::DeviceId, + input_stream_params: Option, + output_device: cubeb::DeviceId, +@@ -178,7 +184,7 @@ impl Context { + state_callback: cubeb::StateCallback, + user_ptr: *mut c_void) + -> Result> { +- if self.error && self.pulse_context_init() != 0 { ++ if self.error && self.context_init() != 0 { + return Err(cubeb::ERROR); + } + +@@ -221,41 +227,151 @@ impl Context { + } + + pub fn enumerate_devices(&self, devtype: cubeb::DeviceType) -> Result { +- let mut user_data: PulseDevListData = Default::default(); +- user_data.context = self as *const _ as *mut _; ++ fn add_output_device(_: &pulse::Context, i: *const pulse::SinkInfo, eol: i32, user_data: *mut c_void) { ++ if eol != 0 { ++ return; ++ } + +- unsafe { +- pa_threaded_mainloop_lock(self.mainloop); ++ debug_assert!(!i.is_null()); ++ debug_assert!(!user_data.is_null()); ++ ++ let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) }; ++ let info = unsafe { &*i }; ++ ++ let group_id = match info.proplist().gets("sysfs.path") { ++ Some(p) => p.to_owned().into_raw(), ++ _ => ptr::null_mut(), ++ }; ++ ++ let vendor_name = match info.proplist().gets("device.vendor.name") { ++ Some(p) => p.to_owned().into_raw(), ++ _ => ptr::null_mut(), ++ }; ++ ++ let info_name = unsafe { CStr::from_ptr(info.name) }.to_owned(); ++ let info_description = unsafe { CStr::from_ptr(info.description) }.to_owned(); ++ ++ let preferred = if info_name == list_data.default_sink_name { ++ cubeb::DEVICE_PREF_ALL ++ } else { ++ cubeb::DevicePref::empty() ++ }; ++ ++ let ctx = &(*list_data.context); ++ ++ let device_id = info_name.into_raw(); ++ let friendly_name = info_description.into_raw(); ++ let devinfo = cubeb::DeviceInfo { ++ device_id: device_id, ++ devid: device_id as cubeb::DeviceId, ++ friendly_name: friendly_name, ++ group_id: group_id, ++ vendor_name: vendor_name, ++ devtype: cubeb::DEVICE_TYPE_OUTPUT, ++ state: ctx.state_from_port(info.active_port), ++ preferred: preferred, ++ format: cubeb::DeviceFmt::all(), ++ default_format: pulse_format_to_cubeb_format(info.sample_spec.format), ++ max_channels: info.channel_map.channels as u32, ++ min_rate: 1, ++ max_rate: PA_RATE_MAX, ++ default_rate: info.sample_spec.rate, ++ latency_lo: 0, ++ latency_hi: 0, ++ }; ++ list_data.devinfo.push(devinfo); ++ ++ ctx.mainloop.signal(); ++ } ++ ++ fn add_input_device(_: &pulse::Context, i: *const pulse::SourceInfo, eol: i32, user_data: *mut c_void) { ++ if eol != 0 { ++ return; ++ } ++ ++ debug_assert!(!user_data.is_null()); ++ debug_assert!(!i.is_null()); ++ ++ let mut list_data = unsafe { &mut *(user_data as *mut PulseDevListData) }; ++ let info = unsafe { &*i }; ++ ++ let group_id = match info.proplist().gets("sysfs.path") { ++ Some(p) => p.to_owned().into_raw(), ++ _ => ptr::null_mut(), ++ }; ++ ++ let vendor_name = match info.proplist().gets("device.vendor.name") { ++ Some(p) => p.to_owned().into_raw(), ++ _ => ptr::null_mut(), ++ }; + +- let o = pa_context_get_server_info(self.context, +- Some(pulse_server_info_cb), +- &mut user_data as *mut _ as *mut _); +- if !o.is_null() { +- self.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); ++ let info_name = unsafe { CStr::from_ptr(info.name) }.to_owned(); ++ let info_description = unsafe { CStr::from_ptr(info.description) }.to_owned(); ++ ++ let preferred = if info_name == list_data.default_source_name { ++ cubeb::DEVICE_PREF_ALL ++ } else { ++ cubeb::DevicePref::empty() ++ }; ++ ++ let ctx = &(*list_data.context); ++ let device_id = info_name.into_raw(); ++ let friendly_name = info_description.into_raw(); ++ let devinfo = cubeb::DeviceInfo { ++ device_id: device_id, ++ devid: device_id as cubeb::DeviceId, ++ friendly_name: friendly_name, ++ group_id: group_id, ++ vendor_name: vendor_name, ++ devtype: cubeb::DEVICE_TYPE_INPUT, ++ state: ctx.state_from_port(info.active_port), ++ preferred: preferred, ++ format: cubeb::DeviceFmt::all(), ++ default_format: pulse_format_to_cubeb_format(info.sample_spec.format), ++ max_channels: info.channel_map.channels as u32, ++ min_rate: 1, ++ max_rate: PA_RATE_MAX, ++ default_rate: info.sample_spec.rate, ++ latency_lo: 0, ++ latency_hi: 0, ++ }; ++ ++ list_data.devinfo.push(devinfo); ++ ++ ctx.mainloop.signal(); ++ } ++ ++ fn default_device_names(_: &pulse::Context, info: &pulse::ServerInfo, user_data: *mut c_void) { ++ let list_data = unsafe { &mut *(user_data as *mut PulseDevListData) }; ++ ++ list_data.default_sink_name = unsafe { CStr::from_ptr(info.default_sink_name) }.to_owned(); ++ list_data.default_source_name = unsafe { CStr::from_ptr(info.default_source_name) }.to_owned(); ++ ++ (*list_data.context).mainloop.signal(); ++ } ++ ++ let mut user_data = PulseDevListData::new(self); ++ ++ if let Some(ref context) = self.context { ++ self.mainloop.lock(); ++ ++ if let Ok(o) = context.get_server_info(default_device_names, &mut user_data as *mut _ as *mut _) { ++ self.operation_wait(None, &o); + } + + if devtype == cubeb::DEVICE_TYPE_OUTPUT { +- let o = pa_context_get_sink_info_list(self.context, +- Some(pulse_sink_info_cb), +- &mut user_data as *mut _ as *mut _); +- if !o.is_null() { +- self.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); ++ if let Ok(o) = context.get_sink_info_list(add_output_device, &mut user_data as *mut _ as *mut _) { ++ self.operation_wait(None, &o); + } + } + + if devtype == cubeb::DEVICE_TYPE_INPUT { +- let o = pa_context_get_source_info_list(self.context, +- Some(pulse_source_info_cb), +- &mut user_data as *mut _ as *mut _); +- if !o.is_null() { +- self.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); ++ if let Ok(o) = context.get_source_info_list(add_input_device, &mut user_data as *mut _ as *mut _) { ++ self.operation_wait(None, &o); + } + } + +- pa_threaded_mainloop_unlock(self.mainloop); ++ self.mainloop.unlock(); + } + + // Extract the array of cubeb_device_info from +@@ -282,16 +398,16 @@ impl Context { + coll.count); + for dev in devices.iter_mut() { + if !dev.device_id.is_null() { +- pa_xfree(dev.device_id as *mut _); ++ let _ = CString::from_raw(dev.device_id as *mut _); + } + if !dev.group_id.is_null() { +- pa_xfree(dev.group_id as *mut _); ++ let _ = CString::from_raw(dev.group_id as *mut _); + } + if !dev.vendor_name.is_null() { +- pa_xfree(dev.vendor_name as *mut _); ++ let _ = CString::from_raw(dev.vendor_name as *mut _); + } + if !dev.friendly_name.is_null() { +- pa_xfree(dev.friendly_name as *mut _); ++ let _ = CString::from_raw(dev.friendly_name as *mut _); + } + } + } +@@ -302,115 +418,125 @@ impl Context { + cb: cubeb::DeviceCollectionChangedCallback, + user_ptr: *mut c_void) + -> i32 { +- unsafe extern "C" fn subscribe_success(_: *mut pa_context, success: i32, user_data: *mut c_void) { +- let ctx = &*(user_data as *mut Context); ++ fn update_collection(_: &pulse::Context, event: pulse::SubscriptionEvent, index: u32, user_data: *mut c_void) { ++ let mut ctx = unsafe { &mut *(user_data as *mut Context) }; ++ ++ let (f, t) = (event.event_facility(), event.event_type()); ++ match f { ++ pulse::SubscriptionEventFacility::Source | ++ pulse::SubscriptionEventFacility::Sink => { ++ match t { ++ pulse::SubscriptionEventType::Remove | ++ pulse::SubscriptionEventType::New => { ++ if cubeb::log_enabled() { ++ let op = if t == pulse::SubscriptionEventType::New { ++ "Adding" ++ } else { ++ "Removing" ++ }; ++ let dev = if f == pulse::SubscriptionEventFacility::Sink { ++ "sink" ++ } else { ++ "source " ++ }; ++ log!("{} {} index {}", op, dev, index); ++ ++ unsafe { ++ ctx.collection_changed_callback.unwrap()(ctx as *mut _ as *mut _, ++ ctx.collection_changed_user_ptr); ++ } ++ } ++ }, ++ _ => {}, ++ } ++ }, ++ _ => {}, ++ } ++ } ++ ++ fn success(_: &pulse::Context, success: i32, user_data: *mut c_void) { ++ let ctx = unsafe { &*(user_data as *mut Context) }; + debug_assert_ne!(success, 0); +- pa_threaded_mainloop_signal(ctx.mainloop, 0); ++ ctx.mainloop.signal(); + } + + self.collection_changed_callback = cb; + self.collection_changed_user_ptr = user_ptr; + +- unsafe { +- pa_threaded_mainloop_lock(self.mainloop); ++ let user_data: *mut c_void = self as *mut _ as *mut _; ++ if let Some(ref context) = self.context { ++ self.mainloop.lock(); + +- let mut mask: pa_subscription_mask_t = PA_SUBSCRIPTION_MASK_NULL; ++ let mut mask = pulse::SubscriptionMask::empty(); + if self.collection_changed_callback.is_none() { + // Unregister subscription +- pa_context_set_subscribe_callback(self.context, None, ptr::null_mut()); ++ context.clear_subscribe_callback(); + } else { +- pa_context_set_subscribe_callback(self.context, +- Some(pulse_subscribe_callback), +- self as *mut _ as *mut _); +- if devtype == cubeb::DEVICE_TYPE_INPUT { +- mask |= PA_SUBSCRIPTION_MASK_SOURCE ++ context.set_subscribe_callback(update_collection, user_data); ++ if devtype.contains(cubeb::DEVICE_TYPE_INPUT) { ++ mask |= pulse::SUBSCRIPTION_MASK_SOURCE + }; +- if devtype == cubeb::DEVICE_TYPE_OUTPUT { +- mask |= PA_SUBSCRIPTION_MASK_SOURCE ++ if devtype.contains(cubeb::DEVICE_TYPE_OUTPUT) { ++ mask = pulse::SUBSCRIPTION_MASK_SINK + }; + } + +- let o = pa_context_subscribe(self.context, +- mask, +- Some(subscribe_success), +- self as *const _ as *mut _); +- if o.is_null() { ++ if let Ok(o) = context.subscribe(mask, success, self as *const _ as *mut _) { ++ self.operation_wait(None, &o); ++ } else { + log!("Context subscribe failed"); + return cubeb::ERROR; + } +- self.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); + +- pa_threaded_mainloop_unlock(self.mainloop); ++ self.mainloop.unlock(); + } + + cubeb::OK + } + +- // +- +- pub fn pulse_stream_cork(&self, stream: *mut pa_stream, state: CorkState) { +- unsafe extern "C" fn cork_success(_: *mut pa_stream, _: i32, u: *mut c_void) { +- let mainloop = u as *mut pa_threaded_mainloop; +- pa_threaded_mainloop_signal(mainloop, 0); ++ pub fn context_init(&mut self) -> i32 { ++ fn error_state(c: &pulse::Context, u: *mut c_void) { ++ let mut ctx = unsafe { &mut *(u as *mut Context) }; ++ if !c.get_state().is_good() { ++ ctx.error = true; ++ } ++ ctx.mainloop.signal(); + } + +- if stream.is_null() { +- return; ++ if self.context.is_some() { ++ debug_assert!(self.error); ++ self.context_destroy(); + } + +- let o = unsafe { +- pa_stream_cork(stream, +- state.is_cork() as i32, +- Some(cork_success), +- self.mainloop as *mut _) ++ self.context = { ++ let name = match self.context_name.as_ref() { ++ Some(s) => Some(s.as_ref()), ++ None => None, ++ }; ++ pulse::Context::new(&self.mainloop.get_api(), name) + }; + +- if !o.is_null() { +- self.operation_wait(stream, o); +- unsafe { pa_operation_unref(o) }; ++ let context_ptr: *mut c_void = self as *mut _ as *mut _; ++ if self.context.is_none() { ++ return cubeb::ERROR; + } +- } + +- pub fn pulse_context_init(&mut self) -> i32 { +- unsafe extern "C" fn error_state(c: *mut pa_context, u: *mut c_void) { +- let mut ctx = &mut *(u as *mut Context); +- if !PA_CONTEXT_IS_GOOD(pa_context_get_state(c)) { +- ctx.error = true; +- } +- pa_threaded_mainloop_signal(ctx.mainloop, 0); ++ self.mainloop.lock(); ++ if let Some(ref context) = self.context { ++ context.set_state_callback(error_state, context_ptr); ++ let _ = context.connect(None, pulse::ContextFlags::empty(), ptr::null()); + } + +- if !self.context.is_null() { +- debug_assert!(self.error); +- unsafe { self.pulse_context_destroy() }; ++ if !self.wait_until_context_ready() { ++ self.mainloop.unlock(); ++ self.context_destroy(); ++ return cubeb::ERROR; + } + +- unsafe { +- self.context = pa_context_new(pa_threaded_mainloop_get_api(self.mainloop), +- self.context_name); +- +- if self.context.is_null() { +- return cubeb::ERROR; +- } +- +- pa_context_set_state_callback(self.context, Some(error_state), self as *mut _ as *mut _); +- +- pa_threaded_mainloop_lock(self.mainloop); +- pa_context_connect(self.context, ptr::null(), 0, ptr::null()); +- +- if !self.wait_until_context_ready() { +- pa_threaded_mainloop_unlock(self.mainloop); +- self.pulse_context_destroy(); +- assert!(self.context.is_null()); +- return cubeb::ERROR; +- } ++ self.mainloop.unlock(); + +- pa_threaded_mainloop_unlock(self.mainloop); +- } +- +- let version_str = unsafe { CStr::from_ptr(pa_get_library_version()) }; +- if let Ok(version) = semver::Version::parse(version_str.to_string_lossy().as_ref()) { ++ let version_str = unsafe { CStr::from_ptr(pulse::library_version()) }; ++ if let Ok(version) = semver::Version::parse(&version_str.to_string_lossy()) { + self.version_0_9_8 = version >= semver::Version::parse("0.9.8").expect("Failed to parse version"); + self.version_2_0_0 = version >= semver::Version::parse("2.0.0").expect("Failed to parse version"); + } +@@ -420,34 +546,42 @@ impl Context { + cubeb::OK + } + +- unsafe fn pulse_context_destroy(&mut self) { +- unsafe extern "C" fn drain_complete(_c: *mut pa_context, u: *mut c_void) { +- let mainloop = u as *mut pa_threaded_mainloop; +- pa_threaded_mainloop_signal(mainloop, 0); +- } +- +- pa_threaded_mainloop_lock(self.mainloop); +- let o = pa_context_drain(self.context, Some(drain_complete), self.mainloop as *mut _); +- if !o.is_null() { +- self.operation_wait(ptr::null_mut(), o); +- pa_operation_unref(o); +- } +- pa_context_set_state_callback(self.context, None, ptr::null_mut()); +- pa_context_disconnect(self.context); +- pa_context_unref(self.context); +- self.context = ptr::null_mut(); +- pa_threaded_mainloop_unlock(self.mainloop); ++ fn context_destroy(&mut self) { ++ fn drain_complete(_: &pulse::Context, u: *mut c_void) { ++ let ctx = unsafe { &*(u as *mut Context) }; ++ ctx.mainloop.signal(); ++ } ++ ++ let context_ptr: *mut c_void = self as *mut _ as *mut _; ++ match self.context.take() { ++ Some(ctx) => { ++ self.mainloop.lock(); ++ if let Ok(o) = ctx.drain(drain_complete, context_ptr) { ++ self.operation_wait(None, &o); ++ } ++ ctx.clear_state_callback(); ++ ctx.disconnect(); ++ ctx.unref(); ++ self.mainloop.unlock(); ++ }, ++ _ => {}, ++ } + } + +- pub fn operation_wait(&self, stream: *mut pa_stream, o: *mut pa_operation) -> bool { +- unsafe { +- while pa_operation_get_state(o) == PA_OPERATION_RUNNING { +- pa_threaded_mainloop_wait(self.mainloop); +- if !PA_CONTEXT_IS_GOOD(pa_context_get_state(self.context)) { ++ pub fn operation_wait<'a, S>(&self, s: S, o: &pulse::Operation) -> bool ++ where S: Into> ++ { ++ let stream = s.into(); ++ while o.get_state() == PA_OPERATION_RUNNING { ++ self.mainloop.wait(); ++ if let Some(ref context) = self.context { ++ if !context.get_state().is_good() { + return false; + } ++ } + +- if !stream.is_null() && !PA_STREAM_IS_GOOD(pa_stream_get_state(stream)) { ++ if let Some(stm) = stream { ++ if !stm.get_state().is_good() { + return false; + } + } +@@ -457,36 +591,23 @@ impl Context { + } + + pub fn wait_until_context_ready(&self) -> bool { +- loop { +- let state = unsafe { pa_context_get_state(self.context) }; +- if !PA_CONTEXT_IS_GOOD(state) { +- return false; +- } +- if state == PA_CONTEXT_READY { +- break; +- } +- unsafe { +- pa_threaded_mainloop_wait(self.mainloop); ++ if let Some(ref context) = self.context { ++ loop { ++ let state = context.get_state(); ++ if !state.is_good() { ++ return false; ++ } ++ if state == pulse::ContextState::Ready { ++ break; ++ } ++ self.mainloop.wait(); + } + } + + true + } + +- fn state_from_sink_port(&self, i: *const pa_port_info) -> cubeb::DeviceState { +- if !i.is_null() { +- let info = unsafe { *i }; +- if self.version_2_0_0 && info.available == PA_PORT_AVAILABLE_NO { +- cubeb::DeviceState::Unplugged +- } else { +- cubeb::DeviceState::Enabled +- } +- } else { +- cubeb::DeviceState::Enabled +- } +- } +- +- fn state_from_source_port(&self, i: *mut pa_port_info) -> cubeb::DeviceState { ++ fn state_from_port(&self, i: *const pa_port_info) -> cubeb::DeviceState { + if !i.is_null() { + let info = unsafe { *i }; + if self.version_2_0_0 && info.available == PA_PORT_AVAILABLE_NO { +@@ -500,62 +621,30 @@ impl Context { + } + } + +-// Callbacks +-unsafe extern "C" fn server_info_callback(context: *mut pa_context, info: *const pa_server_info, u: *mut c_void) { +- unsafe extern "C" fn sink_info_callback(_context: *mut pa_context, +- info: *const pa_sink_info, +- eol: i32, +- u: *mut c_void) { +- let mut ctx = &mut *(u as *mut Context); +- if eol == 0 { +- let info = *info; +- ctx.default_sink_info = Some(DefaultInfo { +- sample_spec: info.sample_spec, +- channel_map: info.channel_map, +- flags: info.flags, +- }); +- } +- pa_threaded_mainloop_signal(ctx.mainloop, 0); +- } +- +- let o = pa_context_get_sink_info_by_name(context, +- (*info).default_sink_name, +- Some(sink_info_callback), +- u); +- if !o.is_null() { +- pa_operation_unref(o); +- } +-} +- +-struct PulseDevListData { +- default_sink_name: *mut c_char, +- default_source_name: *mut c_char, ++struct PulseDevListData<'a> { ++ default_sink_name: CString, ++ default_source_name: CString, + devinfo: Vec, +- context: *mut Context, ++ context: &'a Context, + } + +-impl Drop for PulseDevListData { +- fn drop(&mut self) { +- if !self.default_sink_name.is_null() { +- unsafe { +- pa_xfree(self.default_sink_name as *mut _); +- } +- } +- if !self.default_source_name.is_null() { +- unsafe { +- pa_xfree(self.default_source_name as *mut _); +- } ++impl<'a> PulseDevListData<'a> { ++ pub fn new<'b>(context: &'b Context) -> Self ++ where 'b: 'a ++ { ++ PulseDevListData { ++ default_sink_name: CString::default(), ++ default_source_name: CString::default(), ++ devinfo: Vec::new(), ++ context: context, + } + } + } + +-impl Default for PulseDevListData { +- fn default() -> Self { +- PulseDevListData { +- default_sink_name: ptr::null_mut(), +- default_source_name: ptr::null_mut(), +- devinfo: Vec::new(), +- context: ptr::null_mut(), ++impl<'a> Drop for PulseDevListData<'a> { ++ fn drop(&mut self) { ++ for elem in &mut self.devinfo { ++ let _ = unsafe { Box::from_raw(elem) }; + } + } + } +@@ -566,192 +655,7 @@ fn pulse_format_to_cubeb_format(format: + PA_SAMPLE_S16BE => cubeb::DEVICE_FMT_S16BE, + PA_SAMPLE_FLOAT32LE => cubeb::DEVICE_FMT_F32LE, + PA_SAMPLE_FLOAT32BE => cubeb::DEVICE_FMT_F32BE, +- _ => { +- panic!("Invalid format"); +- }, ++ // Unsupported format, return F32NE ++ _ => cubeb::CUBEB_FMT_F32NE, + } + } +- +-unsafe extern "C" fn pulse_sink_info_cb(_context: *mut pa_context, +- i: *const pa_sink_info, +- eol: i32, +- user_data: *mut c_void) { +- if eol != 0 || i.is_null() { +- return; +- } +- +- debug_assert!(!user_data.is_null()); +- +- let info = *i; +- let mut list_data = &mut *(user_data as *mut PulseDevListData); +- +- let device_id = pa_xstrdup(info.name); +- +- let group_id = { +- let prop = pa_proplist_gets(info.proplist, b"sysfs.path\0".as_ptr() as *const c_char); +- if !prop.is_null() { +- pa_xstrdup(prop) +- } else { +- ptr::null_mut() +- } +- }; +- +- let vendor_name = { +- let prop = pa_proplist_gets(info.proplist, +- b"device.vendor.name\0".as_ptr() as *const c_char); +- if !prop.is_null() { +- pa_xstrdup(prop) +- } else { +- ptr::null_mut() +- } +- }; +- +- let preferred = if strcmp(info.name, list_data.default_sink_name) == 0 { +- cubeb::DEVICE_PREF_ALL +- } else { +- cubeb::DevicePref::empty() +- }; +- +- let ctx = &(*list_data.context); +- +- let devinfo = cubeb::DeviceInfo { +- device_id: device_id, +- devid: device_id as cubeb::DeviceId, +- friendly_name: pa_xstrdup(info.description), +- group_id: group_id, +- vendor_name: vendor_name, +- devtype: cubeb::DEVICE_TYPE_OUTPUT, +- state: ctx.state_from_sink_port(info.active_port), +- preferred: preferred, +- format: cubeb::DeviceFmt::all(), +- default_format: pulse_format_to_cubeb_format(info.sample_spec.format), +- max_channels: info.channel_map.channels as u32, +- min_rate: 1, +- max_rate: PA_RATE_MAX, +- default_rate: info.sample_spec.rate, +- latency_lo: 0, +- latency_hi: 0, +- }; +- list_data.devinfo.push(devinfo); +- +- pa_threaded_mainloop_signal(ctx.mainloop, 0); +-} +- +-unsafe extern "C" fn pulse_source_info_cb(_context: *mut pa_context, +- i: *const pa_source_info, +- eol: i32, +- user_data: *mut c_void) { +- if eol != 0 || i.is_null() { +- return; +- } +- +- debug_assert!(!user_data.is_null()); +- +- let info = *i; +- let mut list_data = &mut *(user_data as *mut PulseDevListData); +- +- let device_id = pa_xstrdup(info.name); +- +- let group_id = { +- let prop = pa_proplist_gets(info.proplist, b"sysfs.path\0".as_ptr() as *mut c_char); +- if !prop.is_null() { +- pa_xstrdup(prop) +- } else { +- ptr::null_mut() +- } +- }; +- +- let vendor_name = { +- let prop = pa_proplist_gets(info.proplist, +- b"device.vendor.name\0".as_ptr() as *mut c_char); +- if !prop.is_null() { +- pa_xstrdup(prop) +- } else { +- ptr::null_mut() +- } +- }; +- +- let preferred = if strcmp(info.name, list_data.default_source_name) == 0 { +- cubeb::DEVICE_PREF_ALL +- } else { +- cubeb::DevicePref::empty() +- }; +- +- let ctx = &(*list_data.context); +- +- let devinfo = cubeb::DeviceInfo { +- device_id: device_id, +- devid: device_id as cubeb::DeviceId, +- friendly_name: pa_xstrdup(info.description), +- group_id: group_id, +- vendor_name: vendor_name, +- devtype: cubeb::DEVICE_TYPE_INPUT, +- state: ctx.state_from_source_port(info.active_port), +- preferred: preferred, +- format: cubeb::DeviceFmt::all(), +- default_format: pulse_format_to_cubeb_format(info.sample_spec.format), +- max_channels: info.channel_map.channels as u32, +- min_rate: 1, +- max_rate: PA_RATE_MAX, +- default_rate: info.sample_spec.rate, +- latency_lo: 0, +- latency_hi: 0, +- }; +- +- list_data.devinfo.push(devinfo); +- +- pa_threaded_mainloop_signal(ctx.mainloop, 0); +-} +- +-unsafe extern "C" fn pulse_server_info_cb(_context: *mut pa_context, +- i: *const pa_server_info, +- user_data: *mut c_void) { +- assert!(!i.is_null()); +- let info = *i; +- let list_data = &mut *(user_data as *mut PulseDevListData); +- +- dup_str!(list_data.default_sink_name, info.default_sink_name); +- dup_str!(list_data.default_source_name, info.default_source_name); +- +- pa_threaded_mainloop_signal((*list_data.context).mainloop, 0); +-} +- +-unsafe extern "C" fn pulse_subscribe_callback(_ctx: *mut pa_context, +- t: pa_subscription_event_type_t, +- index: u32, +- user_data: *mut c_void) { +- let mut ctx = &mut *(user_data as *mut Context); +- +- match t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK { +- PA_SUBSCRIPTION_EVENT_SOURCE | +- PA_SUBSCRIPTION_EVENT_SINK => { +- +- if cubeb::log_enabled() { +- if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE && +- (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE { +- log!("Removing sink index %d", index); +- } else if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE && +- (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW { +- log!("Adding sink index %d", index); +- } +- if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK && +- (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE { +- log!("Removing source index %d", index); +- } else if (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK && +- (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW { +- log!("Adding source index %d", index); +- } +- } +- +- if (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE || +- (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW { +- ctx.collection_changed_callback.unwrap()(ctx as *mut _ as *mut _, ctx.collection_changed_user_ptr); +- } +- }, +- _ => {}, +- } +-} +- +-extern "C" { +- pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; +-} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/mod.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/mod.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/mod.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/mod.rs 2017-08-04 13:37:46.386821731 +0200 +@@ -7,8 +7,16 @@ mod context; + mod cork_state; + mod stream; + ++use std::os::raw::c_char; ++use std::ffi::CStr; ++ + pub type Result = ::std::result::Result; + + pub use self::context::Context; + pub use self::stream::Device; + pub use self::stream::Stream; ++ ++// helper to convert *const c_char to Option ++fn try_cstr_from<'str>(s: *const c_char) -> Option<&'str CStr> { ++ if s.is_null() { None } else { Some(unsafe { CStr::from_ptr(s) }) } ++} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/backend/stream.rs 2017-08-04 13:37:46.387821728 +0200 +@@ -6,8 +6,10 @@ + use backend::*; + use backend::cork_state::CorkState; + use cubeb; ++use pulse::{self, CVolumeExt, ChannelMapExt, SampleSpecExt, USecExt}; + use pulse_ffi::*; +-use std::os::raw::{c_char, c_long, c_void}; ++use std::ffi::{CStr, CString}; ++use std::os::raw::{c_long, c_void}; + use std::ptr; + + const PULSE_NO_GAIN: f32 = -1.0; +@@ -36,15 +38,12 @@ fn cubeb_channel_to_pa_channel(channel: + MAP[idx as usize] + } + +-fn layout_to_channel_map(layout: cubeb::ChannelLayout) -> pa_channel_map { ++fn layout_to_channel_map(layout: cubeb::ChannelLayout) -> pulse::ChannelMap { + assert_ne!(layout, cubeb::LAYOUT_UNDEFINED); + + let order = cubeb::mixer::channel_index_to_order(layout); + +- let mut cm: pa_channel_map = Default::default(); +- unsafe { +- pa_channel_map_init(&mut cm); +- } ++ let mut cm = pulse::ChannelMap::init(); + cm.channels = order.len() as u8; + for (s, d) in order.iter().zip(cm.map.iter_mut()) { + *d = cubeb_channel_to_pa_channel(*s); +@@ -57,24 +56,27 @@ pub struct Device(cubeb::Device); + impl Drop for Device { + fn drop(&mut self) { + unsafe { +- pa_xfree(self.0.input_name as *mut _); +- pa_xfree(self.0.output_name as *mut _); ++ if !self.0.input_name.is_null() { ++ let _ = CString::from_raw(self.0.input_name); ++ } ++ if !self.0.output_name.is_null() { ++ let _ = CString::from_raw(self.0.output_name); ++ } + } + } + } + +- + #[derive(Debug)] + pub struct Stream<'ctx> { + context: &'ctx Context, +- output_stream: *mut pa_stream, +- input_stream: *mut pa_stream, ++ output_stream: Option, ++ input_stream: Option, + data_callback: cubeb::DataCallback, + state_callback: cubeb::StateCallback, + user_ptr: *mut c_void, + drain_timer: *mut pa_time_event, +- output_sample_spec: pa_sample_spec, +- input_sample_spec: pa_sample_spec, ++ output_sample_spec: pulse::SampleSpec, ++ input_sample_spec: pulse::SampleSpec, + shutdown: bool, + volume: f32, + state: cubeb::State, +@@ -88,7 +90,7 @@ impl<'ctx> Drop for Stream<'ctx> { + + impl<'ctx> Stream<'ctx> { + pub fn new(context: &'ctx Context, +- stream_name: *const c_char, ++ stream_name: &CStr, + input_device: cubeb::DeviceId, + input_stream_params: Option, + output_device: cubeb::DeviceId, +@@ -99,83 +101,167 @@ impl<'ctx> Stream<'ctx> { + user_ptr: *mut c_void) + -> Result>> { + ++ fn check_error(s: &pulse::Stream, u: *mut c_void) { ++ let stm = unsafe { &mut *(u as *mut Stream) }; ++ if !s.get_state().is_good() { ++ stm.state_change_callback(cubeb::STATE_ERROR); ++ } ++ stm.context.mainloop.signal(); ++ } ++ ++ fn read_data(s: &pulse::Stream, nbytes: usize, u: *mut c_void) { ++ fn read_from_input(s: &pulse::Stream, buffer: *mut *const c_void, size: *mut usize) -> i32 { ++ let readable_size: i32 = s.readable_size() ++ .and_then(|s| Ok(s as i32)) ++ .unwrap_or(-1); ++ if readable_size > 0 { ++ if unsafe { s.peek(buffer, size).is_err() } { ++ return -1; ++ } ++ } ++ readable_size ++ } ++ ++ logv!("Input callback buffer size {}", nbytes); ++ let mut stm = unsafe { &mut *(u as *mut Stream) }; ++ if stm.shutdown { ++ return; ++ } ++ ++ let mut read_data: *const c_void = ptr::null(); ++ let mut read_size: usize = 0; ++ while read_from_input(s, &mut read_data, &mut read_size) > 0 { ++ /* read_data can be NULL in case of a hole. */ ++ if !read_data.is_null() { ++ let in_frame_size = stm.input_sample_spec.frame_size(); ++ let read_frames = read_size / in_frame_size; ++ ++ if stm.output_stream.is_some() { ++ // input/capture + output/playback operation ++ let out_frame_size = stm.output_sample_spec.frame_size(); ++ let write_size = read_frames * out_frame_size; ++ // Offer full duplex data for writing ++ stm.trigger_user_callback(read_data, write_size); ++ } else { ++ // input/capture only operation. Call callback directly ++ let got = unsafe { ++ stm.data_callback.unwrap()(stm as *mut _ as *mut _, ++ stm.user_ptr, ++ read_data, ++ ptr::null_mut(), ++ read_frames as c_long) ++ }; ++ ++ if got < 0 || got as usize != read_frames { ++ let _ = s.cancel_write(); ++ stm.shutdown = true; ++ break; ++ } ++ } ++ } ++ ++ if read_size > 0 { ++ let _ = s.drop(); ++ } ++ ++ if stm.shutdown { ++ return; ++ } ++ } ++ } ++ ++ fn write_data(_: &pulse::Stream, nbytes: usize, u: *mut c_void) { ++ logv!("Output callback to be written buffer size {}", nbytes); ++ let mut stm = unsafe { &mut *(u as *mut Stream) }; ++ if stm.shutdown || stm.state != cubeb::STATE_STARTED { ++ return; ++ } ++ ++ if stm.input_stream.is_none() { ++ // Output/playback only operation. ++ // Write directly to output ++ debug_assert!(stm.output_stream.is_some()); ++ stm.trigger_user_callback(ptr::null(), nbytes); ++ } ++ } ++ + let mut stm = Box::new(Stream { + context: context, +- output_stream: ptr::null_mut(), +- input_stream: ptr::null_mut(), ++ output_stream: None, ++ input_stream: None, + data_callback: data_callback, + state_callback: state_callback, + user_ptr: user_ptr, + drain_timer: ptr::null_mut(), +- output_sample_spec: pa_sample_spec::default(), +- input_sample_spec: pa_sample_spec::default(), ++ output_sample_spec: pulse::SampleSpec::default(), ++ input_sample_spec: pulse::SampleSpec::default(), + shutdown: false, + volume: PULSE_NO_GAIN, + state: cubeb::STATE_ERROR, + }); + +- unsafe { +- pa_threaded_mainloop_lock(stm.context.mainloop); ++ if let Some(ref context) = stm.context.context { ++ stm.context.mainloop.lock(); ++ ++ // Setup output stream + if let Some(ref stream_params) = output_stream_params { +- match stm.pulse_stream_init(stream_params, stream_name) { +- Ok(s) => stm.output_stream = s, ++ match Stream::stream_init(context, stream_params, stream_name) { ++ Ok(s) => { ++ stm.output_sample_spec = *s.get_sample_spec(); ++ ++ s.set_state_callback(check_error, stm.as_mut() as *mut _ as *mut _); ++ s.set_write_callback(write_data, stm.as_mut() as *mut _ as *mut _); ++ ++ let battr = set_buffering_attribute(latency_frames, &stm.output_sample_spec); ++ let device_name = super::try_cstr_from(output_device as *const _); ++ let _ = s.connect_playback(device_name, ++ &battr, ++ pulse::STREAM_AUTO_TIMING_UPDATE | pulse::STREAM_INTERPOLATE_TIMING | ++ pulse::STREAM_START_CORKED | ++ pulse::STREAM_ADJUST_LATENCY, ++ None, ++ None); ++ ++ stm.output_stream = Some(s); ++ }, + Err(e) => { +- pa_threaded_mainloop_unlock(stm.context.mainloop); ++ stm.context.mainloop.unlock(); + stm.destroy(); + return Err(e); + }, + } + +- stm.output_sample_spec = *pa_stream_get_sample_spec(stm.output_stream); +- +- pa_stream_set_state_callback(stm.output_stream, +- Some(stream_state_callback), +- stm.as_mut() as *mut _ as *mut _); +- pa_stream_set_write_callback(stm.output_stream, +- Some(stream_write_callback), +- stm.as_mut() as *mut _ as *mut _); +- +- let battr = set_buffering_attribute(latency_frames, &stm.output_sample_spec); +- pa_stream_connect_playback(stm.output_stream, +- output_device as *mut c_char, +- &battr, +- PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_INTERPOLATE_TIMING | +- PA_STREAM_START_CORKED | +- PA_STREAM_ADJUST_LATENCY, +- ptr::null(), +- ptr::null_mut()); + } + + // Set up input stream + if let Some(ref stream_params) = input_stream_params { +- match stm.pulse_stream_init(stream_params, stream_name) { +- Ok(s) => stm.input_stream = s, ++ match Stream::stream_init(context, stream_params, stream_name) { ++ Ok(s) => { ++ stm.input_sample_spec = *s.get_sample_spec(); ++ ++ s.set_state_callback(check_error, stm.as_mut() as *mut _ as *mut _); ++ s.set_read_callback(read_data, stm.as_mut() as *mut _ as *mut _); ++ ++ let battr = set_buffering_attribute(latency_frames, &stm.input_sample_spec); ++ let device_name = super::try_cstr_from(input_device as *const _); ++ let _ = s.connect_record(device_name, ++ &battr, ++ pulse::STREAM_AUTO_TIMING_UPDATE | pulse::STREAM_INTERPOLATE_TIMING | ++ pulse::STREAM_START_CORKED | ++ pulse::STREAM_ADJUST_LATENCY); ++ ++ stm.input_stream = Some(s); ++ }, + Err(e) => { +- pa_threaded_mainloop_unlock(stm.context.mainloop); ++ stm.context.mainloop.unlock(); + stm.destroy(); + return Err(e); + }, + } + +- stm.input_sample_spec = *(pa_stream_get_sample_spec(stm.input_stream)); +- +- pa_stream_set_state_callback(stm.input_stream, +- Some(stream_state_callback), +- stm.as_mut() as *mut _ as *mut _); +- pa_stream_set_read_callback(stm.input_stream, +- Some(stream_read_callback), +- stm.as_mut() as *mut _ as *mut _); +- +- let battr = set_buffering_attribute(latency_frames, &stm.input_sample_spec); +- pa_stream_connect_record(stm.input_stream, +- input_device as *mut c_char, +- &battr, +- PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_INTERPOLATE_TIMING | +- PA_STREAM_START_CORKED | +- PA_STREAM_ADJUST_LATENCY); + } + +- let r = if stm.wait_until_stream_ready() { ++ let r = if stm.wait_until_ready() { + /* force a timing update now, otherwise timing info does not become valid + until some point after initialization has completed. */ + stm.update_timing_info() +@@ -183,7 +269,7 @@ impl<'ctx> Stream<'ctx> { + false + }; + +- pa_threaded_mainloop_unlock(stm.context.mainloop); ++ stm.context.mainloop.unlock(); + + if !r { + stm.destroy(); +@@ -191,10 +277,10 @@ impl<'ctx> Stream<'ctx> { + } + + if cubeb::log_enabled() { +- if output_stream_params.is_some() { +- let output_att = *pa_stream_get_buffer_attr(stm.output_stream); +- log!("Output buffer attributes maxlength %u, tlength %u, \ +- prebuf %u, minreq %u, fragsize %u", ++ if let Some(ref output_stream) = stm.output_stream { ++ let output_att = output_stream.get_buffer_attr(); ++ log!("Output buffer attributes maxlength {}, tlength {}, \ ++ prebuf {}, minreq {}, fragsize {}", + output_att.maxlength, + output_att.tlength, + output_att.prebuf, +@@ -202,10 +288,10 @@ impl<'ctx> Stream<'ctx> { + output_att.fragsize); + } + +- if input_stream_params.is_some() { +- let input_att = *pa_stream_get_buffer_attr(stm.input_stream); +- log!("Input buffer attributes maxlength %u, tlength %u, \ +- prebuf %u, minreq %u, fragsize %u", ++ if let Some(ref input_stream) = stm.input_stream { ++ let input_att = input_stream.get_buffer_attr(); ++ log!("Input buffer attributes maxlength {}, tlength {}, \ ++ prebuf {}, minreq {}, fragsize {}", + input_att.maxlength, + input_att.tlength, + input_att.prebuf, +@@ -219,224 +305,250 @@ impl<'ctx> Stream<'ctx> { + } + + fn destroy(&mut self) { +- self.stream_cork(CorkState::cork()); ++ self.cork(CorkState::cork()); + +- unsafe { +- pa_threaded_mainloop_lock(self.context.mainloop); +- if !self.output_stream.is_null() { +- if !self.drain_timer.is_null() { +- /* there's no pa_rttime_free, so use this instead. */ +- let ma = pa_threaded_mainloop_get_api(self.context.mainloop); +- if !ma.is_null() { +- (*ma).time_free.unwrap()(self.drain_timer); ++ self.context.mainloop.lock(); ++ { ++ match self.output_stream.take() { ++ Some(stm) => { ++ if !self.drain_timer.is_null() { ++ /* there's no pa_rttime_free, so use this instead. */ ++ self.context ++ .mainloop ++ .get_api() ++ .time_free(self.drain_timer); + } +- } +- +- pa_stream_set_state_callback(self.output_stream, None, ptr::null_mut()); +- pa_stream_set_write_callback(self.output_stream, None, ptr::null_mut()); +- pa_stream_disconnect(self.output_stream); +- pa_stream_unref(self.output_stream); ++ stm.clear_state_callback(); ++ stm.clear_write_callback(); ++ let _ = stm.disconnect(); ++ stm.unref(); ++ }, ++ _ => {}, ++ } ++ ++ match self.input_stream.take() { ++ Some(stm) => { ++ stm.clear_state_callback(); ++ stm.clear_read_callback(); ++ let _ = stm.disconnect(); ++ stm.unref(); ++ }, ++ _ => {}, + } +- +- if !self.input_stream.is_null() { +- pa_stream_set_state_callback(self.input_stream, None, ptr::null_mut()); +- pa_stream_set_read_callback(self.input_stream, None, ptr::null_mut()); +- pa_stream_disconnect(self.input_stream); +- pa_stream_unref(self.input_stream); +- } +- pa_threaded_mainloop_unlock(self.context.mainloop); + } ++ self.context.mainloop.unlock(); + } + + pub fn start(&mut self) -> i32 { ++ fn output_preroll(_: &pulse::MainloopApi, u: *mut c_void) { ++ let mut stm = unsafe { &mut *(u as *mut Stream) }; ++ if !stm.shutdown { ++ let size = stm.output_stream ++ .as_ref() ++ .map_or(0, |s| s.writable_size().unwrap_or(0)); ++ stm.trigger_user_callback(ptr::null_mut(), size); ++ } ++ } ++ + self.shutdown = false; +- self.stream_cork(CorkState::uncork() | CorkState::notify()); ++ self.cork(CorkState::uncork() | CorkState::notify()); + +- if !self.output_stream.is_null() && self.input_stream.is_null() { +- unsafe { +- /* On output only case need to manually call user cb once in order to make +- * things roll. This is done via a defer event in order to execute it +- * from PA server thread. */ +- pa_threaded_mainloop_lock(self.context.mainloop); +- pa_mainloop_api_once(pa_threaded_mainloop_get_api(self.context.mainloop), +- Some(pulse_defer_event_cb), +- self as *mut _ as *mut _); +- pa_threaded_mainloop_unlock(self.context.mainloop); +- } ++ if self.output_stream.is_some() && self.input_stream.is_none() { ++ /* On output only case need to manually call user cb once in order to make ++ * things roll. This is done via a defer event in order to execute it ++ * from PA server thread. */ ++ self.context.mainloop.lock(); ++ self.context ++ .mainloop ++ .get_api() ++ .once(output_preroll, self as *mut _ as *mut _); ++ self.context.mainloop.unlock(); + } + + cubeb::OK + } + + pub fn stop(&mut self) -> i32 { +- unsafe { +- pa_threaded_mainloop_lock(self.context.mainloop); ++ { ++ self.context.mainloop.lock(); + self.shutdown = true; + // If draining is taking place wait to finish + while !self.drain_timer.is_null() { +- pa_threaded_mainloop_wait(self.context.mainloop); ++ self.context.mainloop.wait(); + } +- pa_threaded_mainloop_unlock(self.context.mainloop); ++ self.context.mainloop.unlock(); + } +- self.stream_cork(CorkState::cork() | CorkState::notify()); ++ self.cork(CorkState::cork() | CorkState::notify()); + + cubeb::OK + } + + pub fn position(&self) -> Result { +- if self.output_stream.is_null() { +- return Err(cubeb::ERROR); +- } ++ let in_thread = self.context.mainloop.in_thread(); + +- let position = unsafe { +- let in_thread = pa_threaded_mainloop_in_thread(self.context.mainloop); +- +- if in_thread == 0 { +- pa_threaded_mainloop_lock(self.context.mainloop); +- } +- +- let mut r_usec: pa_usec_t = Default::default(); +- let r = pa_stream_get_time(self.output_stream, &mut r_usec); +- if in_thread == 0 { +- pa_threaded_mainloop_unlock(self.context.mainloop); +- } +- +- if r != 0 { +- return Err(cubeb::ERROR); +- } ++ if !in_thread { ++ self.context.mainloop.lock(); ++ } + +- let bytes = pa_usec_to_bytes(r_usec, &self.output_sample_spec); +- (bytes / pa_frame_size(&self.output_sample_spec)) as u64 ++ let r = match self.output_stream { ++ None => Err(cubeb::ERROR), ++ Some(ref stm) => { ++ match stm.get_time() { ++ Ok(r_usec) => { ++ let bytes = r_usec.to_bytes(&self.output_sample_spec); ++ Ok((bytes / self.output_sample_spec.frame_size()) as u64) ++ }, ++ Err(_) => Err(cubeb::ERROR), ++ } ++ }, + }; +- Ok(position) +- } + +- pub fn latency(&self) -> Result { +- if self.output_stream.is_null() { +- return Err(cubeb::ERROR); ++ if !in_thread { ++ self.context.mainloop.unlock(); + } + +- let mut r_usec: pa_usec_t = 0; +- let mut negative: i32 = 0; +- let r = unsafe { pa_stream_get_latency(self.output_stream, &mut r_usec, &mut negative) }; ++ r ++ } + +- if r != 0 { +- return Err(cubeb::ERROR); ++ pub fn latency(&self) -> Result { ++ match self.output_stream { ++ None => Err(cubeb::ERROR), ++ Some(ref stm) => { ++ match stm.get_latency() { ++ Ok((r_usec, negative)) => { ++ debug_assert!(negative); ++ let latency = (r_usec * self.output_sample_spec.rate as pa_usec_t / PA_USEC_PER_SEC) as u32; ++ Ok(latency) ++ }, ++ Err(_) => Err(cubeb::ERROR), ++ } ++ }, + } +- +- debug_assert_eq!(negative, 0); +- let latency = (r_usec * self.output_sample_spec.rate as pa_usec_t / PA_USEC_PER_SEC) as u32; +- +- Ok(latency) + } + + pub fn set_volume(&mut self, volume: f32) -> i32 { +- if self.output_stream.is_null() { +- return cubeb::ERROR; +- } +- +- unsafe { +- pa_threaded_mainloop_lock(self.context.mainloop); +- +- while self.context.default_sink_info.is_none() { +- pa_threaded_mainloop_wait(self.context.mainloop); +- } +- +- let mut cvol: pa_cvolume = Default::default(); +- +- /* if the pulse daemon is configured to use flat volumes, +- * apply our own gain instead of changing the input volume on the sink. */ +- let flags = { +- match self.context.default_sink_info { +- Some(ref info) => info.flags, +- _ => 0, +- } +- }; +- +- if (flags & PA_SINK_FLAT_VOLUME) != 0 { +- self.volume = volume; +- } else { +- let ss = pa_stream_get_sample_spec(self.output_stream); +- let vol = pa_sw_volume_from_linear(volume as f64); +- pa_cvolume_set(&mut cvol, (*ss).channels as u32, vol); +- +- let index = pa_stream_get_index(self.output_stream); ++ match self.output_stream { ++ None => cubeb::ERROR, ++ Some(ref stm) => { ++ if let Some(ref context) = self.context.context { ++ self.context.mainloop.lock(); ++ ++ let mut cvol: pa_cvolume = Default::default(); ++ ++ /* if the pulse daemon is configured to use flat ++ * volumes, apply our own gain instead of changing ++ * the input volume on the sink. */ ++ let flags = { ++ match self.context.default_sink_info { ++ Some(ref info) => info.flags, ++ _ => pulse::SinkFlags::empty(), ++ } ++ }; ++ ++ if flags.contains(pulse::SINK_FLAT_VOLUME) { ++ self.volume = volume; ++ } else { ++ let channels = stm.get_sample_spec().channels; ++ let vol = pulse::sw_volume_from_linear(volume as f64); ++ cvol.set(channels as u32, vol); ++ ++ let index = stm.get_index(); ++ ++ let context_ptr = self.context as *const _ as *mut _; ++ if let Ok(o) = context.set_sink_input_volume(index, &cvol, context_success, context_ptr) { ++ self.context.operation_wait(stm, &o); ++ } ++ } + +- let op = pa_context_set_sink_input_volume(self.context.context, +- index, +- &cvol, +- Some(volume_success), +- self as *mut _ as *mut _); +- if !op.is_null() { +- self.context.operation_wait(self.output_stream, op); +- pa_operation_unref(op); ++ self.context.mainloop.unlock(); ++ cubeb::OK ++ } else { ++ cubeb::ERROR + } +- } +- +- pa_threaded_mainloop_unlock(self.context.mainloop); ++ }, + } +- cubeb::OK + } + + pub fn set_panning(&mut self, panning: f32) -> i32 { +- if self.output_stream.is_null() { +- return cubeb::ERROR; +- } ++ #[repr(C)] ++ struct SinkInputInfoResult<'a> { ++ pub cvol: pulse::CVolume, ++ pub mainloop: &'a pulse::ThreadedMainloop, ++ } ++ ++ fn get_input_volume(_: &pulse::Context, info: *const pulse::SinkInputInfo, eol: i32, u: *mut c_void) { ++ let mut r = unsafe { &mut *(u as *mut SinkInputInfoResult) }; ++ if eol == 0 { ++ let info = unsafe { *info }; ++ r.cvol = info.volume; ++ } ++ r.mainloop.signal(); ++ } ++ ++ match self.output_stream { ++ None => cubeb::ERROR, ++ Some(ref stm) => { ++ if let Some(ref context) = self.context.context { ++ self.context.mainloop.lock(); ++ ++ let map = stm.get_channel_map(); ++ if !map.can_balance() { ++ self.context.mainloop.unlock(); ++ return cubeb::ERROR; ++ } + +- unsafe { +- pa_threaded_mainloop_lock(self.context.mainloop); ++ let index = stm.get_index(); + +- let map = pa_stream_get_channel_map(self.output_stream); +- if pa_channel_map_can_balance(map) == 0 { +- pa_threaded_mainloop_unlock(self.context.mainloop); +- return cubeb::ERROR; +- } ++ let mut r = SinkInputInfoResult { ++ cvol: pulse::CVolume::default(), ++ mainloop: &self.context.mainloop, ++ }; + +- let index = pa_stream_get_index(self.output_stream); ++ if let Ok(o) = context.get_sink_input_info(index, get_input_volume, &mut r as *mut _ as *mut _) { ++ self.context.operation_wait(stm, &o); ++ } + +- let mut cvol: pa_cvolume = Default::default(); +- let mut r = SinkInputInfoResult { +- cvol: &mut cvol, +- mainloop: self.context.mainloop, +- }; ++ r.cvol.set_balance(map, panning); + +- let op = pa_context_get_sink_input_info(self.context.context, +- index, +- Some(sink_input_info_cb), +- &mut r as *mut _ as *mut _); +- if !op.is_null() { +- self.context.operation_wait(self.output_stream, op); +- pa_operation_unref(op); +- } +- +- pa_cvolume_set_balance(&mut cvol, map, panning); +- +- let op = pa_context_set_sink_input_volume(self.context.context, +- index, +- &cvol, +- Some(volume_success), +- self as *mut _ as *mut _); +- if !op.is_null() { +- self.context.operation_wait(self.output_stream, op); +- pa_operation_unref(op); +- } ++ let context_ptr = self.context as *const _ as *mut _; ++ if let Ok(o) = context.set_sink_input_volume(index, &r.cvol, context_success, context_ptr) { ++ self.context.operation_wait(stm, &o); ++ } + +- pa_threaded_mainloop_unlock(self.context.mainloop); +- } ++ self.context.mainloop.unlock(); + +- cubeb::OK ++ cubeb::OK ++ } else { ++ cubeb::ERROR ++ } ++ }, ++ } + } + + pub fn current_device(&self) -> Result> { + if self.context.version_0_9_8 { + let mut dev = Box::new(cubeb::Device::default()); + +- if !self.input_stream.is_null() { +- dev.input_name = unsafe { pa_xstrdup(pa_stream_get_device_name(self.input_stream)) }; ++ if self.input_stream.is_some() { ++ if let Some(ref stm) = self.input_stream { ++ dev.input_name = match stm.get_device_name() { ++ Ok(name) => name.to_owned().into_raw(), ++ Err(_) => { ++ return Err(cubeb::ERROR); ++ }, ++ } ++ } + } + +- if !self.output_stream.is_null() { +- dev.output_name = unsafe { pa_xstrdup(pa_stream_get_device_name(self.output_stream)) }; ++ if !self.output_stream.is_some() { ++ if let Some(ref stm) = self.output_stream { ++ dev.output_name = match stm.get_device_name() { ++ Ok(name) => name.to_owned().into_raw(), ++ Err(_) => { ++ return Err(cubeb::ERROR); ++ }, ++ } ++ } + } + + Ok(dev) +@@ -445,51 +557,62 @@ impl<'ctx> Stream<'ctx> { + } + } + +- fn pulse_stream_init(&mut self, +- stream_params: &cubeb::StreamParams, +- stream_name: *const c_char) +- -> Result<*mut pa_stream> { ++ fn stream_init(context: &pulse::Context, ++ stream_params: &cubeb::StreamParams, ++ stream_name: &CStr) ++ -> Result { + +- fn to_pulse_format(format: cubeb::SampleFormat) -> pa_sample_format_t { ++ fn to_pulse_format(format: cubeb::SampleFormat) -> pulse::SampleFormat { + match format { +- cubeb::SAMPLE_S16LE => PA_SAMPLE_S16LE, +- cubeb::SAMPLE_S16BE => PA_SAMPLE_S16BE, +- cubeb::SAMPLE_FLOAT32LE => PA_SAMPLE_FLOAT32LE, +- cubeb::SAMPLE_FLOAT32BE => PA_SAMPLE_FLOAT32BE, +- _ => panic!("Invalid format: {:?}", format), ++ cubeb::SAMPLE_S16LE => pulse::SampleFormat::Signed16LE, ++ cubeb::SAMPLE_S16BE => pulse::SampleFormat::Signed16BE, ++ cubeb::SAMPLE_FLOAT32LE => pulse::SampleFormat::Float32LE, ++ cubeb::SAMPLE_FLOAT32BE => pulse::SampleFormat::Float32BE, ++ _ => pulse::SampleFormat::Invalid, + } + } + + let fmt = to_pulse_format(stream_params.format); +- if fmt == PA_SAMPLE_INVALID { ++ if fmt == pulse::SampleFormat::Invalid { + return Err(cubeb::ERROR_INVALID_FORMAT); + } + +- let ss = pa_sample_spec { ++ let ss = pulse::SampleSpec { + channels: stream_params.channels as u8, +- format: fmt, ++ format: fmt.into(), + rate: stream_params.rate, + }; + +- let stream = if stream_params.layout == cubeb::LAYOUT_UNDEFINED { +- unsafe { pa_stream_new(self.context.context, stream_name, &ss, ptr::null_mut()) } +- } else { +- let cm = layout_to_channel_map(stream_params.layout); +- unsafe { pa_stream_new(self.context.context, stream_name, &ss, &cm) } ++ let cm: Option = match stream_params.layout { ++ cubeb::LAYOUT_UNDEFINED => None, ++ _ => Some(layout_to_channel_map(stream_params.layout)), + }; + +- if !stream.is_null() { +- Ok(stream) +- } else { +- Err(cubeb::ERROR) ++ let stream = pulse::Stream::new(context, stream_name, &ss, cm.as_ref()); ++ ++ match stream { ++ None => Err(cubeb::ERROR), ++ Some(stm) => Ok(stm), ++ } ++ } ++ ++ pub fn cork_stream(&self, stream: Option<&pulse::Stream>, state: CorkState) { ++ if let Some(stm) = stream { ++ if let Ok(o) = stm.cork(state.is_cork() as i32, ++ stream_success, ++ self as *const _ as *mut _) { ++ self.context.operation_wait(stream, &o); ++ } + } + } + +- fn stream_cork(&mut self, state: CorkState) { +- unsafe { pa_threaded_mainloop_lock(self.context.mainloop) }; +- self.context.pulse_stream_cork(self.output_stream, state); +- self.context.pulse_stream_cork(self.input_stream, state); +- unsafe { pa_threaded_mainloop_unlock(self.context.mainloop) }; ++ fn cork(&mut self, state: CorkState) { ++ { ++ self.context.mainloop.lock(); ++ self.cork_stream(self.output_stream.as_ref(), state); ++ self.cork_stream(self.input_stream.as_ref(), state); ++ self.context.mainloop.unlock() ++ } + + if state.is_notify() { + self.state_change_callback(if state.is_cork() { +@@ -503,18 +626,9 @@ impl<'ctx> Stream<'ctx> { + fn update_timing_info(&self) -> bool { + let mut r = false; + +- if !self.output_stream.is_null() { +- let o = unsafe { +- pa_stream_update_timing_info(self.output_stream, +- Some(stream_success_callback), +- self as *const _ as *mut _) +- }; +- +- if !o.is_null() { +- r = self.context.operation_wait(self.output_stream, o); +- unsafe { +- pa_operation_unref(o); +- } ++ if let Some(ref stm) = self.output_stream { ++ if let Ok(o) = stm.update_timing_info(stream_success, self as *const _ as *mut _) { ++ r = self.context.operation_wait(stm, &o); + } + + if !r { +@@ -522,18 +636,9 @@ impl<'ctx> Stream<'ctx> { + } + } + +- if !self.input_stream.is_null() { +- let o = unsafe { +- pa_stream_update_timing_info(self.input_stream, +- Some(stream_success_callback), +- self as *const _ as *mut _) +- }; +- +- if !o.is_null() { +- r = self.context.operation_wait(self.input_stream, o); +- unsafe { +- pa_operation_unref(o); +- } ++ if let Some(ref stm) = self.input_stream { ++ if let Ok(o) = stm.update_timing_info(stream_success, self as *const _ as *mut _) { ++ r = self.context.operation_wait(stm, &o); + } + } + +@@ -547,232 +652,162 @@ impl<'ctx> Stream<'ctx> { + } + } + +- fn wait_until_stream_ready(&self) -> bool { +- if !self.output_stream.is_null() && !wait_until_io_stream_ready(self.output_stream, self.context.mainloop) { +- return false; +- } +- +- if !self.input_stream.is_null() && !wait_until_io_stream_ready(self.input_stream, self.context.mainloop) { +- return false; +- } +- +- true +- } +- +- fn trigger_user_callback(&mut self, s: *mut pa_stream, input_data: *const c_void, nbytes: usize) { +- let frame_size = unsafe { pa_frame_size(&self.output_sample_spec) }; +- debug_assert_eq!(nbytes % frame_size, 0); +- +- let mut buffer: *mut c_void = ptr::null_mut(); +- let mut r: i32; +- +- let mut towrite = nbytes; +- let mut read_offset = 0usize; +- while towrite > 0 { +- let mut size = towrite; +- r = unsafe { pa_stream_begin_write(s, &mut buffer, &mut size) }; +- // Note: this has failed running under rr on occassion - needs investigation. +- debug_assert_eq!(r, 0); +- debug_assert!(size > 0); +- debug_assert_eq!(size % frame_size, 0); +- +- logv!("Trigger user callback with output buffer size={}, read_offset={}", +- size, +- read_offset); +- let read_ptr = unsafe { (input_data as *const u8).offset(read_offset as isize) }; +- let got = unsafe { +- self.data_callback.unwrap()(self as *const _ as *mut _, +- self.user_ptr, +- read_ptr as *const _ as *mut _, +- buffer, +- (size / frame_size) as c_long) +- }; +- if got < 0 { +- unsafe { +- pa_stream_cancel_write(s); +- } +- self.shutdown = true; +- return; +- } +- // If more iterations move offset of read buffer +- if !input_data.is_null() { +- let in_frame_size = unsafe { pa_frame_size(&self.input_sample_spec) }; +- read_offset += (size / frame_size) * in_frame_size; ++ fn wait_until_ready(&self) -> bool { ++ fn wait_until_io_stream_ready(stm: &pulse::Stream, mainloop: &pulse::ThreadedMainloop) -> bool { ++ if mainloop.is_null() { ++ return false; + } + +- if self.volume != PULSE_NO_GAIN { +- let samples = (self.output_sample_spec.channels as usize * size / frame_size) as isize; +- +- if self.output_sample_spec.format == PA_SAMPLE_S16BE || +- self.output_sample_spec.format == PA_SAMPLE_S16LE { +- let b = buffer as *mut i16; +- for i in 0..samples { +- unsafe { *b.offset(i) *= self.volume as i16 }; +- } +- } else { +- let b = buffer as *mut f32; +- for i in 0..samples { +- unsafe { *b.offset(i) *= self.volume }; +- } ++ loop { ++ let state = stm.get_state(); ++ if !state.is_good() { ++ return false; ++ } ++ if state == pulse::StreamState::Ready { ++ break; + } ++ mainloop.wait(); + } + +- r = unsafe { +- pa_stream_write(s, +- buffer, +- got as usize * frame_size, +- None, +- 0, +- PA_SEEK_RELATIVE) +- }; +- debug_assert_eq!(r, 0); ++ true ++ } + +- if (got as usize) < size / frame_size { +- let mut latency: pa_usec_t = 0; +- let rr: i32 = unsafe { pa_stream_get_latency(s, &mut latency, ptr::null_mut()) }; +- if rr == -(PA_ERR_NODATA as i32) { +- /* this needs a better guess. */ +- latency = 100 * PA_USEC_PER_MSEC; +- } +- debug_assert!(r == 0 || r == -(PA_ERR_NODATA as i32)); +- /* pa_stream_drain is useless, see PA bug# 866. this is a workaround. */ +- /* arbitrary safety margin: double the current latency. */ +- debug_assert!(self.drain_timer.is_null()); +- self.drain_timer = unsafe { +- pa_context_rttime_new(self.context.context, +- pa_rtclock_now() + 2 * latency, +- Some(stream_drain_callback), +- self as *const _ as *mut _) +- }; +- self.shutdown = true; +- return; ++ if let Some(ref stm) = self.output_stream { ++ if !wait_until_io_stream_ready(stm, &self.context.mainloop) { ++ return false; + } +- +- towrite -= size; + } + +- debug_assert_eq!(towrite, 0); +- } +-} +- +-unsafe extern "C" fn stream_success_callback(_s: *mut pa_stream, _success: i32, u: *mut c_void) { +- let stm = &*(u as *mut Stream); +- pa_threaded_mainloop_signal(stm.context.mainloop, 0); +-} +- +-unsafe extern "C" fn stream_drain_callback(a: *mut pa_mainloop_api, +- e: *mut pa_time_event, +- _tv: *const timeval, +- u: *mut c_void) { +- let mut stm = &mut *(u as *mut Stream); +- debug_assert_eq!(stm.drain_timer, e); +- stm.state_change_callback(cubeb::STATE_DRAINED); +- /* there's no pa_rttime_free, so use this instead. */ +- (*a).time_free.unwrap()(stm.drain_timer); +- stm.drain_timer = ptr::null_mut(); +- pa_threaded_mainloop_signal(stm.context.mainloop, 0); +-} +- +-unsafe extern "C" fn stream_state_callback(s: *mut pa_stream, u: *mut c_void) { +- let stm = &mut *(u as *mut Stream); +- if !PA_STREAM_IS_GOOD(pa_stream_get_state(s)) { +- stm.state_change_callback(cubeb::STATE_ERROR); +- } +- pa_threaded_mainloop_signal(stm.context.mainloop, 0); +-} +- +-fn read_from_input(s: *mut pa_stream, buffer: *mut *const c_void, size: *mut usize) -> i32 { +- let readable_size = unsafe { pa_stream_readable_size(s) }; +- if readable_size > 0 && unsafe { pa_stream_peek(s, buffer, size) } < 0 { +- return -1; +- } +- +- readable_size as i32 +-} ++ if let Some(ref stm) = self.input_stream { ++ if !wait_until_io_stream_ready(stm, &self.context.mainloop) { ++ return false; ++ } ++ } + +-unsafe extern "C" fn stream_write_callback(s: *mut pa_stream, nbytes: usize, u: *mut c_void) { +- logv!("Output callback to be written buffer size {}", nbytes); +- let mut stm = &mut *(u as *mut Stream); +- if stm.shutdown || stm.state != cubeb::STATE_STARTED { +- return; ++ true + } + +- if stm.input_stream.is_null() { +- // Output/playback only operation. +- // Write directly to output +- debug_assert!(!stm.output_stream.is_null()); +- stm.trigger_user_callback(s, ptr::null(), nbytes); +- } +-} ++ fn trigger_user_callback(&mut self, input_data: *const c_void, nbytes: usize) { ++ fn drained_cb(a: &pulse::MainloopApi, e: *mut pa_time_event, _tv: &pulse::TimeVal, u: *mut c_void) { ++ let mut stm = unsafe { &mut *(u as *mut Stream) }; ++ debug_assert_eq!(stm.drain_timer, e); ++ stm.state_change_callback(cubeb::STATE_DRAINED); ++ /* there's no pa_rttime_free, so use this instead. */ ++ a.time_free(stm.drain_timer); ++ stm.drain_timer = ptr::null_mut(); ++ stm.context.mainloop.signal(); ++ } ++ ++ if let Some(ref stm) = self.output_stream { ++ ++ let frame_size = self.output_sample_spec.frame_size(); ++ debug_assert_eq!(nbytes % frame_size, 0); ++ ++ let mut towrite = nbytes; ++ let mut read_offset = 0usize; ++ while towrite > 0 { ++ match stm.begin_write(towrite) { ++ Err(e) => { ++ panic!("Failed to write data: {}", e); ++ }, ++ Ok((buffer, size)) => { ++ debug_assert!(size > 0); ++ debug_assert_eq!(size % frame_size, 0); ++ ++ logv!("Trigger user callback with output buffer size={}, read_offset={}", ++ size, ++ read_offset); ++ let read_ptr = unsafe { (input_data as *const u8).offset(read_offset as isize) }; ++ let got = unsafe { ++ self.data_callback.unwrap()(self as *const _ as *mut _, ++ self.user_ptr, ++ read_ptr as *const _ as *mut _, ++ buffer, ++ (size / frame_size) as c_long) ++ }; ++ if got < 0 { ++ let _ = stm.cancel_write(); ++ self.shutdown = true; ++ return; ++ } ++ ++ // If more iterations move offset of read buffer ++ if !input_data.is_null() { ++ let in_frame_size = self.input_sample_spec.frame_size(); ++ read_offset += (size / frame_size) * in_frame_size; ++ } ++ ++ if self.volume != PULSE_NO_GAIN { ++ let samples = (self.output_sample_spec.channels as usize * size / frame_size) as isize; ++ ++ if self.output_sample_spec.format == PA_SAMPLE_S16BE || ++ self.output_sample_spec.format == PA_SAMPLE_S16LE { ++ let b = buffer as *mut i16; ++ for i in 0..samples { ++ unsafe { *b.offset(i) *= self.volume as i16 }; ++ } ++ } else { ++ let b = buffer as *mut f32; ++ for i in 0..samples { ++ unsafe { *b.offset(i) *= self.volume }; ++ } ++ } ++ } ++ ++ let r = stm.write(buffer, ++ got as usize * frame_size, ++ 0, ++ pulse::SeekMode::Relative); ++ debug_assert!(r.is_ok()); ++ ++ if (got as usize) < size / frame_size { ++ let latency = match stm.get_latency() { ++ Ok((l, negative)) => { ++ assert_ne!(negative, true); ++ l ++ }, ++ Err(e) => { ++ debug_assert_eq!(e, pulse::ErrorCode::from_error_code(PA_ERR_NODATA)); ++ /* this needs a better guess. */ ++ 100 * PA_USEC_PER_MSEC ++ }, ++ }; ++ ++ /* pa_stream_drain is useless, see PA bug# 866. this is a workaround. */ ++ /* arbitrary safety margin: double the current latency. */ ++ debug_assert!(self.drain_timer.is_null()); ++ let stream_ptr = self as *const _ as *mut _; ++ if let Some(ref context) = self.context.context { ++ self.drain_timer = ++ context.rttime_new(pulse::rtclock_now() + 2 * latency, drained_cb, stream_ptr); ++ } ++ self.shutdown = true; ++ return; ++ } + +-unsafe extern "C" fn stream_read_callback(s: *mut pa_stream, nbytes: usize, u: *mut c_void) { +- logv!("Input callback buffer size {}", nbytes); +- let mut stm = &mut *(u as *mut Stream); +- if stm.shutdown { +- return; +- } +- +- let mut read_data: *const c_void = ptr::null(); +- let mut read_size: usize = 0; +- while read_from_input(s, &mut read_data, &mut read_size) > 0 { +- /* read_data can be NULL in case of a hole. */ +- if !read_data.is_null() { +- let in_frame_size = pa_frame_size(&stm.input_sample_spec); +- let read_frames = read_size / in_frame_size; +- +- if !stm.output_stream.is_null() { +- // input/capture + output/playback operation +- let out_frame_size = pa_frame_size(&stm.output_sample_spec); +- let write_size = read_frames * out_frame_size; +- // Offer full duplex data for writing +- let stream = stm.output_stream; +- stm.trigger_user_callback(stream, read_data, write_size); +- } else { +- // input/capture only operation. Call callback directly +- let got = stm.data_callback.unwrap()(stm as *mut _ as *mut _, +- stm.user_ptr, +- read_data, +- ptr::null_mut(), +- read_frames as c_long); +- if got < 0 || got as usize != read_frames { +- pa_stream_cancel_write(s); +- stm.shutdown = true; +- break; ++ towrite -= size; ++ }, + } + } +- } +- +- if read_size > 0 { +- pa_stream_drop(s); +- } +- +- if stm.shutdown { +- return; ++ debug_assert_eq!(towrite, 0); + } + } + } + +-fn wait_until_io_stream_ready(stream: *mut pa_stream, mainloop: *mut pa_threaded_mainloop) -> bool { +- if stream.is_null() || mainloop.is_null() { +- return false; +- } +- +- loop { +- let state = unsafe { pa_stream_get_state(stream) }; +- if !PA_STREAM_IS_GOOD(state) { +- return false; +- } +- if state == PA_STREAM_READY { +- break; +- } +- unsafe { pa_threaded_mainloop_wait(mainloop) }; +- } ++fn stream_success(_: &pulse::Stream, success: i32, u: *mut c_void) { ++ let stm = unsafe { &*(u as *mut Stream) }; ++ debug_assert_ne!(success, 0); ++ stm.context.mainloop.signal(); ++} + +- true ++fn context_success(_: &pulse::Context, success: i32, u: *mut c_void) { ++ let ctx = unsafe { &*(u as *mut Context) }; ++ debug_assert_ne!(success, 0); ++ ctx.mainloop.signal(); + } + + fn set_buffering_attribute(latency_frames: u32, sample_spec: &pa_sample_spec) -> pa_buffer_attr { +- let tlength = latency_frames * unsafe { pa_frame_size(sample_spec) } as u32; ++ let tlength = latency_frames * sample_spec.frame_size() as u32; + let minreq = tlength / 4; + let battr = pa_buffer_attr { + maxlength: u32::max_value(), +@@ -791,34 +826,3 @@ fn set_buffering_attribute(latency_frame + + battr + } +- +-unsafe extern "C" fn pulse_defer_event_cb(_a: *mut pa_mainloop_api, u: *mut c_void) { +- let mut stm = &mut *(u as *mut Stream); +- if stm.shutdown { +- return; +- } +- let writable_size = pa_stream_writable_size(stm.output_stream); +- let stream = stm.output_stream; +- stm.trigger_user_callback(stream, ptr::null_mut(), writable_size); +-} +- +-#[repr(C)] +-struct SinkInputInfoResult { +- pub cvol: *mut pa_cvolume, +- pub mainloop: *mut pa_threaded_mainloop, +-} +- +-unsafe extern "C" fn sink_input_info_cb(_c: *mut pa_context, i: *const pa_sink_input_info, eol: i32, u: *mut c_void) { +- let info = &*i; +- let mut r = &mut *(u as *mut SinkInputInfoResult); +- if eol == 0 { +- *r.cvol = info.volume; +- } +- pa_threaded_mainloop_signal(r.mainloop, 0); +-} +- +-unsafe extern "C" fn volume_success(_c: *mut pa_context, success: i32, u: *mut c_void) { +- let stm = &*(u as *mut Stream); +- debug_assert_ne!(success, 0); +- pa_threaded_mainloop_signal(stm.context.mainloop, 0); +-} +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/capi.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/capi.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/capi.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/capi.rs 2017-08-04 13:37:46.387821728 +0200 +@@ -5,6 +5,7 @@ + + use backend; + use cubeb; ++use std::ffi::CStr; + use std::os::raw::{c_char, c_void}; + + unsafe extern "C" fn capi_init(c: *mut *mut cubeb::Context, context_name: *const c_char) -> i32 { +@@ -114,21 +115,18 @@ unsafe extern "C" fn capi_stream_init(c: + state_callback: cubeb::StateCallback, + user_ptr: *mut c_void) + -> i32 { ++ fn try_stream_params_from(sp: *mut cubeb::StreamParams) -> Option { ++ if sp.is_null() { None } else { Some(unsafe { *sp }) } ++ } ++ + let mut ctx = &mut *(c as *mut backend::Context); ++ let stream_name = CStr::from_ptr(stream_name); + + match ctx.new_stream(stream_name, + input_device, +- if input_stream_params.is_null() { +- None +- } else { +- Some(*input_stream_params) +- }, ++ try_stream_params_from(input_stream_params), + output_device, +- if output_stream_params.is_null() { +- None +- } else { +- Some(*output_stream_params) +- }, ++ try_stream_params_from(output_stream_params), + latency_frames, + data_callback, + state_callback, +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/lib.rs.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/lib.rs +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/lib.rs.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/src/lib.rs 2017-08-04 13:37:46.387821728 +0200 +@@ -8,6 +8,7 @@ + #[macro_use] + extern crate cubeb_ffi as cubeb; + extern crate pulse_ffi; ++extern crate pulse; + extern crate semver; + + mod capi; +diff -up firefox-55.0/media/libcubeb/cubeb-pulse-rs/update.sh.cubeb-pulse-arm firefox-55.0/media/libcubeb/cubeb-pulse-rs/update.sh +--- firefox-55.0/media/libcubeb/cubeb-pulse-rs/update.sh.cubeb-pulse-arm 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/media/libcubeb/cubeb-pulse-rs/update.sh 2017-08-04 13:37:46.383821740 +0200 +@@ -13,6 +13,9 @@ cp -pr $1/cubeb-ffi/src/* cubeb-ffi/src/ + test -d pulse-ffi/src || mkdir -p pulse-ffi/src + cp -pr $1/pulse-ffi/Cargo.toml pulse-ffi/ + cp -pr $1/pulse-ffi/src/* pulse-ffi/src/ ++test -d pulse-rs/src || mkdir -p pulse-rs/src ++cp -pr $1/pulse-rs/Cargo.toml pulse-rs/ ++cp -pr $1/pulse-rs/src/* pulse-rs/src/ + + if [ -d $1/.git ]; then + rev=$(cd $1 && git rev-parse --verify HEAD) +diff -up firefox-55.0/toolkit/library/gtest/rust/Cargo.lock.cubeb-pulse-arm firefox-55.0/toolkit/library/gtest/rust/Cargo.lock +--- firefox-55.0/toolkit/library/gtest/rust/Cargo.lock.cubeb-pulse-arm 2017-08-04 13:37:46.388821725 +0200 ++++ firefox-55.0/toolkit/library/gtest/rust/Cargo.lock 2017-08-04 13:59:15.592940994 +0200 +@@ -252,6 +252,7 @@ name = "cubeb-pulse" + version = "0.0.1" + dependencies = [ + "cubeb-ffi 0.0.1", ++ "pulse 0.1.0", + "pulse-ffi 0.1.0", + "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -660,6 +661,14 @@ version = "0.1.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + + [[package]] ++name = "pulse" ++version = "0.1.0" ++dependencies = [ ++ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "pulse-ffi 0.1.0", ++] ++ ++[[package]] + name = "pulse-ffi" + version = "0.1.0" + dependencies = [ +diff -up firefox-55.0/toolkit/library/rust/Cargo.lock.cubeb-pulse-arm firefox-55.0/toolkit/library/rust/Cargo.lock +--- firefox-55.0/toolkit/library/rust/Cargo.lock.cubeb-pulse-arm 2017-08-04 13:37:46.388821725 +0200 ++++ firefox-55.0/toolkit/library/rust/Cargo.lock 2017-08-04 13:52:24.551163669 +0200 +@@ -250,6 +250,7 @@ name = "cubeb-pulse" + version = "0.0.1" + dependencies = [ + "cubeb-ffi 0.0.1", ++ "pulse 0.1.0", + "pulse-ffi 0.1.0", + "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + ] +@@ -647,6 +648,14 @@ version = "0.1.1" + source = "registry+https://github.com/rust-lang/crates.io-index" + + [[package]] ++name = "pulse" ++version = "0.1.0" ++dependencies = [ ++ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ++ "pulse-ffi 0.1.0", ++] ++ ++[[package]] + name = "pulse-ffi" + version = "0.1.0" + dependencies = [ diff --git a/build-disable-elfhack.patch b/build-disable-elfhack.patch new file mode 100644 index 0000000..a80c551 --- /dev/null +++ b/build-disable-elfhack.patch @@ -0,0 +1,12 @@ +diff -up firefox-65.0/toolkit/moz.configure.disable-elfhack firefox-65.0/toolkit/moz.configure +--- firefox-65.0/toolkit/moz.configure.disable-elfhack 2019-01-28 14:16:48.530345132 +0100 ++++ firefox-65.0/toolkit/moz.configure 2019-01-28 14:18:03.231029682 +0100 +@@ -1036,7 +1036,7 @@ with only_when('--enable-compile-environ + help='{Enable|Disable} elf hacks') + + set_config('USE_ELF_HACK', +- depends_if('--enable-elf-hack')(lambda _: True)) ++ depends_if('--enable-elf-hack')(lambda _: False)) + + + @depends(check_build_environment) diff --git a/build-ppc-jit.patch b/build-ppc-jit.patch new file mode 100644 index 0000000..a9dc6d1 --- /dev/null +++ b/build-ppc-jit.patch @@ -0,0 +1,51 @@ +diff -up firefox-55.0/js/src/jit/MIR.h.old firefox-55.0/js/src/jit/MIR.h +--- firefox-55.0/js/src/jit/MIR.h.old 2017-08-08 14:04:44.528460099 +0200 ++++ firefox-55.0/js/src/jit/MIR.h 2017-08-08 14:05:11.045364831 +0200 +@@ -12434,7 +12434,7 @@ class MNearbyInt + TRIVIAL_NEW_WRAPPERS + + static bool HasAssemblerSupport(RoundingMode mode) { +- return Assembler::HasRoundInstruction(mode); ++ return false; + } + + RoundingMode roundingMode() const { return roundingMode_; } +diff -up firefox-55.0/js/src/jit/ExecutableAllocator.h.old firefox-55.0/js/src/jit/ExecutableAllocator.h +--- firefox-55.0/js/src/jit/ExecutableAllocator.h.old 2017-08-09 09:24:18.784983505 +0200 ++++ firefox-55.0/js/src/jit/ExecutableAllocator.h 2017-08-09 09:28:01.471100075 +0200 +@@ -307,6 +307,10 @@ class ExecutableAllocator + { + sync_instruction_memory((caddr_t)code, size); + } ++#else ++ static void cacheFlush(void*, size_t) ++ { ++ } + #endif + + private: +diff -up firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old firefox-55.0/js/src/wasm/WasmBuiltins.cpp +--- firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old 2017-08-09 12:50:46.877450765 +0200 ++++ firefox-55.0/js/src/wasm/WasmBuiltins.cpp 2017-08-09 12:50:59.725406974 +0200 +@@ -881,7 +881,6 @@ wasm::EnsureBuiltinThunksInitialized() + MOZ_ASSERT(!masm.numSymbolicAccesses()); + #endif + +- ExecutableAllocator::cacheFlush(thunks->codeBase, thunks->codeSize); + if (!ExecutableAllocator::makeExecutable(thunks->codeBase, thunks->codeSize)) + return false; + +diff -up firefox-55.0/js/src/wasm/WasmCode.cpp.old firefox-55.0/js/src/wasm/WasmCode.cpp +--- firefox-55.0/js/src/wasm/WasmCode.cpp.old 2017-08-09 12:50:37.205483731 +0200 ++++ firefox-55.0/js/src/wasm/WasmCode.cpp 2017-08-09 12:51:10.365370708 +0200 +@@ -287,8 +287,6 @@ CodeSegment::initialize(Tier tier, + if (!StaticallyLink(*this, linkData)) + return false; + +- ExecutableAllocator::cacheFlush(bytes_.get(), RoundupCodeLength(codeLength)); +- + // Reprotect the whole region to avoid having separate RW and RX mappings. + if (!ExecutableAllocator::makeExecutable(bytes_.get(), RoundupCodeLength(codeLength))) + return false; +diff -up firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-55.0/media/webrtc/trunk/Makefile.old firefox-55.0/media/webrtc/trunk/Makefile diff --git a/build-rust-ppc64le.patch b/build-rust-ppc64le.patch new file mode 100644 index 0000000..2474c35 --- /dev/null +++ b/build-rust-ppc64le.patch @@ -0,0 +1,25 @@ +diff -up firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le firefox-55.0/build/moz.configure/rust.configure +--- firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le 2017-07-31 18:20:49.000000000 +0200 ++++ firefox-55.0/build/moz.configure/rust.configure 2017-08-02 10:19:03.254220003 +0200 +@@ -151,6 +151,9 @@ def rust_triple_alias(host_or_target): + ('sparc64', 'Linux'): 'sparc64-unknown-linux-gnu', + ('x86', 'Linux'): 'i686-unknown-linux-gnu', + ('x86_64', 'Linux'): 'x86_64-unknown-linux-gnu', ++ ('ppc64le', 'Linux'): 'powerpc64le-unknown-linux-gnu', ++ ('ppc64', 'Linux'): 'powerpc64-unknown-linux-gnu', ++ ('s390x', 'Linux'): 's390x-unknown-linux-gnu', + # OS X + ('x86', 'OSX'): 'i686-apple-darwin', + ('x86_64', 'OSX'): 'x86_64-apple-darwin', +@@ -174,8 +177,10 @@ def rust_triple_alias(host_or_target): + ('sparc64', 'SunOS'): 'sparcv9-sun-solaris', + }.get((host_or_target.cpu, os_or_kernel), None) + ++ if (rustc_target == 'powerpc64-unknown-linux-gnu' and host_or_target.endianness == 'little'): ++ rustc_target = 'powerpc64le-unknown-linux-gnu' + if rustc_target is None: +- die("Don't know how to translate {} for rustc".format(host_or_target.alias)) ++ die("Don't know how to translate {} for rustc, cpu: {}, os: {}".format(target.alias, target.cpu, os_or_kernel)) + + # Check to see whether our rustc has a reasonably functional stdlib + # for our chosen target. diff --git a/disable-openh264-download.patch b/disable-openh264-download.patch new file mode 100644 index 0000000..028b730 --- /dev/null +++ b/disable-openh264-download.patch @@ -0,0 +1,39 @@ +diff -up firefox-81.0/toolkit/modules/GMPInstallManager.jsm.old firefox-81.0/toolkit/modules/GMPInstallManager.jsm +--- firefox-81.0/toolkit/modules/GMPInstallManager.jsm.old 2020-09-25 10:39:04.769458703 +0200 ++++ firefox-81.0/toolkit/modules/GMPInstallManager.jsm 2020-09-25 10:39:22.038504747 +0200 +@@ -54,10 +54,6 @@ function getScopedLogger(prefix) { + + const LOCAL_GMP_SOURCES = [ + { +- id: "gmp-gmpopenh264", +- src: "chrome://global/content/gmp-sources/openh264.json", +- }, +- { + id: "gmp-widevinecdm", + src: "chrome://global/content/gmp-sources/widevinecdm.json", + }, +diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn +--- a/toolkit/content/jar.mn ++++ b/toolkit/content/jar.mn +@@ -108,7 +108,6 @@ toolkit.jar: + #ifdef XP_MACOSX + content/global/macWindowMenu.js + #endif +- content/global/gmp-sources/openh264.json (gmp-sources/openh264.json) + content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json) + + # Third party files +diff --git a/toolkit/modules/GMPInstallManager.jsm b/toolkit/modules/GMPInstallManager.jsm +--- a/toolkit/modules/GMPInstallManager.jsm ++++ b/toolkit/modules/GMPInstallManager.jsm +@@ -238,6 +234,9 @@ GMPInstallManager.prototype = { + * downloaderr, verifyerr or previouserrorencountered + */ + installAddon(gmpAddon) { ++ if (gmpAddon.isOpenH264) { ++ return Promise.reject({ type: "disabled" }); ++ } + if (this._deferred) { + let log = getScopedLogger("GMPInstallManager.installAddon"); + log.error("previous error encountered"); + diff --git a/distribution.ini b/distribution.ini new file mode 100644 index 0000000..11f1f96 --- /dev/null +++ b/distribution.ini @@ -0,0 +1,9 @@ +[Global] +id=fedora +version=1.0 +about=Mozilla Firefox for Fedora + +[Preferences] +app.distributor=fedora +app.distributor.channel=fedora +app.partner.fedora=fedora diff --git a/fedora-build.patch b/fedora-build.patch new file mode 100644 index 0000000..74127ec --- /dev/null +++ b/fedora-build.patch @@ -0,0 +1,23 @@ +diff -up firefox-54.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-54.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium +diff -up firefox-54.0/media/mtransport/third_party/nICEr/nicer.gyp.old firefox-54.0/media/mtransport/third_party/nICEr/nicer.gyp +--- firefox-54.0/media/mtransport/third_party/nICEr/nicer.gyp.old 2017-06-08 14:59:08.786996664 +0200 ++++ firefox-54.0/media/mtransport/third_party/nICEr/nicer.gyp 2017-06-08 14:59:22.642946570 +0200 +@@ -211,7 +211,6 @@ + '-Wno-parentheses', + '-Wno-strict-prototypes', + '-Wmissing-prototypes', +- '-Wno-format', + ], + 'defines' : [ + 'LINUX', +diff -up firefox-54.0/media/mtransport/third_party/nrappkit/nrappkit.gyp.build firefox-54.0/media/mtransport/third_party/nrappkit/nrappkit.gyp +--- firefox-54.0/media/mtransport/third_party/nrappkit/nrappkit.gyp.build 2017-06-08 15:08:03.627063097 +0200 ++++ firefox-54.0/media/mtransport/third_party/nrappkit/nrappkit.gyp 2017-06-08 15:08:15.657019606 +0200 +@@ -206,7 +206,6 @@ + '-Wno-parentheses', + '-Wno-strict-prototypes', + '-Wmissing-prototypes', +- '-Wno-format', + ], + 'defines' : [ + 'LINUX', diff --git a/fedora-shebang-build.patch b/fedora-shebang-build.patch new file mode 100644 index 0000000..9ade86c --- /dev/null +++ b/fedora-shebang-build.patch @@ -0,0 +1,9 @@ +diff -up firefox-73.0/build/unix/run-mozilla.sh.old firefox-73.0/build/unix/run-mozilla.sh +--- firefox-73.0/build/unix/run-mozilla.sh.old 2020-02-12 09:58:00.150895904 +0100 ++++ firefox-73.0/build/unix/run-mozilla.sh 2020-02-12 09:58:06.505860696 +0100 +@@ -1,4 +1,4 @@ +-#!/bin/sh ++#!/usr/bin/sh + # + # This Source Code Form is subject to the terms of the Mozilla Public + # License, v. 2.0. If a copy of the MPL was not distributed with this diff --git a/firefox-disable-ffvpx-with-vapi.patch b/firefox-disable-ffvpx-with-vapi.patch new file mode 100644 index 0000000..dfe6dd8 --- /dev/null +++ b/firefox-disable-ffvpx-with-vapi.patch @@ -0,0 +1,29 @@ +diff -up firefox-81.0/dom/media/platforms/PDMFactory.cpp.firefox-disable-ffvpx-with-vapi firefox-81.0/dom/media/platforms/PDMFactory.cpp +--- firefox-81.0/dom/media/platforms/PDMFactory.cpp.firefox-disable-ffvpx-with-vapi 2020-09-17 02:32:43.000000000 +0200 ++++ firefox-81.0/dom/media/platforms/PDMFactory.cpp 2020-09-21 10:30:29.393903183 +0200 +@@ -371,12 +371,6 @@ void PDMFactory::CreatePDMs() { + StartupPDM(m); + } + #endif +-#ifdef MOZ_FFVPX +- if (StaticPrefs::media_ffvpx_enabled()) { +- m = FFVPXRuntimeLinker::CreateDecoderModule(); +- StartupPDM(m); +- } +-#endif + #ifdef MOZ_FFMPEG + if (StaticPrefs::media_ffmpeg_enabled()) { + m = FFmpegRuntimeLinker::CreateDecoderModule(); +@@ -385,6 +379,12 @@ void PDMFactory::CreatePDMs() { + mFFmpegFailedToLoad = false; + } + #endif ++#ifdef MOZ_FFVPX ++ if (StaticPrefs::media_ffvpx_enabled()) { ++ m = FFVPXRuntimeLinker::CreateDecoderModule(); ++ StartupPDM(m); ++ } ++#endif + #ifdef MOZ_WIDGET_ANDROID + if (StaticPrefs::media_android_media_codec_enabled()) { + m = new AndroidDecoderModule(); diff --git a/firefox-enable-addons.patch b/firefox-enable-addons.patch new file mode 100644 index 0000000..15d0707 --- /dev/null +++ b/firefox-enable-addons.patch @@ -0,0 +1,13 @@ +diff -up firefox-55.0/browser/app/profile/firefox.js.addons firefox-55.0/browser/app/profile/firefox.js +--- firefox-55.0/browser/app/profile/firefox.js.addons 2017-08-02 10:58:30.566363833 +0200 ++++ firefox-55.0/browser/app/profile/firefox.js 2017-08-02 10:59:15.377216959 +0200 +@@ -65,7 +65,8 @@ pref("extensions.systemAddon.update.url" + + // Disable add-ons that are not installed by the user in all scopes by default. + // See the SCOPE constants in AddonManager.jsm for values to use here. +-pref("extensions.autoDisableScopes", 15); ++pref("extensions.autoDisableScopes", 0); ++pref("extensions.showMismatchUI", false); + // Scopes to scan for changes at startup. + pref("extensions.startupScanScopes", 0); + diff --git a/firefox-fedora-ua.patch b/firefox-fedora-ua.patch new file mode 100644 index 0000000..7f1f554 --- /dev/null +++ b/firefox-fedora-ua.patch @@ -0,0 +1,19 @@ +diff -up firefox-65.0/netwerk/protocol/http/nsHttpHandler.cpp.fedora-ua firefox-65.0/netwerk/protocol/http/nsHttpHandler.cpp +--- firefox-65.0/netwerk/protocol/http/nsHttpHandler.cpp.fedora-ua 2019-01-28 14:28:35.806375063 +0100 ++++ firefox-65.0/netwerk/protocol/http/nsHttpHandler.cpp 2019-01-28 14:30:25.886917219 +0100 +@@ -873,6 +873,7 @@ void nsHttpHandler::BuildUserAgent() { + mUserAgent.SetCapacity(mLegacyAppName.Length() + mLegacyAppVersion.Length() + + #ifndef UA_SPARE_PLATFORM + mPlatform.Length() + ++ mPlatform.Length() + 8 + + #endif + mOscpu.Length() + mMisc.Length() + mProduct.Length() + + mProductSub.Length() + mAppName.Length() + +@@ -891,6 +892,7 @@ void nsHttpHandler::BuildUserAgent() { + if (!mPlatform.IsEmpty()) { + mUserAgent += mPlatform; + mUserAgent.AppendLiteral("; "); ++ mUserAgent.AppendLiteral("Fedora; "); + } + #endif + if (!mCompatDevice.IsEmpty()) { diff --git a/firefox-gcc-build.patch b/firefox-gcc-build.patch new file mode 100644 index 0000000..55017ad --- /dev/null +++ b/firefox-gcc-build.patch @@ -0,0 +1,38 @@ +--- firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-08-31 10:04:19.000000000 -0400 ++++ firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-09-12 07:24:35.298931628 -0400 +@@ -1962,7 +1962,7 @@ struct kernel_statfs { + LSS_ENTRYPOINT \ + "pop %%ebx" \ + args \ +- : "esp", "memory"); \ ++ : "memory"); \ + LSS_RETURN(type,__res) + #undef _syscall0 + #define _syscall0(type,name) \ +@@ -2019,7 +2019,7 @@ struct kernel_statfs { + : "i" (__NR_##name), "ri" ((long)(arg1)), \ + "c" ((long)(arg2)), "d" ((long)(arg3)), \ + "S" ((long)(arg4)), "D" ((long)(arg5)) \ +- : "esp", "memory"); \ ++ : "memory"); \ + LSS_RETURN(type,__res); \ + } + #undef _syscall6 +@@ -2041,7 +2041,7 @@ struct kernel_statfs { + : "i" (__NR_##name), "0" ((long)(&__s)), \ + "c" ((long)(arg2)), "d" ((long)(arg3)), \ + "S" ((long)(arg4)), "D" ((long)(arg5)) \ +- : "esp", "memory"); \ ++ : "memory"); \ + LSS_RETURN(type,__res); \ + } + LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, +@@ -2127,7 +2127,7 @@ struct kernel_statfs { + : "0"(-EINVAL), "i"(__NR_clone), + "m"(fn), "m"(child_stack), "m"(flags), "m"(arg), + "m"(parent_tidptr), "m"(newtls), "m"(child_tidptr) +- : "esp", "memory", "ecx", "edx", "esi", "edi"); ++ : "memory", "ecx", "edx", "esi", "edi"); + LSS_RETURN(int, __res); + } + diff --git a/firefox-locale-debug.patch b/firefox-locale-debug.patch new file mode 100644 index 0000000..35de02f --- /dev/null +++ b/firefox-locale-debug.patch @@ -0,0 +1,12 @@ +diff -up firefox-75.0/intl/locale/LocaleService.cpp.locale-debug firefox-75.0/intl/locale/LocaleService.cpp +--- firefox-75.0/intl/locale/LocaleService.cpp.locale-debug 2020-04-06 22:42:20.196799809 +0200 ++++ firefox-75.0/intl/locale/LocaleService.cpp 2020-04-06 22:43:02.522530317 +0200 +@@ -372,8 +372,6 @@ LocaleService::GetDefaultLocale(nsACStri + // just use our hard-coded default below. + GetGREFileContents("update.locale", &locale); + locale.Trim(" \t\n\r"); +- // This should never be empty. +- MOZ_ASSERT(!locale.IsEmpty()); + if (CanonicalizeLanguageId(locale)) { + mDefaultLocale.Assign(locale); + } diff --git a/firefox-mozconfig b/firefox-mozconfig new file mode 100644 index 0000000..5d2ef9d --- /dev/null +++ b/firefox-mozconfig @@ -0,0 +1,24 @@ +. $topsrcdir/browser/config/mozconfig + +ac_add_options --with-system-zlib +ac_add_options --disable-strip +#ac_add_options --enable-libnotify +ac_add_options --enable-necko-wifi +ac_add_options --disable-updater +ac_add_options --enable-chrome-format=omni +ac_add_options --enable-pulseaudio +ac_add_options --enable-av1 +ac_add_options --without-system-icu +ac_add_options --enable-release +ac_add_options --update-channel=release +# Workaround for mozbz#1341234 +ac_add_options BINDGEN_CFLAGS="$(pkg-config nspr pixman-1 --cflags)" +ac_add_options --allow-addon-sideload +ac_add_options --with-system-fdk-aac + +export BUILD_OFFICIAL=1 +export MOZILLA_OFFICIAL=1 +export MOZ_TELEMETRY_REPORTING=1 +mk_add_options BUILD_OFFICIAL=1 +mk_add_options MOZILLA_OFFICIAL=1 +mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir diff --git a/firefox-nss-version.patch b/firefox-nss-version.patch new file mode 100644 index 0000000..fee93bb --- /dev/null +++ b/firefox-nss-version.patch @@ -0,0 +1,12 @@ +diff -up firefox-78.0/toolkit/moz.configure.nss-version firefox-78.0/toolkit/moz.configure +--- firefox-78.0/toolkit/moz.configure.nss-version 2020-06-30 08:47:09.657501414 +0200 ++++ firefox-78.0/toolkit/moz.configure 2020-06-30 08:47:12.652510169 +0200 +@@ -2089,7 +2089,7 @@ option('--with-system-nss', help='Use sy + + imply_option('--with-system-nspr', True, when='--with-system-nss') + +-nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.1', when='--with-system-nss', config=False) ++nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.0', when='--with-system-nss', config=False) + + set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss') + diff --git a/firefox-pipewire-0-2.patch b/firefox-pipewire-0-2.patch new file mode 100644 index 0000000..b1c6950 --- /dev/null +++ b/firefox-pipewire-0-2.patch @@ -0,0 +1,526 @@ +diff -up firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-2 firefox-79.0/config/system-headers.mozbuild +--- firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-2 2020-07-21 00:49:36.000000000 +0200 ++++ firefox-79.0/config/system-headers.mozbuild 2020-07-29 11:03:51.455284187 +0200 +@@ -314,6 +314,7 @@ system_headers = [ + 'Gestalt.h', + 'getopt.h', + 'gio/gio.h', ++ 'gio/gunixfdlist.h', + 'glibconfig.h', + 'glib.h', + 'glib-object.h', +@@ -607,6 +608,7 @@ system_headers = [ + 'Pgenerr.h', + 'PGenErr.h', + 'Ph.h', ++ 'pipewire/pipewire.h', + 'pixman.h', + 'pk11func.h', + 'pk11pqg.h', +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-2 2020-07-29 11:03:51.455284187 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-07-29 11:04:40.898017241 +0200 +@@ -231,6 +231,27 @@ if CONFIG["OS_TARGET"] == "OpenBSD": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" + ] + ++# PipeWire specific files ++if CONFIG["OS_TARGET"] == "Linux": ++ ++ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1" ++ ++ OS_LIBS += [ ++ "rt", ++ "pipewire-0.2", ++ "glib-2.0", ++ "gio-2.0", ++ "gobject-2.0" ++ ] ++ ++ CXXFLAGS += CONFIG['TK_CFLAGS'] ++ ++ UNIFIED_SOURCES += [ ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc" ++ ] ++ + if CONFIG["OS_TARGET"] == "WINNT": + + DEFINES["CERT_CHAIN_PARA_HAS_EXTRA_FIELDS"] = True +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-2 2020-07-20 22:54:16.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-07-29 11:03:51.456284181 +0200 +@@ -141,7 +141,7 @@ class DesktopCaptureOptions { + bool disable_effects_ = true; + bool detect_updated_region_ = false; + #if defined(WEBRTC_USE_PIPEWIRE) +- bool allow_pipewire_ = false; ++ bool allow_pipewire_ = true; + #endif + }; + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:54:27.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-07-29 11:03:51.618283306 +0200 +@@ -18,6 +18,11 @@ + #include + #include + ++#include ++#include ++#include ++#include ++ + #include + #include + +@@ -36,6 +41,27 @@ const char kSessionInterfaceName[] = "or + const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; + const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; + ++ ++// static ++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { ++ struct dma_buf_sync sync = { 0 }; ++ ++ sync.flags = start_or_end | DMA_BUF_SYNC_READ; ++ ++ while(true) { ++ int ret; ++ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); ++ if (ret == -1 && errno == EINTR) { ++ continue; ++ } else if (ret == -1) { ++ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); ++ break; ++ } else { ++ break; ++ } ++ } ++} ++ + // static + void BaseCapturerPipeWire::OnStateChanged(void* data, + pw_remote_state old_state, +@@ -108,11 +134,13 @@ void BaseCapturerPipeWire::OnStreamForma + auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4); + auto size = height * stride; + ++ that->desktop_size_ = DesktopSize(width, height); ++ + uint8_t buffer[1024] = {}; + auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + + // Setup buffers and meta header for new format. +- const struct spa_pod* params[2]; ++ const struct spa_pod* params[3]; + params[0] = reinterpret_cast(spa_pod_builder_object( + &builder, + // id to enumerate buffer requirements +@@ -141,8 +169,14 @@ void BaseCapturerPipeWire::OnStreamForma + // Size: size of the metadata, specified as integer (i) + ":", that->pw_core_type_->param_meta.size, "i", + sizeof(struct spa_meta_header))); +- +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); ++ params[2] = reinterpret_cast( ++ spa_pod_builder_object(&builder, that->pw_core_type_->param.idMeta, ++ that->pw_core_type_->param_meta.Meta, ":", ++ that->pw_core_type_->param_meta.type, "I", ++ that->pw_core_type_->meta.VideoCrop, ":", ++ that->pw_core_type_->param_meta.size, "i", ++ sizeof(struct spa_meta_video_crop))); ++ pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/3); + } + + // static +@@ -150,15 +184,25 @@ void BaseCapturerPipeWire::OnStreamProce + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- pw_buffer* buf = nullptr; ++ struct pw_buffer *next_buffer; ++ struct pw_buffer *buffer = nullptr; + +- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ while (next_buffer) { ++ buffer = next_buffer; ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ ++ if (next_buffer) ++ pw_stream_queue_buffer (that->pw_stream_, buffer); ++ } ++ ++ if (!buffer) { + return; + } + +- that->HandleBuffer(buf); ++ that->HandleBuffer(buffer); + +- pw_stream_queue_buffer(that->pw_stream_, buf); ++ pw_stream_queue_buffer(that->pw_stream_, buffer); + } + + BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) +@@ -197,10 +241,6 @@ BaseCapturerPipeWire::~BaseCapturerPipeW + pw_loop_destroy(pw_loop_); + } + +- if (current_frame_) { +- free(current_frame_); +- } +- + if (start_request_signal_id_) { + g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); + } +@@ -290,12 +330,7 @@ void BaseCapturerPipeWire::InitPipeWireT + + void BaseCapturerPipeWire::CreateReceivingStream() { + spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; +- spa_rectangle pwScreenBounds = +- spa_rectangle{static_cast(desktop_size_.width()), +- static_cast(desktop_size_.height())}; +- +- spa_fraction pwFrameRateMin = spa_fraction{0, 1}; +- spa_fraction pwFrameRateMax = spa_fraction{60, 1}; ++ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; + + pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", + /*end of varargs*/ nullptr); +@@ -313,27 +348,19 @@ void BaseCapturerPipeWire::CreateReceivi + // then allowed formats are enumerated (e) and the format is undecided (u) + // to allow negotiation + ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, +- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, +- pw_type_->video_format.BGRx), ++ SPA_POD_PROP_ENUM( ++ 4, pw_type_->video_format.RGBx, pw_type_->video_format.BGRx, ++ pw_type_->video_format.RGBA, pw_type_->video_format.BGRA), + // Video size: specified as rectangle (R), preferred size is specified as + // first parameter, then allowed size is defined as range (r) from min and + // max values and the format is undecided (u) to allow negotiation +- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, +- &pwMinScreenBounds, &pwScreenBounds, +- // Frame rate: specified as fraction (F) and set to minimum frame rate +- // value +- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, +- // Max frame rate: specified as fraction (F), preferred frame rate is set +- // to maximum value, then allowed frame rate is defined as range (r) from +- // min and max values and it is undecided (u) to allow negotiation +- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, +- &pwFrameRateMin, &pwFrameRateMax)); ++ ":", pw_type_->format_video.size, "Rru", &pwMinScreenBounds, ++ SPA_POD_PROP_MIN_MAX(&pwMinScreenBounds, &pwMaxScreenBounds))); + + pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, + this); + pw_stream_flags flags = static_cast( +- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | +- PW_STREAM_FLAG_MAP_BUFFERS); ++ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE); + if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, + flags, params, + /*n_params=*/1) != 0) { +@@ -344,15 +371,81 @@ void BaseCapturerPipeWire::CreateReceivi + } + + void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { ++ struct spa_meta_video_crop* video_crop; + spa_buffer* spaBuffer = buffer->buffer; +- void* src = nullptr; ++ uint8_t *map = nullptr; ++ uint8_t* src = nullptr; ++ uint8_t* dst = nullptr; ++ ++ if (spaBuffer->datas[0].chunk->size == 0) { ++ map = nullptr; ++ src = nullptr; ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemFd) { ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)); ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) { ++ int fd; ++ fd = spaBuffer->datas[0].fd; ++ ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, fd, 0)); ++ SyncDmaBuf(fd, DMA_BUF_SYNC_START); ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == pw_core_type_->data.MemPtr) { ++ map = nullptr; ++ src = static_cast(spaBuffer->datas[0].data); ++ } else { ++ return; ++ } + +- if (!(src = spaBuffer->datas[0].data)) { ++ if (!src) { + return; + } + +- uint32_t maxSize = spaBuffer->datas[0].maxsize; +- int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ DesktopSize prev_crop_size = DesktopSize(0, 0); ++ if (video_crop_size_initialized_) { ++ prev_crop_size = video_crop_size_; ++ } ++ ++ if ((video_crop = static_cast( ++ spa_buffer_find_meta(spaBuffer, pw_core_type_->meta.VideoCrop)))) { ++ RTC_DCHECK(video_crop->width <= desktop_size_.width() && ++ video_crop->height <= desktop_size_.height()); ++ if ((video_crop->width != desktop_size_.width() || ++ video_crop->height != desktop_size_.height()) && video_crop->width && video_crop->height) { ++ video_crop_size_ = DesktopSize(video_crop->width, video_crop->height); ++ video_crop_size_initialized_ = true; ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ ++ size_t frame_size; ++ if (video_crop_size_initialized_) { ++ frame_size = ++ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel; ++ } else { ++ frame_size = ++ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel; ++ } ++ ++ if (!current_frame_ || ++ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) { ++ current_frame_ = std::make_unique(frame_size); ++ } ++ RTC_DCHECK(current_frame_ != nullptr); ++ ++ const int32_t dstStride = video_crop_size_initialized_ ++ ? video_crop_size_.width() * kBytesPerPixel ++ : desktop_size_.width() * kBytesPerPixel; ++ const int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ + if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { + RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " + << srcStride +@@ -361,21 +454,39 @@ void BaseCapturerPipeWire::HandleBuffer( + return; + } + +- if (!current_frame_) { +- current_frame_ = static_cast(malloc(maxSize)); ++ dst = current_frame_.get(); ++ ++ // Adjust source content based on crop video position ++ if (video_crop_size_initialized_ && ++ (video_crop->y + video_crop_size_.height() <= desktop_size_.height())) { ++ for (int i = 0; i < video_crop->y; ++i) { ++ src += srcStride; ++ } ++ } ++ const int xOffset = ++ video_crop_size_initialized_ && (video_crop->x + video_crop_size_.width() <= ++ desktop_size_.width()) ++ ? video_crop->x * kBytesPerPixel ++ : 0; ++ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height(); ++ for (int i = 0; i < height; ++i) { ++ // Adjust source content based on crop video position if needed ++ src += xOffset; ++ std::memcpy(dst, src, dstStride); ++ // If both sides decided to go with the RGBx format we need to convert it to ++ // BGRx to match color format expected by WebRTC. ++ if (spa_video_format_->format == pw_type_->video_format.RGBx) { ++ ConvertRGBxToBGRx(dst, dstStride); ++ } ++ src += srcStride - xOffset; ++ dst += dstStride; + } +- RTC_DCHECK(current_frame_ != nullptr); + +- // If both sides decided to go with the RGBx format we need to convert it to +- // BGRx to match color format expected by WebRTC. +- if (spa_video_format_->format == pw_type_->video_format.RGBx) { +- uint8_t* tempFrame = static_cast(malloc(maxSize)); +- std::memcpy(tempFrame, src, maxSize); +- ConvertRGBxToBGRx(tempFrame, maxSize); +- std::memcpy(current_frame_, tempFrame, maxSize); +- free(tempFrame); +- } else { +- std::memcpy(current_frame_, src, maxSize); ++ if (map) { ++ if (spaBuffer->datas[0].type == pw_core_type_->data.DmaBuf) { ++ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); ++ } ++ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset); + } + } + +@@ -725,10 +836,6 @@ void BaseCapturerPipeWire::OnStartReques + g_variant_get(variant, "(u@a{sv})", &stream_id, &options); + RTC_DCHECK(options != nullptr); + +- g_variant_lookup(options, "size", "(ii)", &width, &height); +- +- that->desktop_size_.set(width, height); +- + g_variant_unref(options); + g_variant_unref(variant); + } +@@ -813,10 +920,15 @@ void BaseCapturerPipeWire::CaptureFrame( + return; + } + +- std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); ++ DesktopSize frame_size = desktop_size_; ++ if (video_crop_size_initialized_) { ++ frame_size = video_crop_size_; ++ } ++ ++ std::unique_ptr result(new BasicDesktopFrame(frame_size)); + result->CopyPixelsFrom( +- current_frame_, (desktop_size_.width() * kBytesPerPixel), +- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); ++ current_frame_.get(), (frame_size.width() * kBytesPerPixel), ++ DesktopRect::MakeWH(frame_size.width(), frame_size.height())); + if (!result) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); + return; +@@ -837,4 +949,22 @@ bool BaseCapturerPipeWire::SelectSource( + return true; + } + ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options) { ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer);} ++ ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options) { ++ ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer); ++} ++ + } // namespace webrtc +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-2 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-07-29 11:03:51.619283301 +0200 +@@ -32,7 +32,11 @@ class PipeWireType { + + class BaseCapturerPipeWire : public DesktopCapturer { + public: +- enum CaptureSourceType { Screen = 1, Window }; ++ enum CaptureSourceType : uint32_t { ++ kScreen = 0b01, ++ kWindow = 0b10, ++ kAny = 0b11 ++ }; + + explicit BaseCapturerPipeWire(CaptureSourceType source_type); + ~BaseCapturerPipeWire() override; +@@ -43,6 +47,12 @@ class BaseCapturerPipeWire : public Desk + bool GetSourceList(SourceList* sources) override; + bool SelectSource(SourceId id) override; + ++ static std::unique_ptr CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options); ++ ++ static std::unique_ptr CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options); ++ + private: + // PipeWire types --> + pw_core* pw_core_ = nullptr; +@@ -64,7 +74,7 @@ class BaseCapturerPipeWire : public Desk + gint32 pw_fd_ = -1; + + CaptureSourceType capture_source_type_ = +- BaseCapturerPipeWire::CaptureSourceType::Screen; ++ BaseCapturerPipeWire::CaptureSourceType::kAny; + + // <-- end of PipeWire types + +@@ -78,10 +88,12 @@ class BaseCapturerPipeWire : public Desk + guint sources_request_signal_id_ = 0; + guint start_request_signal_id_ = 0; + ++ bool video_crop_size_initialized_ = false; ++ DesktopSize video_crop_size_;; + DesktopSize desktop_size_ = {}; + DesktopCaptureOptions options_ = {}; + +- uint8_t* current_frame_ = nullptr; ++ std::unique_ptr current_frame_; + Callback* callback_ = nullptr; + + bool portal_init_failed_ = false; +@@ -95,6 +107,7 @@ class BaseCapturerPipeWire : public Desk + + void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); + ++ static void SyncDmaBuf(int fd, uint64_t start_or_end); + static void OnStateChanged(void* data, + pw_remote_state old_state, + pw_remote_state state, +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:53:57.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-07-29 11:03:51.619283301 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + ScreenCapturerPipeWire::ScreenCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {} + ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-2 2020-07-20 22:54:18.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-07-29 11:03:51.619283301 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + WindowCapturerPipeWire::WindowCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {} + WindowCapturerPipeWire::~WindowCapturerPipeWire() {} + + // static +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-2 2020-07-20 22:54:40.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-07-29 11:03:51.620283296 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); ++ return BaseCapturerPipeWire::CreateRawScreenCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + +diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-2 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc +--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-2 2020-07-20 22:53:32.000000000 +0200 ++++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-07-29 11:03:51.620283296 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return WindowCapturerPipeWire::CreateRawWindowCapturer(options); ++ return BaseCapturerPipeWire::CreateRawWindowCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + diff --git a/firefox-pipewire-0-3.patch b/firefox-pipewire-0-3.patch new file mode 100644 index 0000000..8dc7eed --- /dev/null +++ b/firefox-pipewire-0-3.patch @@ -0,0 +1,834 @@ +diff -up firefox-81.0/config/system-headers.mozbuild.firefox-pipewire-0-3 firefox-81.0/config/system-headers.mozbuild +--- firefox-81.0/config/system-headers.mozbuild.firefox-pipewire-0-3 2020-09-15 03:48:26.000000000 +0200 ++++ firefox-81.0/config/system-headers.mozbuild 2020-09-15 14:40:00.721481417 +0200 +@@ -314,6 +314,7 @@ system_headers = [ + 'Gestalt.h', + 'getopt.h', + 'gio/gio.h', ++ 'gio/gunixfdlist.h', + 'glibconfig.h', + 'glib.h', + 'glib-object.h', +@@ -607,6 +608,7 @@ system_headers = [ + 'Pgenerr.h', + 'PGenErr.h', + 'Ph.h', ++ 'pipewire/pipewire.h', + 'pixman.h', + 'pk11func.h', + 'pk11pqg.h', +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn 2020-09-15 14:40:00.721481417 +0200 +@@ -158,7 +158,7 @@ if (rtc_include_tests) { + if (is_linux) { + if (rtc_use_pipewire) { + pkg_config("pipewire") { +- packages = [ "libpipewire-0.2" ] ++ packages = [ "libpipewire-0.3" ] + + defines = [ "WEBRTC_USE_PIPEWIRE" ] + } +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 2020-09-15 14:40:00.722481420 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-09-15 14:48:47.454733146 +0200 +@@ -193,6 +193,28 @@ if CONFIG["OS_TARGET"] == "Linux": + "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc" + ] + ++# PipeWire specific files ++if CONFIG["OS_TARGET"] == "Linux": ++ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1" ++ ++ OS_LIBS += [ ++ "rt", ++ "pipewire-0.3", ++ "glib-2.0", ++ "gio-2.0", ++ "gobject-2.0" ++ ] ++ ++ CXXFLAGS += CONFIG['TK_CFLAGS'] ++ CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ] ++ CXXFLAGS += [ "-I/usr/include/spa-0.2" ] ++ ++ UNIFIED_SOURCES += [ ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc", ++ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc" ++ ] ++ + if CONFIG["OS_TARGET"] == "NetBSD": + + DEFINES["USE_X11"] = "1" +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-09-15 14:40:00.722481420 +0200 +@@ -141,7 +141,7 @@ class DesktopCaptureOptions { + bool disable_effects_ = true; + bool detect_updated_region_ = false; + #if defined(WEBRTC_USE_PIPEWIRE) +- bool allow_pipewire_ = false; ++ bool allow_pipewire_ = true; + #endif + }; + +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-09-15 14:40:00.722481420 +0200 +@@ -15,8 +15,11 @@ + + #include + #include +-#include +-#include ++ ++#include ++#include ++#include ++#include + + #include + #include +@@ -36,32 +39,37 @@ const char kSessionInterfaceName[] = "or + const char kRequestInterfaceName[] = "org.freedesktop.portal.Request"; + const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast"; + ++ + // static +-void BaseCapturerPipeWire::OnStateChanged(void* data, +- pw_remote_state old_state, +- pw_remote_state state, +- const char* error_message) { +- BaseCapturerPipeWire* that = static_cast(data); +- RTC_DCHECK(that); ++void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) { ++ struct dma_buf_sync sync = { 0 }; + +- switch (state) { +- case PW_REMOTE_STATE_ERROR: +- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message; +- break; +- case PW_REMOTE_STATE_CONNECTED: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connected."; +- that->CreateReceivingStream(); +- break; +- case PW_REMOTE_STATE_CONNECTING: +- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting."; ++ sync.flags = start_or_end | DMA_BUF_SYNC_READ; ++ ++ while(true) { ++ int ret; ++ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync); ++ if (ret == -1 && errno == EINTR) { ++ continue; ++ } else if (ret == -1) { ++ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno); + break; +- case PW_REMOTE_STATE_UNCONNECTED: +- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected."; ++ } else { + break; ++ } + } + } + + // static ++void BaseCapturerPipeWire::OnCoreError(void *data, ++ uint32_t id, ++ int seq, ++ int res, ++ const char *message) { ++ RTC_LOG(LS_ERROR) << "core error: " << message; ++} ++ ++// static + void BaseCapturerPipeWire::OnStreamStateChanged(void* data, + pw_stream_state old_state, + pw_stream_state state, +@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamState + case PW_STREAM_STATE_ERROR: + RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message; + break; +- case PW_STREAM_STATE_CONFIGURE: +- pw_stream_set_active(that->pw_stream_, true); +- break; +- case PW_STREAM_STATE_UNCONNECTED: +- case PW_STREAM_STATE_CONNECTING: +- case PW_STREAM_STATE_READY: + case PW_STREAM_STATE_PAUSED: + case PW_STREAM_STATE_STREAMING: ++ case PW_STREAM_STATE_UNCONNECTED: ++ case PW_STREAM_STATE_CONNECTING: + break; + } + } + + // static +-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data, +- const struct spa_pod* format) { ++void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id, ++ const struct spa_pod *format) { + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- RTC_LOG(LS_INFO) << "PipeWire stream format changed."; ++ RTC_LOG(LS_INFO) << "PipeWire stream param changed."; + +- if (!format) { +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr, +- /*n_params=*/0); ++ if (!format || id != SPA_PARAM_Format) { + return; + } + +- that->spa_video_format_ = new spa_video_info_raw(); +- spa_format_video_raw_parse(format, that->spa_video_format_, +- &that->pw_type_->format_video); ++ spa_format_video_raw_parse(format, &that->spa_video_format_); + +- auto width = that->spa_video_format_->size.width; +- auto height = that->spa_video_format_->size.height; ++ auto width = that->spa_video_format_.size.width; ++ auto height = that->spa_video_format_.size.height; + auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4); + auto size = height * stride; + ++ that->desktop_size_ = DesktopSize(width, height); ++ + uint8_t buffer[1024] = {}; + auto builder = spa_pod_builder{buffer, sizeof(buffer)}; + + // Setup buffers and meta header for new format. +- const struct spa_pod* params[2]; +- params[0] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate buffer requirements +- that->pw_core_type_->param.idBuffers, +- that->pw_core_type_->param_buffers.Buffers, +- // Size: specified as integer (i) and set to specified size +- ":", that->pw_core_type_->param_buffers.size, "i", size, +- // Stride: specified as integer (i) and set to specified stride +- ":", that->pw_core_type_->param_buffers.stride, "i", stride, +- // Buffers: specifies how many buffers we want to deal with, set as +- // integer (i) where preferred number is 8, then allowed number is defined +- // as range (r) from min and max values and it is undecided (u) to allow +- // negotiation +- ":", that->pw_core_type_->param_buffers.buffers, "iru", 8, +- SPA_POD_PROP_MIN_MAX(1, 32), +- // Align: memory alignment of the buffer, set as integer (i) to specified +- // value +- ":", that->pw_core_type_->param_buffers.align, "i", 16)); +- params[1] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate supported metadata +- that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta, +- // Type: specified as id or enum (I) +- ":", that->pw_core_type_->param_meta.type, "I", +- that->pw_core_type_->meta.Header, +- // Size: size of the metadata, specified as integer (i) +- ":", that->pw_core_type_->param_meta.size, "i", +- sizeof(struct spa_meta_header))); +- +- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2); ++ const struct spa_pod* params[3]; ++ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, ++ SPA_PARAM_BUFFERS_size, SPA_POD_Int(size), ++ SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride), ++ SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32))); ++ params[1] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, ++ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header), ++ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)))); ++ params[2] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta, ++ SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop), ++ SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region)))); ++ pw_stream_update_params(that->pw_stream_, params, 3); + } + + // static +@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProce + BaseCapturerPipeWire* that = static_cast(data); + RTC_DCHECK(that); + +- pw_buffer* buf = nullptr; ++ struct pw_buffer *next_buffer; ++ struct pw_buffer *buffer = nullptr; ++ ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ while (next_buffer) { ++ buffer = next_buffer; ++ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_); ++ ++ if (next_buffer) ++ pw_stream_queue_buffer (that->pw_stream_, buffer); ++ } + +- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) { ++ if (!buffer) { + return; + } + +- that->HandleBuffer(buf); ++ that->HandleBuffer(buffer); + +- pw_stream_queue_buffer(that->pw_stream_, buf); ++ pw_stream_queue_buffer(that->pw_stream_, buffer); + } + + BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type) +@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeW + pw_thread_loop_stop(pw_main_loop_); + } + +- if (pw_type_) { +- delete pw_type_; +- } +- +- if (spa_video_format_) { +- delete spa_video_format_; +- } +- + if (pw_stream_) { + pw_stream_destroy(pw_stream_); + } + +- if (pw_remote_) { +- pw_remote_destroy(pw_remote_); ++ if (pw_core_) { ++ pw_core_disconnect(pw_core_); + } + +- if (pw_core_) { +- pw_core_destroy(pw_core_); ++ if (pw_context_) { ++ pw_context_destroy(pw_context_); + } + + if (pw_main_loop_) { + pw_thread_loop_destroy(pw_main_loop_); + } + +- if (pw_loop_) { +- pw_loop_destroy(pw_loop_); +- } +- +- if (current_frame_) { +- free(current_frame_); +- } +- + if (start_request_signal_id_) { + g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_); + } +@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal() + void BaseCapturerPipeWire::InitPipeWire() { + pw_init(/*argc=*/nullptr, /*argc=*/nullptr); + +- pw_loop_ = pw_loop_new(/*properties=*/nullptr); +- pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop"); +- +- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr); +- pw_core_type_ = pw_core_get_type(pw_core_); +- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0); ++ pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr); ++ pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0); ++ if (!pw_context_) { ++ RTC_LOG(LS_ERROR) << "Failed to create PipeWire context"; ++ return; ++ } + +- InitPipeWireTypes(); ++ pw_core_ = pw_context_connect(pw_context_, nullptr, 0); ++ if (!pw_core_) { ++ RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context"; ++ return; ++ } + + // Initialize event handlers, remote end and stream-related. +- pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS; +- pw_remote_events_.state_changed = &OnStateChanged; ++ pw_core_events_.version = PW_VERSION_CORE_EVENTS; ++ pw_core_events_.error = &OnCoreError; + + pw_stream_events_.version = PW_VERSION_STREAM_EVENTS; + pw_stream_events_.state_changed = &OnStreamStateChanged; +- pw_stream_events_.format_changed = &OnStreamFormatChanged; ++ pw_stream_events_.param_changed = &OnStreamParamChanged; + pw_stream_events_.process = &OnStreamProcess; + +- pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_, +- this); +- pw_remote_connect_fd(pw_remote_, pw_fd_); ++ pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this); ++ ++ pw_stream_ = CreateReceivingStream(); ++ if (!pw_stream_) { ++ RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream"; ++ return; ++ } + + if (pw_thread_loop_start(pw_main_loop_) < 0) { + RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop"; +@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire( + } + } + +-void BaseCapturerPipeWire::InitPipeWireTypes() { +- spa_type_map* map = pw_core_type_->map; +- pw_type_ = new PipeWireType(); ++pw_stream* BaseCapturerPipeWire::CreateReceivingStream() { ++ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; ++ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX}; + +- spa_type_media_type_map(map, &pw_type_->media_type); +- spa_type_media_subtype_map(map, &pw_type_->media_subtype); +- spa_type_format_video_map(map, &pw_type_->format_video); +- spa_type_video_format_map(map, &pw_type_->video_format); +-} ++ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr); + +-void BaseCapturerPipeWire::CreateReceivingStream() { +- spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1}; +- spa_rectangle pwScreenBounds = +- spa_rectangle{static_cast(desktop_size_.width()), +- static_cast(desktop_size_.height())}; +- +- spa_fraction pwFrameRateMin = spa_fraction{0, 1}; +- spa_fraction pwFrameRateMax = spa_fraction{60, 1}; +- +- pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1", +- /*end of varargs*/ nullptr); +- pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps); ++ if (!stream) { ++ RTC_LOG(LS_ERROR) << "Could not create receiving stream."; ++ return nullptr; ++ } + + uint8_t buffer[1024] = {}; +- const spa_pod* params[1]; +- spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)}; +- params[0] = reinterpret_cast(spa_pod_builder_object( +- &builder, +- // id to enumerate formats +- pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I", +- pw_type_->media_type.video, "I", pw_type_->media_subtype.raw, +- // Video format: specified as id or enum (I), preferred format is BGRx, +- // then allowed formats are enumerated (e) and the format is undecided (u) +- // to allow negotiation +- ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx, +- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx, +- pw_type_->video_format.BGRx), +- // Video size: specified as rectangle (R), preferred size is specified as +- // first parameter, then allowed size is defined as range (r) from min and +- // max values and the format is undecided (u) to allow negotiation +- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2, +- &pwMinScreenBounds, &pwScreenBounds, +- // Frame rate: specified as fraction (F) and set to minimum frame rate +- // value +- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin, +- // Max frame rate: specified as fraction (F), preferred frame rate is set +- // to maximum value, then allowed frame rate is defined as range (r) from +- // min and max values and it is undecided (u) to allow negotiation +- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2, +- &pwFrameRateMin, &pwFrameRateMax)); ++ const spa_pod* params[2]; ++ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer)); ++ ++ params[0] = reinterpret_cast(spa_pod_builder_add_object(&builder, ++ SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, ++ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video), ++ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), ++ SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA, ++ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA), ++ SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds, ++ &pwMinScreenBounds, ++ &pwMaxScreenBounds), ++ 0)); ++ pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this); + +- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_, +- this); + pw_stream_flags flags = static_cast( +- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE | +- PW_STREAM_FLAG_MAP_BUFFERS); +- if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr, +- flags, params, +- /*n_params=*/1) != 0) { ++ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE); ++ ++ if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) { + RTC_LOG(LS_ERROR) << "Could not connect receiving stream."; + portal_init_failed_ = true; +- return; + } ++ ++ return stream; + } + + void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) { ++ struct spa_meta_region* video_crop; + spa_buffer* spaBuffer = buffer->buffer; +- void* src = nullptr; ++ uint8_t *map = nullptr; ++ uint8_t* src = nullptr; ++ uint8_t* dst = nullptr; ++ ++ if (spaBuffer->datas[0].chunk->size == 0) { ++ map = nullptr; ++ src = nullptr; ++ } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) { ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0)); ++ ++ if (map == MAP_FAILED) { ++ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); ++ return; ++ } ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { ++ int fd; ++ fd = spaBuffer->datas[0].fd; ++ ++ map = static_cast(mmap( ++ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset, ++ PROT_READ, MAP_PRIVATE, fd, 0)); ++ ++ if (map == MAP_FAILED) { ++ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno); ++ return; ++ } + +- if (!(src = spaBuffer->datas[0].data)) { ++ SyncDmaBuf(fd, DMA_BUF_SYNC_START); ++ ++ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t); ++ } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) { ++ map = nullptr; ++ src = static_cast(spaBuffer->datas[0].data); ++ } else { + return; + } + +- uint32_t maxSize = spaBuffer->datas[0].maxsize; +- int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ if (!src) { ++ return; ++ } ++ ++ DesktopSize prev_crop_size = DesktopSize(0, 0); ++ if (video_crop_size_initialized_) { ++ prev_crop_size = video_crop_size_; ++ } ++ ++ if ((video_crop = static_cast( ++ spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) { ++ RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() && ++ video_crop->region.size.height <= desktop_size_.height()); ++ if ((video_crop->region.size.width != desktop_size_.width() || ++ video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) { ++ video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height); ++ video_crop_size_initialized_ = true; ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ } else { ++ video_crop_size_initialized_ = false; ++ } ++ ++ size_t frame_size; ++ if (video_crop_size_initialized_) { ++ frame_size = ++ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel; ++ } else { ++ frame_size = ++ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel; ++ } ++ ++ if (!current_frame_ || ++ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) { ++ current_frame_ = std::make_unique(frame_size); ++ } ++ RTC_DCHECK(current_frame_ != nullptr); ++ ++ const int32_t dstStride = video_crop_size_initialized_ ++ ? video_crop_size_.width() * kBytesPerPixel ++ : desktop_size_.width() * kBytesPerPixel; ++ const int32_t srcStride = spaBuffer->datas[0].chunk->stride; ++ + if (srcStride != (desktop_size_.width() * kBytesPerPixel)) { + RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: " + << srcStride +@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer( + return; + } + +- if (!current_frame_) { +- current_frame_ = static_cast(malloc(maxSize)); ++ dst = current_frame_.get(); ++ ++ // Adjust source content based on crop video position ++ if (video_crop_size_initialized_ && ++ (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) { ++ for (int i = 0; i < video_crop->region.position.y; ++i) { ++ src += srcStride; ++ } ++ } ++ const int xOffset = ++ video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <= ++ desktop_size_.width()) ++ ? video_crop->region.position.x * kBytesPerPixel ++ : 0; ++ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height(); ++ for (int i = 0; i < height; ++i) { ++ // Adjust source content based on crop video position if needed ++ src += xOffset; ++ std::memcpy(dst, src, dstStride); ++ // If both sides decided to go with the RGBx format we need to convert it to ++ // BGRx to match color format expected by WebRTC. ++ if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx || ++ spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) { ++ ConvertRGBxToBGRx(dst, dstStride); ++ } ++ src += srcStride - xOffset; ++ dst += dstStride; + } +- RTC_DCHECK(current_frame_ != nullptr); + +- // If both sides decided to go with the RGBx format we need to convert it to +- // BGRx to match color format expected by WebRTC. +- if (spa_video_format_->format == pw_type_->video_format.RGBx) { +- uint8_t* tempFrame = static_cast(malloc(maxSize)); +- std::memcpy(tempFrame, src, maxSize); +- ConvertRGBxToBGRx(tempFrame, maxSize); +- std::memcpy(current_frame_, tempFrame, maxSize); +- free(tempFrame); +- } else { +- std::memcpy(current_frame_, src, maxSize); ++ if (map) { ++ if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) { ++ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END); ++ } ++ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset); + } + } + +@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartReques + g_variant_get(variant, "(u@a{sv})", &stream_id, &options); + RTC_DCHECK(options != nullptr); + +- g_variant_lookup(options, "size", "(ii)", &width, &height); +- +- that->desktop_size_.set(width, height); +- ++ that->pw_stream_node_id_ = stream_id; + g_variant_unref(options); + g_variant_unref(variant); + } +@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame( + return; + } + +- std::unique_ptr result(new BasicDesktopFrame(desktop_size_)); ++ DesktopSize frame_size = desktop_size_; ++ if (video_crop_size_initialized_) { ++ frame_size = video_crop_size_; ++ } ++ ++ std::unique_ptr result(new BasicDesktopFrame(frame_size)); + result->CopyPixelsFrom( +- current_frame_, (desktop_size_.width() * kBytesPerPixel), +- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height())); ++ current_frame_.get(), (frame_size.width() * kBytesPerPixel), ++ DesktopRect::MakeWH(frame_size.width(), frame_size.height())); + if (!result) { + callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr); + return; +@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource( + return true; + } + ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options) { ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer);} ++ ++// static ++std::unique_ptr ++BaseCapturerPipeWire::CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options) { ++ ++ std::unique_ptr capturer = ++ std::make_unique(BaseCapturerPipeWire::CaptureSourceType::kAny); ++ return std::move(capturer); ++} ++ + } // namespace webrtc +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-09-15 14:40:00.722481420 +0200 +@@ -22,17 +22,13 @@ + + namespace webrtc { + +-class PipeWireType { +- public: +- spa_type_media_type media_type; +- spa_type_media_subtype media_subtype; +- spa_type_format_video format_video; +- spa_type_video_format video_format; +-}; +- + class BaseCapturerPipeWire : public DesktopCapturer { + public: +- enum CaptureSourceType { Screen = 1, Window }; ++ enum CaptureSourceType : uint32_t { ++ kScreen = 0b01, ++ kWindow = 0b10, ++ kAny = 0b11 ++ }; + + explicit BaseCapturerPipeWire(CaptureSourceType source_type); + ~BaseCapturerPipeWire() override; +@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public Desk + bool GetSourceList(SourceList* sources) override; + bool SelectSource(SourceId id) override; + ++ static std::unique_ptr CreateRawScreenCapturer( ++ const DesktopCaptureOptions& options); ++ ++ static std::unique_ptr CreateRawWindowCapturer( ++ const DesktopCaptureOptions& options); ++ + private: + // PipeWire types --> ++ pw_context* pw_context_ = nullptr; + pw_core* pw_core_ = nullptr; +- pw_type* pw_core_type_ = nullptr; + pw_stream* pw_stream_ = nullptr; +- pw_remote* pw_remote_ = nullptr; +- pw_loop* pw_loop_ = nullptr; + pw_thread_loop* pw_main_loop_ = nullptr; +- PipeWireType* pw_type_ = nullptr; + ++ spa_hook spa_core_listener_ = {}; + spa_hook spa_stream_listener_ = {}; +- spa_hook spa_remote_listener_ = {}; + ++ pw_core_events pw_core_events_ = {}; + pw_stream_events pw_stream_events_ = {}; +- pw_remote_events pw_remote_events_ = {}; + +- spa_video_info_raw* spa_video_format_ = nullptr; ++ struct spa_video_info_raw spa_video_format_; + ++ guint32 pw_stream_node_id_ = 0; + gint32 pw_fd_ = -1; + + CaptureSourceType capture_source_type_ = +- BaseCapturerPipeWire::CaptureSourceType::Screen; ++ BaseCapturerPipeWire::CaptureSourceType::kAny; + + // <-- end of PipeWire types + +@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public Desk + guint sources_request_signal_id_ = 0; + guint start_request_signal_id_ = 0; + ++ bool video_crop_size_initialized_ = false; ++ DesktopSize video_crop_size_;; + DesktopSize desktop_size_ = {}; + DesktopCaptureOptions options_ = {}; + +- uint8_t* current_frame_ = nullptr; ++ std::unique_ptr current_frame_; + Callback* callback_ = nullptr; + + bool portal_init_failed_ = false; + + void InitPortal(); + void InitPipeWire(); +- void InitPipeWireTypes(); + +- void CreateReceivingStream(); ++ pw_stream* CreateReceivingStream(); + void HandleBuffer(pw_buffer* buffer); + + void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size); + +- static void OnStateChanged(void* data, +- pw_remote_state old_state, +- pw_remote_state state, +- const char* error); ++ static void SyncDmaBuf(int fd, uint64_t start_or_end); ++ static void OnCoreError(void *data, ++ uint32_t id, ++ int seq, ++ int res, ++ const char *message); ++ static void OnStreamParamChanged(void *data, ++ uint32_t id, ++ const struct spa_pod *format); + static void OnStreamStateChanged(void* data, + pw_stream_state old_state, + pw_stream_state state, + const char* error_message); +- +- static void OnStreamFormatChanged(void* data, const struct spa_pod* format); + static void OnStreamProcess(void* data); + static void OnNewBuffer(void* data, uint32_t id); + +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-09-15 14:40:00.722481420 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + ScreenCapturerPipeWire::ScreenCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {} + ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {} + + // static +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-09-15 14:40:00.722481420 +0200 +@@ -15,7 +15,7 @@ + namespace webrtc { + + WindowCapturerPipeWire::WindowCapturerPipeWire() +- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {} ++ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {} + WindowCapturerPipeWire::~WindowCapturerPipeWire() {} + + // static +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-09-15 14:40:00.722481420 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options); ++ return BaseCapturerPipeWire::CreateRawScreenCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + +diff -up firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc +--- firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 2020-09-15 03:48:32.000000000 +0200 ++++ firefox-81.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-09-15 14:40:00.722481420 +0200 +@@ -26,7 +26,7 @@ std::unique_ptr Desktop + const DesktopCaptureOptions& options) { + #if defined(WEBRTC_USE_PIPEWIRE) + if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) { +- return WindowCapturerPipeWire::CreateRawWindowCapturer(options); ++ return BaseCapturerPipeWire::CreateRawWindowCapturer(options); + } + #endif // defined(WEBRTC_USE_PIPEWIRE) + diff --git a/firefox-redhat-default-prefs.js b/firefox-redhat-default-prefs.js new file mode 100644 index 0000000..89afe2c --- /dev/null +++ b/firefox-redhat-default-prefs.js @@ -0,0 +1,37 @@ +pref("app.update.auto", false); +pref("app.update.enabled", false); +pref("app.update.autoInstallEnabled", false); +pref("general.smoothScroll", true); +pref("intl.locale.matchOS", true); +pref("intl.locale.requested", ""); +pref("toolkit.storage.synchronous", 0); +pref("toolkit.networkmanager.disable", false); +pref("offline.autoDetect", true); +pref("browser.backspace_action", 2); +pref("browser.display.use_system_colors", true); +pref("browser.download.folderList", 1); +pref("browser.link.open_external", 3); +pref("browser.shell.checkDefaultBrowser", false); +pref("network.manage-offline-status", true); +pref("extensions.shownSelectionUI", true); +pref("ui.SpellCheckerUnderlineStyle", 1); +pref("startup.homepage_override_url", ""); +pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=https://start.fedoraproject.org/"); +pref("browser.newtabpage.pinned", '[{"url":"https://start.fedoraproject.org/","title":"Fedora Project - Start Page"}]'); +pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"); +pref("media.gmp-gmpopenh264.provider.enabled",false); +pref("media.gmp-gmpopenh264.autoupdate",false); +pref("media.gmp-gmpopenh264.enabled",false); +pref("media.gmp.decoder.enabled", true); +pref("plugins.notifyMissingFlash", false); +/* See https://bugzilla.redhat.com/show_bug.cgi?id=1226489 */ +pref("browser.display.use_system_colors", false); +pref("layers.use-image-offscreen-surfaces", false); +/* Allow sending credetials to all https:// sites */ +pref("network.negotiate-auth.trusted-uris", "https://"); +pref("spellchecker.dictionary_path","/usr/share/myspell"); +/* Disable DoH by default */ +pref("network.trr.mode", 5); +/* Enable per-user policy dir, see mozbz#1583466 */ +pref("browser.policies.perUserDir", true); +pref("browser.gnome-search-provider.enabled",true); \ No newline at end of file diff --git a/firefox-search-provider.ini b/firefox-search-provider.ini new file mode 100644 index 0000000..3868e3d --- /dev/null +++ b/firefox-search-provider.ini @@ -0,0 +1,5 @@ +[Shell Search Provider] +DesktopId=firefox.desktop +BusName=org.mozilla.Firefox.SearchProvider +ObjectPath=/org/mozilla/Firefox/SearchProvider +Version=2 diff --git a/firefox-symbolic.svg b/firefox-symbolic.svg new file mode 100644 index 0000000..2078eea --- /dev/null +++ b/firefox-symbolic.svg @@ -0,0 +1,64 @@ + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + + Gnome Symbolic Icon Theme + + diff --git a/firefox-vaapi-extra-frames.patch b/firefox-vaapi-extra-frames.patch new file mode 100644 index 0000000..e26158a --- /dev/null +++ b/firefox-vaapi-extra-frames.patch @@ -0,0 +1,12 @@ +diff -up firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +--- firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old 2020-05-13 14:28:26.556800474 +0200 ++++ firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2020-05-13 14:28:31.562768959 +0200 +@@ -43,7 +43,7 @@ typedef int VAStatus; + #endif + + // Use some extra HW frames for potential rendering lags. +-#define EXTRA_HW_FRAMES 6 ++#define EXTRA_HW_FRAMES 20 + + typedef mozilla::layers::Image Image; + typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage; diff --git a/firefox-wayland.desktop b/firefox-wayland.desktop new file mode 100644 index 0000000..cd2dd61 --- /dev/null +++ b/firefox-wayland.desktop @@ -0,0 +1,235 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox on Wayland +GenericName=Web Browser +Comment=Browse the Web +Exec=firefox-wayland --name firefox-wayland %u +Icon=firefox +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +Categories=Network;WebBrowser; +Keywords=web;browser;internet; +Actions=new-window;new-private-window;profile-manager-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ach]=Dirica manyen +Name[af]=Nuwe venster +Name[an]=Nueva finestra +Name[ar]=نافذة جديدة +Name[as]=নতুন উইন্ডো +Name[ast]=Ventana nueva +Name[az]=Yeni Pəncərə +Name[be]=Новае акно +Name[bg]=Нов прозорец +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো +Name[br]=Prenestr nevez +Name[brx]=गोदान उइन्ड'(N) +Name[bs]=Novi prozor +Name[ca]=Finestra nova +Name[cak]=K'ak'a' tzuwäch +Name[cs]=Nové okno +Name[cy]=Ffenestr Newydd +Name[da]=Nyt vindue +Name[de]=Neues Fenster +Name[dsb]=Nowe wokno +Name[el]=Νέο παράθυρο +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window +Name[eo]=Nova fenestro +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana +Name[et]=Uus aken +Name[eu]=Leiho berria +Name[fa]=پنجره جدید‌ +Name[ff]=Henorde Hesere +Name[fi]=Uusi ikkuna +Name[fr]=Nouvelle fenêtre +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua +Name[gd]=Uinneag ùr +Name[gl]=Nova xanela +Name[gn]=Ovetã pyahu +Name[gu_IN]=નવી વિન્ડો +Name[he]=חלון חדש +Name[hi_IN]=नया विंडो +Name[hr]=Novi prozor +Name[hsb]=Nowe wokno +Name[hu]=Új ablak +Name[hy_AM]=Նոր Պատուհան +Name[id]=Jendela Baru +Name[is]=Nýr gluggi +Name[it]=Nuova finestra +Name[ja]=新しいウィンドウ +Name[ja_JP-mac]=新規ウインドウ +Name[ka]=ახალი ფანჯარა +Name[kk]=Жаңа терезе +Name[km]=បង្អួច​​​ថ្មី +Name[kn]=ಹೊಸ ಕಿಟಕಿ +Name[ko]=새 창 +Name[kok]=नवें जनेल +Name[ks]=نئئ وِنڈو +Name[lij]=Neuvo barcon +Name[lo]=ຫນ້າຕ່າງໃຫມ່ +Name[lt]=Naujas langas +Name[ltg]=Jauns lūgs +Name[lv]=Jauns logs +Name[mai]=नव विंडो +Name[mk]=Нов прозорец +Name[ml]=പുതിയ ജാലകം +Name[mr]=नवीन पटल +Name[ms]=Tetingkap Baru +Name[my]=ဝင်းဒိုးအသစ် +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल +Name[nl]=Nieuw venster +Name[nn_NO]=Nytt vindauge +Name[or]=ନୂତନ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pl]=Nowe okno +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela +Name[rm]=Nova fanestra +Name[ro]=Fereastră nouă +Name[ru]=Новое окно +Name[sat]=नावा विंडो (N) +Name[si]=නව කවුළුවක් +Name[sk]=Nové okno +Name[sl]=Novo okno +Name[son]=Zanfun taaga +Name[sq]=Dritare e Re +Name[sr]=Нови прозор +Name[sv_SE]=Nytt fönster +Name[ta]=புதிய சாளரம் +Name[te]=కొత్త విండో +Name[th]=หน้าต่างใหม่ +Name[tr]=Yeni pencere +Name[tsz]=Eraatarakua jimpani +Name[uk]=Нове вікно +Name[ur]=نیا دریچہ +Name[uz]=Yangi oyna +Name[vi]=Cửa sổ mới +Name[wo]=Palanteer bu bees +Name[xh]=Ifestile entsha +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 +Exec=firefox-wayland --name firefox-wayland --new-window %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ach]=Dirica manyen me mung +Name[af]=Nuwe privaatvenster +Name[an]=Nueva finestra privada +Name[ar]=نافذة خاصة جديدة +Name[as]=নতুন ব্যক্তিগত উইন্ডো +Name[ast]=Ventana privada nueva +Name[az]=Yeni Məxfi Pəncərə +Name[be]=Новае акно адасаблення +Name[bg]=Нов прозорец за поверително сърфиране +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো +Name[br]=Prenestr merdeiñ prevez nevez +Name[brx]=गोदान प्राइभेट उइन्ड' +Name[bs]=Novi privatni prozor +Name[ca]=Finestra privada nova +Name[cak]=K'ak'a' ichinan tzuwäch +Name[cs]=Nové anonymní okno +Name[cy]=Ffenestr Breifat Newydd +Name[da]=Nyt privat vindue +Name[de]=Neues privates Fenster +Name[dsb]=Nowe priwatne wokno +Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window +Name[eo]=Nova privata fenestro +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada +Name[et]=Uus privaatne aken +Name[eu]=Leiho pribatu berria +Name[fa]=پنجره ناشناس جدید +Name[ff]=Henorde Suturo Hesere +Name[fi]=Uusi yksityinen ikkuna +Name[fr]=Nouvelle fenêtre de navigation privée +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach +Name[gd]=Uinneag phrìobhaideach ùr +Name[gl]=Nova xanela privada +Name[gn]=Ovetã ñemi pyahu +Name[gu_IN]=નવી ખાનગી વિન્ડો +Name[he]=חלון פרטי חדש +Name[hi_IN]=नयी निजी विंडो +Name[hr]=Novi privatni prozor +Name[hsb]=Nowe priwatne wokno +Name[hu]=Új privát ablak +Name[hy_AM]=Սկսել Գաղտնի դիտարկում +Name[id]=Jendela Mode Pribadi Baru +Name[is]=Nýr huliðsgluggi +Name[it]=Nuova finestra anonima +Name[ja]=新しいプライベートウィンドウ +Name[ja_JP-mac]=新規プライベートウインドウ +Name[ka]=ახალი პირადი ფანჯარა +Name[kk]=Жаңа жекелік терезе +Name[km]=បង្អួច​ឯកជន​ថ្មី +Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ +Name[ko]=새 사생활 보호 모드 +Name[kok]=नवो खाजगी विंडो +Name[ks]=نْو پرایوٹ وینڈو& +Name[lij]=Neuvo barcon privou +Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່ +Name[lt]=Naujas privataus naršymo langas +Name[ltg]=Jauns privatais lūgs +Name[lv]=Jauns privātais logs +Name[mai]=नया निज विंडो (W) +Name[mk]=Нов приватен прозорец +Name[ml]=പുതിയ സ്വകാര്യ ജാലകം +Name[mr]=नवीन वैयक्तिक पटल +Name[ms]=Tetingkap Persendirian Baharu +Name[my]=New Private Window +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल +Name[nl]=Nieuw privévenster +Name[nn_NO]=Nytt privat vindauge +Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pl]=Nowe okno prywatne +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada +Name[rm]=Nova fanestra privata +Name[ro]=Fereastră privată nouă +Name[ru]=Новое приватное окно +Name[sat]=नावा निजेराक् विंडो (W ) +Name[si]=නව පුද්ගලික කවුළුව (W) +Name[sk]=Nové okno v režime Súkromné prehliadanie +Name[sl]=Novo zasebno okno +Name[son]=Sutura zanfun taaga +Name[sq]=Dritare e Re Private +Name[sr]=Нови приватан прозор +Name[sv_SE]=Nytt privat fönster +Name[ta]=புதிய தனிப்பட்ட சாளரம் +Name[te]=కొత్త ఆంతరంగిక విండో +Name[th]=หน้าต่างส่วนตัวใหม่ +Name[tr]=Yeni gizli pencere +Name[tsz]=Juchiiti eraatarakua jimpani +Name[uk]=Приватне вікно +Name[ur]=نیا نجی دریچہ +Name[uz]=Yangi maxfiy oyna +Name[vi]=Cửa sổ riêng tư mới +Name[wo]=Panlanteeru biir bu bees +Name[xh]=Ifestile yangasese entsha +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 +Exec=firefox-wayland --private-window --name firefox-wayland %u + +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox-wayland --name firefox-wayland --ProfileManager diff --git a/firefox-wayland.sh.in b/firefox-wayland.sh.in new file mode 100644 index 0000000..bd68068 --- /dev/null +++ b/firefox-wayland.sh.in @@ -0,0 +1,7 @@ +#!/usr/bin/bash +# +# Run Firefox under Wayland +# + +export MOZ_ENABLE_WAYLAND=1 +exec /__PREFIX__/bin/firefox "$@" diff --git a/firefox-x11.desktop b/firefox-x11.desktop new file mode 100644 index 0000000..4124891 --- /dev/null +++ b/firefox-x11.desktop @@ -0,0 +1,235 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox on X11 +GenericName=Web Browser +Comment=Browse the Web +Exec=firefox-x11 --name firefox-x11 %u +Icon=firefox +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +Categories=Network;WebBrowser; +Keywords=web;browser;internet; +Actions=new-window;new-private-window;profile-manager-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ach]=Dirica manyen +Name[af]=Nuwe venster +Name[an]=Nueva finestra +Name[ar]=نافذة جديدة +Name[as]=নতুন উইন্ডো +Name[ast]=Ventana nueva +Name[az]=Yeni Pəncərə +Name[be]=Новае акно +Name[bg]=Нов прозорец +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো +Name[br]=Prenestr nevez +Name[brx]=गोदान उइन्ड'(N) +Name[bs]=Novi prozor +Name[ca]=Finestra nova +Name[cak]=K'ak'a' tzuwäch +Name[cs]=Nové okno +Name[cy]=Ffenestr Newydd +Name[da]=Nyt vindue +Name[de]=Neues Fenster +Name[dsb]=Nowe wokno +Name[el]=Νέο παράθυρο +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window +Name[eo]=Nova fenestro +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana +Name[et]=Uus aken +Name[eu]=Leiho berria +Name[fa]=پنجره جدید‌ +Name[ff]=Henorde Hesere +Name[fi]=Uusi ikkuna +Name[fr]=Nouvelle fenêtre +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua +Name[gd]=Uinneag ùr +Name[gl]=Nova xanela +Name[gn]=Ovetã pyahu +Name[gu_IN]=નવી વિન્ડો +Name[he]=חלון חדש +Name[hi_IN]=नया विंडो +Name[hr]=Novi prozor +Name[hsb]=Nowe wokno +Name[hu]=Új ablak +Name[hy_AM]=Նոր Պատուհան +Name[id]=Jendela Baru +Name[is]=Nýr gluggi +Name[it]=Nuova finestra +Name[ja]=新しいウィンドウ +Name[ja_JP-mac]=新規ウインドウ +Name[ka]=ახალი ფანჯარა +Name[kk]=Жаңа терезе +Name[km]=បង្អួច​​​ថ្មី +Name[kn]=ಹೊಸ ಕಿಟಕಿ +Name[ko]=새 창 +Name[kok]=नवें जनेल +Name[ks]=نئئ وِنڈو +Name[lij]=Neuvo barcon +Name[lo]=ຫນ້າຕ່າງໃຫມ່ +Name[lt]=Naujas langas +Name[ltg]=Jauns lūgs +Name[lv]=Jauns logs +Name[mai]=नव विंडो +Name[mk]=Нов прозорец +Name[ml]=പുതിയ ജാലകം +Name[mr]=नवीन पटल +Name[ms]=Tetingkap Baru +Name[my]=ဝင်းဒိုးအသစ် +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल +Name[nl]=Nieuw venster +Name[nn_NO]=Nytt vindauge +Name[or]=ନୂତନ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pl]=Nowe okno +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela +Name[rm]=Nova fanestra +Name[ro]=Fereastră nouă +Name[ru]=Новое окно +Name[sat]=नावा विंडो (N) +Name[si]=නව කවුළුවක් +Name[sk]=Nové okno +Name[sl]=Novo okno +Name[son]=Zanfun taaga +Name[sq]=Dritare e Re +Name[sr]=Нови прозор +Name[sv_SE]=Nytt fönster +Name[ta]=புதிய சாளரம் +Name[te]=కొత్త విండో +Name[th]=หน้าต่างใหม่ +Name[tr]=Yeni pencere +Name[tsz]=Eraatarakua jimpani +Name[uk]=Нове вікно +Name[ur]=نیا دریچہ +Name[uz]=Yangi oyna +Name[vi]=Cửa sổ mới +Name[wo]=Palanteer bu bees +Name[xh]=Ifestile entsha +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 +Exec=firefox-x11 --name firefox-x11 --new-window %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ach]=Dirica manyen me mung +Name[af]=Nuwe privaatvenster +Name[an]=Nueva finestra privada +Name[ar]=نافذة خاصة جديدة +Name[as]=নতুন ব্যক্তিগত উইন্ডো +Name[ast]=Ventana privada nueva +Name[az]=Yeni Məxfi Pəncərə +Name[be]=Новае акно адасаблення +Name[bg]=Нов прозорец за поверително сърфиране +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো +Name[br]=Prenestr merdeiñ prevez nevez +Name[brx]=गोदान प्राइभेट उइन्ड' +Name[bs]=Novi privatni prozor +Name[ca]=Finestra privada nova +Name[cak]=K'ak'a' ichinan tzuwäch +Name[cs]=Nové anonymní okno +Name[cy]=Ffenestr Breifat Newydd +Name[da]=Nyt privat vindue +Name[de]=Neues privates Fenster +Name[dsb]=Nowe priwatne wokno +Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window +Name[eo]=Nova privata fenestro +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada +Name[et]=Uus privaatne aken +Name[eu]=Leiho pribatu berria +Name[fa]=پنجره ناشناس جدید +Name[ff]=Henorde Suturo Hesere +Name[fi]=Uusi yksityinen ikkuna +Name[fr]=Nouvelle fenêtre de navigation privée +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach +Name[gd]=Uinneag phrìobhaideach ùr +Name[gl]=Nova xanela privada +Name[gn]=Ovetã ñemi pyahu +Name[gu_IN]=નવી ખાનગી વિન્ડો +Name[he]=חלון פרטי חדש +Name[hi_IN]=नयी निजी विंडो +Name[hr]=Novi privatni prozor +Name[hsb]=Nowe priwatne wokno +Name[hu]=Új privát ablak +Name[hy_AM]=Սկսել Գաղտնի դիտարկում +Name[id]=Jendela Mode Pribadi Baru +Name[is]=Nýr huliðsgluggi +Name[it]=Nuova finestra anonima +Name[ja]=新しいプライベートウィンドウ +Name[ja_JP-mac]=新規プライベートウインドウ +Name[ka]=ახალი პირადი ფანჯარა +Name[kk]=Жаңа жекелік терезе +Name[km]=បង្អួច​ឯកជន​ថ្មី +Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ +Name[ko]=새 사생활 보호 모드 +Name[kok]=नवो खाजगी विंडो +Name[ks]=نْو پرایوٹ وینڈو& +Name[lij]=Neuvo barcon privou +Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່ +Name[lt]=Naujas privataus naršymo langas +Name[ltg]=Jauns privatais lūgs +Name[lv]=Jauns privātais logs +Name[mai]=नया निज विंडो (W) +Name[mk]=Нов приватен прозорец +Name[ml]=പുതിയ സ്വകാര്യ ജാലകം +Name[mr]=नवीन वैयक्तिक पटल +Name[ms]=Tetingkap Persendirian Baharu +Name[my]=New Private Window +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल +Name[nl]=Nieuw privévenster +Name[nn_NO]=Nytt privat vindauge +Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pl]=Nowe okno prywatne +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada +Name[rm]=Nova fanestra privata +Name[ro]=Fereastră privată nouă +Name[ru]=Новое приватное окно +Name[sat]=नावा निजेराक् विंडो (W ) +Name[si]=නව පුද්ගලික කවුළුව (W) +Name[sk]=Nové okno v režime Súkromné prehliadanie +Name[sl]=Novo zasebno okno +Name[son]=Sutura zanfun taaga +Name[sq]=Dritare e Re Private +Name[sr]=Нови приватан прозор +Name[sv_SE]=Nytt privat fönster +Name[ta]=புதிய தனிப்பட்ட சாளரம் +Name[te]=కొత్త ఆంతరంగిక విండో +Name[th]=หน้าต่างส่วนตัวใหม่ +Name[tr]=Yeni gizli pencere +Name[tsz]=Juchiiti eraatarakua jimpani +Name[uk]=Приватне вікно +Name[ur]=نیا نجی دریچہ +Name[uz]=Yangi maxfiy oyna +Name[vi]=Cửa sổ riêng tư mới +Name[wo]=Panlanteeru biir bu bees +Name[xh]=Ifestile yangasese entsha +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 +Exec=firefox-x11 --private-window --name firefox-x11 %u + +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox-x11 --name firefox-x11 --ProfileManager diff --git a/firefox-x11.sh.in b/firefox-x11.sh.in new file mode 100644 index 0000000..94045c9 --- /dev/null +++ b/firefox-x11.sh.in @@ -0,0 +1,7 @@ +#!/usr/bin/bash +# +# Run Firefox on X11 backend +# + +export MOZ_DISABLE_WAYLAND=1 +exec /__PREFIX__/bin/firefox "$@" diff --git a/firefox.1 b/firefox.1 new file mode 100644 index 0000000..556cf07 --- /dev/null +++ b/firefox.1 @@ -0,0 +1,141 @@ +.TH FIREFOX 1 "November 30, 2017" firefox "Linux User's Manual" +.SH NAME +firefox \- a Web browser for X11 derived from the Mozilla browser + +.SH SYNOPSIS +.B firefox +[\fIOPTIONS\fR ...] [\fIURL\fR] + +.B firefox-bin +[\fIOPTIONS\fR] [\fIURL\fR] + +.SH DESCRIPTION +\fBMozilla Firefox\fR is an open-source web browser, designed for +standards compliance, performance and portability. + +.SH USAGE +\fBfirefox\fR is a simple shell script that will set up the +environment for the actual executable, \fBfirefox-bin\fR. + +.SH OPTIONS +A summary of the options supported by \fBfirefox\fR is included below. + +.SS "X11 options" +.TP +.BI \-\-display= DISPLAY +X display to use +.TP +.B \--sync +Make X calls synchronous +.TP +.B \-\-g-fatal-warnings +Make all warnings fatal + +.SS "Firefox options" +.TP +.B \-h, \-help +Show summary of options. +.TP +.B \-v, \-version +Print Firefox version. +.TP +\fB\-P\fR \fIprofile\fR +Start with \fIprofile\fR. +.TP +\fB\-\-profile\fR \fIpath\fR +Start with profile at \fIpath\fR. +.TP +\fB\-\-migration\fR +Start with migration wizard. +.TP +.B \-\-ProfileManager +Start with ProfileManager. +.TP +\fB\-\-no\-remote\fR +Do not accept or send remote commands; implies \fB--new-instance\fR. +.TP +\fB\-\-new\-instance\fR +Open new instance, not a new window in running instance. +.TP +\fB\-\-UILocale\fR \fIlocale\fR +Start with \fIlocale\fR resources as UI Locale. +.TP +\fB\-\-safe\-mode\fR +Disables extensions and themes for this session. +.TP +\fB\-\-headless\fR +Run without a GUI. +.TP +\fB\-\-marionette\fR +Enable remote control server. +.TP +\fB\-\-browser\fR +Open a browser window. +.TP +\fB\-\-new-window\fR \fIurl\fR +Open \fIurl\fR in a new window. +.TP +\fB\-\-new-tab\fR \fIurl\fR +Open \fIurl\fR in a new tab. +.TP +\fB\-\-private-window\fR \fIurl\fR +Open \fIurl\fR in a new private window. +.TP +\fB\-\-preferences\fR +Open Preferences dialog. +.TP +\fB\-\-screenshot\fR [\fIpath\fR] +Save screenshot to \fIpath\fR or in working directory. +.TP +\fB\-\-window-size\fR \fIwidth\fR[,\fIheight\fR] +Width and optionally height of screenshot. +.TP +\fB\-\-search\fR \fIterm\fR +Search \fIterm\fR with your default search engine. +.TP + + +\fB\-\-jsconsole\fR +Open the Browser Console. +.TP +\fB\-\-jsdebugger\fR +Open the Browser Toolbox. +.TP +\fB\-\-wait-for-jsdebugger\fR +Spin event loop until JS debugger connects. Enables debugging (some) application startup code paths. Only has an effect when \fI--jsdebugger\fR is also supplied. +.TP +\fB\-\-devtools\fR +Open DevTools on initial load. +.TP +\fB\-\-start-debugger-server\fR [ws:][\fIport\fR|\fIpath\fR] +Start the debugger server on a TCP port or Unix domain socket path. Defaults to TCP port 6000. Use WebSocket protocol if ws: prefix is specified. +.TP +\fB\-\-recording\fR \fIfile\fR +Record drawing for a given URL. +.TP +\fB\-\-recording-output\fR \fIfile\fR +Specify destination file for a drawing recording. +.TP +\fB\-\-setDefaultBrowser\fR +Set this app as the default browser. + +.SH FILES +\fI/usr/bin/firefox\fR - shell script wrapping +\fBfirefox\fR +.br +\fI/usr/lib64/firefox/firefox-bin\fR - \fBfirefox\fR +executable + +.SH VERSION +57.0 + +.SH BUGS +To report a bug, please visit \fIhttp://bugzilla.mozilla.org/\fR + +.SH AUTHORS +.TP +.B The Mozilla Organization +.I http://www.mozilla.org/about.html +.TP +.B Tobias Girstmair +.I https://gir.st/ diff --git a/firefox.appdata.xml.in b/firefox.appdata.xml.in new file mode 100644 index 0000000..175e1c9 --- /dev/null +++ b/firefox.appdata.xml.in @@ -0,0 +1,59 @@ + + + + firefox.desktop + CC0-1.0 + Firefox + Web Browser + Navegador web + Webový prohlížeč + Navegador web + مرورگر اینترنتی + WWW-selain + Navigateur Web + Webböngésző + Browser Web + ウェブ・ブラウザ + 웹 브라우저 + Nettleser + Webbrowser + Nettlesar + Nettleser + Przeglądarka WWW + Navegador Web + Navegador Web + Internetový prehliadač + Webbläsare + +

+ Bringing together all kinds of awesomeness to make browsing better for you. + Get to your favorite sites quickly – even if you don’t remember the URLs. + Type your term into the location bar (aka the Awesome Bar) and the autocomplete + function will include possible matches from your browsing history, bookmarked + sites and open tabs. +

+
+ https://www.mozilla.org + stransky@redhat.com + + ModernToolkit + SearchProvider + + Mozilla + GPL-3.0+ + Mozilla Corporation + https://bugzilla.mozilla.org/ + https://support.mozilla.org/ + firefox + + firefox.desktop + + + https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/a.png + https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/b.png + https://raw.githubusercontent.com/hughsie/fedora-appstream/master/screenshots-extra/firefox/c.png + + + + +
diff --git a/firefox.desktop b/firefox.desktop new file mode 100644 index 0000000..35c2c48 --- /dev/null +++ b/firefox.desktop @@ -0,0 +1,274 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox +GenericName=Web Browser +GenericName[ca]=Navegador web +GenericName[cs]=Webový prohlížeč +GenericName[es]=Navegador web +GenericName[fa]=مرورگر اینترنتی +GenericName[fi]=WWW-selain +GenericName[fr]=Navigateur Web +GenericName[hu]=Webböngésző +GenericName[it]=Browser Web +GenericName[ja]=ウェブ・ブラウザ +GenericName[ko]=웹 브라우저 +GenericName[nb]=Nettleser +GenericName[nl]=Webbrowser +GenericName[nn]=Nettlesar +GenericName[no]=Nettleser +GenericName[pl]=Przeglądarka WWW +GenericName[pt]=Navegador Web +GenericName[pt_BR]=Navegador Web +GenericName[sk]=Internetový prehliadač +GenericName[sv]=Webbläsare +Comment=Browse the Web +Comment[ca]=Navegueu per el web +Comment[cs]=Prohlížení stránek World Wide Webu +Comment[de]=Im Internet surfen +Comment[es]=Navegue por la web +Comment[fa]=صفحات شبکه جهانی اینترنت را مرور نمایید +Comment[fi]=Selaa Internetin WWW-sivuja +Comment[fr]=Navigue sur Internet +Comment[hu]=A világháló böngészése +Comment[it]=Esplora il web +Comment[ja]=ウェブを閲覧します +Comment[ko]=웹을 돌아 다닙니다 +Comment[nb]=Surf på nettet +Comment[nl]=Verken het internet +Comment[nn]=Surf på nettet +Comment[no]=Surf på nettet +Comment[pl]=Przeglądanie stron WWW +Comment[pt]=Navegue na Internet +Comment[pt_BR]=Navegue na Internet +Comment[sk]=Prehliadanie internetu +Comment[sv]=Surfa på webben +Exec=firefox %u +Icon=firefox +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https; +StartupNotify=true +Categories=Network;WebBrowser; +Keywords=web;browser;internet; +Actions=new-window;new-private-window;profile-manager-window; + +[Desktop Action new-window] +Name=Open a New Window +Name[ach]=Dirica manyen +Name[af]=Nuwe venster +Name[an]=Nueva finestra +Name[ar]=نافذة جديدة +Name[as]=নতুন উইন্ডো +Name[ast]=Ventana nueva +Name[az]=Yeni Pəncərə +Name[be]=Новае акно +Name[bg]=Нов прозорец +Name[bn_BD]=নতুন উইন্ডো (N) +Name[bn_IN]=নতুন উইন্ডো +Name[br]=Prenestr nevez +Name[brx]=गोदान उइन्ड'(N) +Name[bs]=Novi prozor +Name[ca]=Finestra nova +Name[cak]=K'ak'a' tzuwäch +Name[cs]=Nové okno +Name[cy]=Ffenestr Newydd +Name[da]=Nyt vindue +Name[de]=Neues Fenster +Name[dsb]=Nowe wokno +Name[el]=Νέο παράθυρο +Name[en_GB]=New Window +Name[en_US]=New Window +Name[en_ZA]=New Window +Name[eo]=Nova fenestro +Name[es_AR]=Nueva ventana +Name[es_CL]=Nueva ventana +Name[es_ES]=Nueva ventana +Name[es_MX]=Nueva ventana +Name[et]=Uus aken +Name[eu]=Leiho berria +Name[fa]=پنجره جدید‌ +Name[ff]=Henorde Hesere +Name[fi]=Uusi ikkuna +Name[fr]=Nouvelle fenêtre +Name[fy_NL]=Nij finster +Name[ga_IE]=Fuinneog Nua +Name[gd]=Uinneag ùr +Name[gl]=Nova xanela +Name[gn]=Ovetã pyahu +Name[gu_IN]=નવી વિન્ડો +Name[he]=חלון חדש +Name[hi_IN]=नया विंडो +Name[hr]=Novi prozor +Name[hsb]=Nowe wokno +Name[hu]=Új ablak +Name[hy_AM]=Նոր Պատուհան +Name[id]=Jendela Baru +Name[is]=Nýr gluggi +Name[it]=Nuova finestra +Name[ja]=新しいウィンドウ +Name[ja_JP-mac]=新規ウインドウ +Name[ka]=ახალი ფანჯარა +Name[kk]=Жаңа терезе +Name[km]=បង្អួច​​​ថ្មី +Name[kn]=ಹೊಸ ಕಿಟಕಿ +Name[ko]=새 창 +Name[kok]=नवें जनेल +Name[ks]=نئئ وِنڈو +Name[lij]=Neuvo barcon +Name[lo]=ຫນ້າຕ່າງໃຫມ່ +Name[lt]=Naujas langas +Name[ltg]=Jauns lūgs +Name[lv]=Jauns logs +Name[mai]=नव विंडो +Name[mk]=Нов прозорец +Name[ml]=പുതിയ ജാലകം +Name[mr]=नवीन पटल +Name[ms]=Tetingkap Baru +Name[my]=ဝင်းဒိုးအသစ် +Name[nb_NO]=Nytt vindu +Name[ne_NP]=नयाँ सञ्झ्याल +Name[nl]=Nieuw venster +Name[nn_NO]=Nytt vindauge +Name[or]=ନୂତନ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ +Name[pl]=Nowe okno +Name[pt_BR]=Nova janela +Name[pt_PT]=Nova janela +Name[rm]=Nova fanestra +Name[ro]=Fereastră nouă +Name[ru]=Новое окно +Name[sat]=नावा विंडो (N) +Name[si]=නව කවුළුවක් +Name[sk]=Nové okno +Name[sl]=Novo okno +Name[son]=Zanfun taaga +Name[sq]=Dritare e Re +Name[sr]=Нови прозор +Name[sv_SE]=Nytt fönster +Name[ta]=புதிய சாளரம் +Name[te]=కొత్త విండో +Name[th]=หน้าต่างใหม่ +Name[tr]=Yeni pencere +Name[tsz]=Eraatarakua jimpani +Name[uk]=Нове вікно +Name[ur]=نیا دریچہ +Name[uz]=Yangi oyna +Name[vi]=Cửa sổ mới +Name[wo]=Palanteer bu bees +Name[xh]=Ifestile entsha +Name[zh_CN]=新建窗口 +Name[zh_TW]=開新視窗 +Exec=firefox --new-window %u + +[Desktop Action new-private-window] +Name=Open a New Private Window +Name[ach]=Dirica manyen me mung +Name[af]=Nuwe privaatvenster +Name[an]=Nueva finestra privada +Name[ar]=نافذة خاصة جديدة +Name[as]=নতুন ব্যক্তিগত উইন্ডো +Name[ast]=Ventana privada nueva +Name[az]=Yeni Məxfi Pəncərə +Name[be]=Новае акно адасаблення +Name[bg]=Нов прозорец за поверително сърфиране +Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো +Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো +Name[br]=Prenestr merdeiñ prevez nevez +Name[brx]=गोदान प्राइभेट उइन्ड' +Name[bs]=Novi privatni prozor +Name[ca]=Finestra privada nova +Name[cak]=K'ak'a' ichinan tzuwäch +Name[cs]=Nové anonymní okno +Name[cy]=Ffenestr Breifat Newydd +Name[da]=Nyt privat vindue +Name[de]=Neues privates Fenster +Name[dsb]=Nowe priwatne wokno +Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης +Name[en_GB]=New Private Window +Name[en_US]=New Private Window +Name[en_ZA]=New Private Window +Name[eo]=Nova privata fenestro +Name[es_AR]=Nueva ventana privada +Name[es_CL]=Nueva ventana privada +Name[es_ES]=Nueva ventana privada +Name[es_MX]=Nueva ventana privada +Name[et]=Uus privaatne aken +Name[eu]=Leiho pribatu berria +Name[fa]=پنجره ناشناس جدید +Name[ff]=Henorde Suturo Hesere +Name[fi]=Uusi yksityinen ikkuna +Name[fr]=Nouvelle fenêtre de navigation privée +Name[fy_NL]=Nij priveefinster +Name[ga_IE]=Fuinneog Nua Phríobháideach +Name[gd]=Uinneag phrìobhaideach ùr +Name[gl]=Nova xanela privada +Name[gn]=Ovetã ñemi pyahu +Name[gu_IN]=નવી ખાનગી વિન્ડો +Name[he]=חלון פרטי חדש +Name[hi_IN]=नयी निजी विंडो +Name[hr]=Novi privatni prozor +Name[hsb]=Nowe priwatne wokno +Name[hu]=Új privát ablak +Name[hy_AM]=Սկսել Գաղտնի դիտարկում +Name[id]=Jendela Mode Pribadi Baru +Name[is]=Nýr huliðsgluggi +Name[it]=Nuova finestra anonima +Name[ja]=新しいプライベートウィンドウ +Name[ja_JP-mac]=新規プライベートウインドウ +Name[ka]=ახალი პირადი ფანჯარა +Name[kk]=Жаңа жекелік терезе +Name[km]=បង្អួច​ឯកជន​ថ្មី +Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ +Name[ko]=새 사생활 보호 모드 +Name[kok]=नवो खाजगी विंडो +Name[ks]=نْو پرایوٹ وینڈو& +Name[lij]=Neuvo barcon privou +Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່ +Name[lt]=Naujas privataus naršymo langas +Name[ltg]=Jauns privatais lūgs +Name[lv]=Jauns privātais logs +Name[mai]=नया निज विंडो (W) +Name[mk]=Нов приватен прозорец +Name[ml]=പുതിയ സ്വകാര്യ ജാലകം +Name[mr]=नवीन वैयक्तिक पटल +Name[ms]=Tetingkap Persendirian Baharu +Name[my]=New Private Window +Name[nb_NO]=Nytt privat vindu +Name[ne_NP]=नयाँ निजी सञ्झ्याल +Name[nl]=Nieuw privévenster +Name[nn_NO]=Nytt privat vindauge +Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ +Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ +Name[pl]=Nowe okno prywatne +Name[pt_BR]=Nova janela privativa +Name[pt_PT]=Nova janela privada +Name[rm]=Nova fanestra privata +Name[ro]=Fereastră privată nouă +Name[ru]=Новое приватное окно +Name[sat]=नावा निजेराक् विंडो (W ) +Name[si]=නව පුද්ගලික කවුළුව (W) +Name[sk]=Nové okno v režime Súkromné prehliadanie +Name[sl]=Novo zasebno okno +Name[son]=Sutura zanfun taaga +Name[sq]=Dritare e Re Private +Name[sr]=Нови приватан прозор +Name[sv_SE]=Nytt privat fönster +Name[ta]=புதிய தனிப்பட்ட சாளரம் +Name[te]=కొత్త ఆంతరంగిక విండో +Name[th]=หน้าต่างส่วนตัวใหม่ +Name[tr]=Yeni gizli pencere +Name[tsz]=Juchiiti eraatarakua jimpani +Name[uk]=Приватне вікно +Name[ur]=نیا نجی دریچہ +Name[uz]=Yangi maxfiy oyna +Name[vi]=Cửa sổ riêng tư mới +Name[wo]=Panlanteeru biir bu bees +Name[xh]=Ifestile yangasese entsha +Name[zh_CN]=新建隐私浏览窗口 +Name[zh_TW]=新增隱私視窗 +Exec=firefox --private-window %u + +[Desktop Action profile-manager-window] +Name=Open the Profile Manager +Name[cs]=Správa profilů +Exec=firefox --ProfileManager diff --git a/firefox.sh.in b/firefox.sh.in new file mode 100644 index 0000000..63c04cc --- /dev/null +++ b/firefox.sh.in @@ -0,0 +1,279 @@ +#!/usr/bin/bash +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +## +## Usage: +## +## $ firefox +## +## This script is meant to run a mozilla program from the mozilla +## rpm installation. +## +## The script will setup all the environment voodoo needed to make +## mozilla work. + +cmdname=`basename $0` + +## +## Variables +## +MOZ_ARCH=$(uname -m) +case $MOZ_ARCH in + x86_64 | s390x | sparc64) + MOZ_LIB_DIR="/__PREFIX__/lib64" + SECONDARY_LIB_DIR="/__PREFIX__/lib" + ;; + * ) + MOZ_LIB_DIR="/__PREFIX__/lib" + SECONDARY_LIB_DIR="/__PREFIX__/lib64" + ;; +esac + +MOZ_FIREFOX_FILE="firefox" + +if [ ! -r $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then + if [ ! -r $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE ]; then + echo "Error: $MOZ_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found" + if [ -d $SECONDARY_LIB_DIR ]; then + echo " $SECONDARY_LIB_DIR/firefox/$MOZ_FIREFOX_FILE not found" + fi + exit 1 + fi + MOZ_LIB_DIR="$SECONDARY_LIB_DIR" +fi +MOZ_DIST_BIN="$MOZ_LIB_DIR/firefox" +MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks" +MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" +MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE" +MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh" + +## +## Enable Wayland backend? +## +if __DEFAULT_WAYLAND__ && ! [ $MOZ_DISABLE_WAYLAND ]; then + if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ]; then + export MOZ_ENABLE_WAYLAND=1 + fi +fi + +## +## Use D-Bus remote exclusively when there's Wayland display. +## +if [ "$WAYLAND_DISPLAY" ]; then + export MOZ_DBUS_REMOTE=1 +fi + +## +## Set MOZ_GRE_CONF +## +MOZ_GRE_CONF=/etc/gre.d/gre.conf +if [ "$MOZ_LIB_DIR" == "/__PREFIX__/lib64" ]; then + MOZ_GRE_CONF=/etc/gre.d/gre64.conf +fi +export MOZ_GRE_CONF + +## +## Set MOZILLA_FIVE_HOME +## +MOZILLA_FIVE_HOME="$MOZ_DIST_BIN" + +export MOZILLA_FIVE_HOME + +## +## Make sure that we set the plugin path +## +MOZ_PLUGIN_DIR="plugins" + +if [ "$MOZ_PLUGIN_PATH" ] +then + MOZ_PLUGIN_PATH=$MOZ_PLUGIN_PATH:$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR +else + MOZ_PLUGIN_PATH=$MOZ_LIB_DIR/mozilla/$MOZ_PLUGIN_DIR:$MOZ_DIST_BIN/$MOZ_PLUGIN_DIR +fi +export MOZ_PLUGIN_PATH + +## +## Set MOZ_APP_LAUNCHER for gnome-session +## +export MOZ_APP_LAUNCHER="/__PREFIX__/bin/firefox" + +## +## Set FONTCONFIG_PATH for Xft/fontconfig +## +FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft" +export FONTCONFIG_PATH + +## +## In order to better support certain scripts (such as Indic and some CJK +## scripts), Fedora builds its Firefox, with permission from the Mozilla +## Corporation, with the Pango system as its text renderer. This change +## may negatively impact performance on some pages. To disable the use of +## Pango, set MOZ_DISABLE_PANGO=1 in your environment before launching +## Firefox. +## +# +# MOZ_DISABLE_PANGO=1 +# export MOZ_DISABLE_PANGO +# + +## +## Disable the GNOME crash dialog, Moz has it's own +## +GNOME_DISABLE_CRASH_DIALOG=1 +export GNOME_DISABLE_CRASH_DIALOG + +## +## Disable the SLICE allocator (rhbz#1014858) +## +export G_SLICE=always-malloc + +## +## Enable Xinput2 (mozbz#1207973) +## +export MOZ_USE_XINPUT2=1 + +# OK, here's where all the real work gets done + + +## +## To disable the use of Firefox localization, set MOZ_DISABLE_LANGPACKS=1 +## in your environment before launching Firefox. +## +# +# MOZ_DISABLE_LANGPACKS=1 +# export MOZ_DISABLE_LANGPACKS +# + +## +## Automatically installed langpacks are tracked by .fedora-langpack-install +## config file. +## +FEDORA_LANGPACK_CONFIG="$MOZ_EXTENSIONS_PROFILE_DIR/.fedora-langpack-install" + +# MOZ_DISABLE_LANGPACKS disables language packs completely +MOZILLA_DOWN=0 +if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then + if [ -x $MOZ_DIST_BIN/$MOZ_FIREFOX_FILE ]; then + # Is firefox running? + /__PREFIX__/bin/pidof $MOZ_PROGRAM > /dev/null 2>&1 + MOZILLA_DOWN=$? + fi +fi + +# When Firefox is not running, restore SELinux labels for profile files +# (rhbz#1731371) +if [ $MOZILLA_DOWN -ne 0 ]; then + if [ `getenforce` != "Disabled" ]; then + restorecon -vr ~/.mozilla/firefox/* & + fi +fi + +# Modify language pack configuration only when firefox is not running +# and language packs are not disabled +if [ $MOZILLA_DOWN -ne 0 ]; then + + # Clear already installed langpacks + mkdir -p $MOZ_EXTENSIONS_PROFILE_DIR + if [ -f $FEDORA_LANGPACK_CONFIG ]; then + rm `cat $FEDORA_LANGPACK_CONFIG` > /dev/null 2>&1 + rm $FEDORA_LANGPACK_CONFIG > /dev/null 2>&1 + # remove all empty langpacks dirs while they block installation of langpacks + rmdir $MOZ_EXTENSIONS_PROFILE_DIR/langpack* > /dev/null 2>&1 + fi + + # Get locale from system + CURRENT_LOCALE=$LC_ALL + CURRENT_LOCALE=${CURRENT_LOCALE:-$LC_MESSAGES} + CURRENT_LOCALE=${CURRENT_LOCALE:-$LANG} + + # Try with a local variant first, then without a local variant + SHORTMOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*||g" | sed "s|\..*||g"` + MOZLOCALE=`echo $CURRENT_LOCALE | sed "s|_\([^.]*\).*|-\1|g" | sed "s|\..*||g"` + + function create_langpack_link() { + local language=$* + local langpack=langpack-${language}@firefox.mozilla.org.xpi + if [ -f $MOZ_LANGPACKS_DIR/$langpack ]; then + rm -rf $MOZ_EXTENSIONS_PROFILE_DIR/$langpack + # If the target file is a symlink (the fallback langpack), + # install the original file instead of the fallback one + if [ -h $MOZ_LANGPACKS_DIR/$langpack ]; then + langpack=`readlink $MOZ_LANGPACKS_DIR/$langpack` + fi + ln -s $MOZ_LANGPACKS_DIR/$langpack \ + $MOZ_EXTENSIONS_PROFILE_DIR/$langpack + echo $MOZ_EXTENSIONS_PROFILE_DIR/$langpack > $FEDORA_LANGPACK_CONFIG + return 0 + fi + return 1 + } + + create_langpack_link $MOZLOCALE || create_langpack_link $SHORTMOZLOCALE || true +fi + +# BEAST fix (rhbz#1005611) +NSS_SSL_CBC_RANDOM_IV=${NSS_SSL_CBC_RANDOM_IV-1} +export NSS_SSL_CBC_RANDOM_IV + +# Prepare command line arguments +script_args="" +pass_arg_count=0 +while [ $# -gt $pass_arg_count ] +do + case "$1" in + -g | --debug) + script_args="$script_args -g" + debugging=1 + shift + ;; + -d | --debugger) + if [ $# -gt 1 ]; then + script_args="$script_args -d $2" + shift 2 + else + shift + fi + ;; + *) + # Move the unrecognized argument to the end of the list. + arg="$1" + shift + set -- "$@" "$arg" + pass_arg_count=`expr $pass_arg_count + 1` + ;; + esac +done + +# Flatpak specific environment variables +%FLATPAK_ENV_VARS% + +# Don't throw "old profile" dialog box. +export MOZ_ALLOW_DOWNGRADE=1 + +# Run the browser +debugging=0 +if [ $debugging = 1 ] +then + echo $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" +fi + +exec $MOZ_LAUNCHER $script_args $MOZ_PROGRAM "$@" diff --git a/firefox.spec b/firefox.spec new file mode 100644 index 0000000..e1a7750 --- /dev/null +++ b/firefox.spec @@ -0,0 +1,1319 @@ +# Set to true if it's going to be submitted as update. +%global release_build 1 +%global debug_build 0 +%global build_with_clang 0 +%global build_with_asan 0 + +# Disabled due to https://bugzilla.redhat.com/show_bug.cgi?id=1886672 +ExcludeArch: s390x + +%global enable_mozilla_crashreporter 0 +%ifarch x86_64 %{ix86} +%global enable_mozilla_crashreporter 1 +%endif +%if %{build_with_asan} +%global enable_mozilla_crashreporter 0 +%endif +%if 0%{?flatpak} +%global enable_mozilla_crashreporter 0 +%endif + +%global system_nss 1 +%global system_ffi 1 +%ifarch armv7hl +%global system_libvpx 1 +%else +%global system_libvpx 0 +%endif +%global hardened_build 1 +%global system_jpeg 1 +%global run_tests 0 +%global disable_elfhack 1 +%global use_bundled_cbindgen 1 +# Build PGO+LTO on x86_64 and aarch64 only due to build issues +# on other arches. +%global build_with_pgo 0 +%ifarch x86_64 +%if %{release_build} +%global build_with_pgo 1 +%endif +# Build PGO builds on Wayland backend +%global pgo_wayland 0 +%endif +%global wayland_backend_default 1 +%if 0%{?flatpak} +%global build_with_pgo 0 +%endif +# Big endian platforms +%ifarch ppc64 s390x +%global big_endian 1 +%endif + +%ifarch armv7hl +%define _unpackaged_files_terminate_build 0 +%global debug_package %{nil} +%endif + +%if 0%{?build_with_pgo} +%global use_xvfb 1 +%global build_tests 1 +%endif + +%if 0%{?run_tests} +%global use_xvfb 1 +%global build_tests 1 +%endif + +%global default_bookmarks_file %{_datadir}/bookmarks/default-bookmarks.html +%global firefox_app_id \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} +# Minimal required versions +%global cairo_version 1.13.1 +%global freetype_version 2.1.9 +%global libnotify_version 0.7.0 +%if %{?system_libvpx} +%global libvpx_version 1.8.2 +%endif + +%if %{?system_nss} +%global nspr_version 4.21 +%global nspr_build_version %{nspr_version} +%global nss_version 3.56 +%global nss_build_version %{nss_version} +%endif + +%global mozappdir %{_libdir}/%{name} +%global mozappdirdev %{_libdir}/%{name}-devel-%{version} +%global langpackdir %{mozappdir}/langpacks +%global tarballdir firefox-%{version} + +%global official_branding 1 + +%bcond_without langpacks + +%if !%{release_build} +%global pre_tag .npgo +%endif +%if %{build_with_clang} +%global pre_tag .clang +%endif +%if %{build_with_asan} +%global pre_tag .asan +%global build_with_pgo 0 +%endif +%if !%{system_nss} +%global nss_tag .nss +%endif + +Summary: Mozilla Firefox Web browser +Name: firefox +Version: 81.0.2 +Release: 2%{?dist} +URL: https://www.mozilla.org/firefox/ +License: MPLv1.1 or GPLv2+ or LGPLv2+ +Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz +%if %{with langpacks} +Source1: firefox-langpacks-%{version}%{?pre_version}-20201012.tar.xz +%endif +Source2: cbindgen-vendor.tar.xz +Source10: firefox-mozconfig +Source12: firefox-redhat-default-prefs.js +Source20: firefox.desktop +Source21: firefox.sh.in +Source23: firefox.1 +Source24: mozilla-api-key +Source25: firefox-symbolic.svg +Source26: distribution.ini +Source27: google-api-key +Source28: firefox-wayland.sh.in +Source29: firefox-wayland.desktop +Source30: firefox-x11.sh.in +Source31: firefox-x11.desktop +Source32: node-stdout-nonblocking-wrapper +Source33: firefox.appdata.xml.in +Source34: firefox-search-provider.ini +Source35: google-loc-api-key + +# Build patches +Patch3: mozilla-build-arm.patch +Patch25: rhbz-1219542-s390-build.patch +Patch32: build-rust-ppc64le.patch +Patch35: build-ppc-jit.patch +# Fixing missing cacheFlush when JS_CODEGEN_NONE is used (s390x) +Patch38: build-cacheFlush-missing.patch +Patch40: build-aarch64-skia.patch +Patch41: build-disable-elfhack.patch +Patch44: build-arm-libopus.patch +Patch46: firefox-nss-version.patch +Patch47: fedora-shebang-build.patch +Patch48: build-arm-wasm.patch +Patch49: build-arm-libaom.patch +Patch53: firefox-gcc-build.patch +# This should be fixed in Firefox 83 +Patch54: mozilla-1669639.patch +Patch55: mozilla-1669442.patch + +# Fedora specific patches +Patch215: firefox-enable-addons.patch +Patch219: rhbz-1173156.patch +Patch221: firefox-fedora-ua.patch +Patch224: mozilla-1170092.patch +#ARM run-time patch +Patch226: rhbz-1354671.patch +Patch227: firefox-locale-debug.patch +Patch228: disable-openh264-download.patch + +# Upstream patches +Patch402: mozilla-1196777.patch +Patch403: mozilla-1656505-1.patch +Patch404: mozilla-1656505-2.patch +Patch405: mozilla-1665324.patch +Patch406: mozilla-1665329.patch +Patch407: mozilla-1667096.patch +Patch408: mozilla-1663844.patch +Patch409: mozilla-1640567.patch +Patch410: mozilla-1661192.patch +Patch411: mozilla-1668771.patch +Patch412: mozilla-1634404.patch +Patch413: mozilla-1669495.patch +Patch414: mozilla-1656727.patch + +# Wayland specific upstream patches +Patch574: firefox-pipewire-0-2.patch +Patch575: firefox-pipewire-0-3.patch + +#VA-API patches +Patch584: firefox-disable-ffvpx-with-vapi.patch +Patch585: firefox-vaapi-extra-frames.patch + +# PGO/LTO patches +Patch600: pgo.patch +Patch602: mozilla-1516803.patch + +%if %{?system_nss} +BuildRequires: pkgconfig(nspr) >= %{nspr_version} +BuildRequires: pkgconfig(nss) >= %{nss_version} +BuildRequires: nss-static >= %{nss_version} +%endif +BuildRequires: pkgconfig(libpng) +%if %{?system_jpeg} +BuildRequires: libjpeg-devel +%endif +BuildRequires: zip +BuildRequires: bzip2-devel +BuildRequires: pkgconfig(zlib) +BuildRequires: pkgconfig(gtk+-3.0) +BuildRequires: pkgconfig(gtk+-2.0) +BuildRequires: pkgconfig(krb5) +BuildRequires: pkgconfig(pango) +BuildRequires: pkgconfig(freetype2) >= %{freetype_version} +BuildRequires: pkgconfig(xt) +BuildRequires: pkgconfig(xrender) +BuildRequires: pkgconfig(libstartup-notification-1.0) +BuildRequires: pkgconfig(libnotify) >= %{libnotify_version} +BuildRequires: pkgconfig(dri) +BuildRequires: pkgconfig(libcurl) +BuildRequires: dbus-glib-devel +%if %{?system_libvpx} +BuildRequires: libvpx-devel >= %{libvpx_version} +%endif +BuildRequires: autoconf213 +BuildRequires: pkgconfig(libpulse) +BuildRequires: yasm +BuildRequires: llvm +BuildRequires: llvm-devel +BuildRequires: clang +BuildRequires: clang-libs +%if %{build_with_clang} +BuildRequires: lld +%endif + +BuildRequires: pipewire-devel + +%if !0%{?use_bundled_cbindgen} +BuildRequires: cbindgen +%endif +BuildRequires: nodejs +BuildRequires: nasm >= 1.13 +BuildRequires: libappstream-glib + +%if 0%{?big_endian} +BuildRequires: icu +%endif + +Requires: mozilla-filesystem +Requires: p11-kit-trust +%if %{?system_nss} +Requires: nspr >= %{nspr_build_version} +Requires: nss >= %{nss_build_version} +%endif +BuildRequires: python3-devel +%if !0%{?flatpak} +Requires: u2f-hidraw-policy +%endif +BuildRequires: nss-devel >= 3.29.1-2.1 +Requires: nss >= 3.48.0 + +BuildRequires: desktop-file-utils +%if !0%{?flatpak} +BuildRequires: system-bookmarks +%endif +%if %{?system_ffi} +BuildRequires: pkgconfig(libffi) +%endif + +%if 0%{?use_xvfb} +BuildRequires: xorg-x11-server-Xvfb +%endif +%if 0%{?pgo_wayland} +BuildRequires: mutter +BuildRequires: gsettings-desktop-schemas +BuildRequires: gnome-settings-daemon +BuildRequires: mesa-dri-drivers +%endif +BuildRequires: rust +BuildRequires: cargo +BuildRequires: clang-devel +%if %{build_with_asan} +BuildRequires: libasan +BuildRequires: libasan-static +%endif +BuildRequires: perl-interpreter +BuildRequires: fdk-aac-free-devel + +Obsoletes: mozilla <= 37:1.7.13 +Provides: webclient + +%description +Mozilla Firefox is an open-source web browser, designed for standards +compliance, performance and portability. + +%if %{enable_mozilla_crashreporter} +%global moz_debug_prefix %{_prefix}/lib/debug +%global moz_debug_dir %{moz_debug_prefix}%{mozappdir} +%global uname_m %(uname -m) +%global symbols_file_name %{name}-%{version}.en-US.%{_os}-%{uname_m}.crashreporter-symbols.zip +%global symbols_file_path %{moz_debug_dir}/%{symbols_file_name} +%global _find_debuginfo_opts -p %{symbols_file_path} -o debugcrashreporter.list +%global crashreporter_pkg_name mozilla-crashreporter-%{name}-debuginfo +%package -n %{crashreporter_pkg_name} +Summary: Debugging symbols used by Mozilla's crash reporter servers +%description -n %{crashreporter_pkg_name} +This package provides debug information for Firefox, for use by +Mozilla's crash reporter servers. If you are trying to locally +debug %{name}, you want to install %{name}-debuginfo instead. +%files -n %{crashreporter_pkg_name} -f debugcrashreporter.list +%endif + +%if 0%{?wayland_backend_default} +%package x11 +Summary: Firefox X11 launcher. +Requires: %{name} +%description x11 +The firefox-x11 package contains launcher and desktop file +to run Firefox explicitly on X11. +%files x11 +%{_bindir}/firefox-x11 +%{_datadir}/applications/firefox-x11.desktop +%endif + +%package wayland +Summary: Firefox Wayland launcher. +Requires: %{name} +%description wayland +The firefox-wayland package contains launcher and desktop file +to run Firefox explicitly on Wayland. +%files wayland +%{_bindir}/firefox-wayland +%{_datadir}/applications/firefox-wayland.desktop + +%if %{run_tests} +%global testsuite_pkg_name mozilla-%{name}-testresults +%package -n %{testsuite_pkg_name} +Summary: Results of testsuite +%description -n %{testsuite_pkg_name} +This package contains results of tests executed during build. +%files -n %{testsuite_pkg_name} +/test_results +%endif + +#--------------------------------------------------------------------- + +%prep +%setup -q -n %{tarballdir} + +# Build patches, can't change backup suffix from default because during build +# there is a compare of config and js/config directories and .orig suffix is +# ignored during this compare. + +%ifarch s390 +%patch25 -p1 -b .rhbz-1219542-s390 +%endif +%patch40 -p1 -b .aarch64-skia +%if 0%{?disable_elfhack} +%patch41 -p1 -b .disable-elfhack +%endif +%patch3 -p1 -b .arm +%patch44 -p1 -b .build-arm-libopus +#%patch46 -p1 -b .nss-version +%patch47 -p1 -b .fedora-shebang +%patch48 -p1 -b .build-arm-wasm +%patch49 -p1 -b .build-arm-libaom +%patch53 -p1 -b .firefox-gcc-build +%patch54 -p1 -b .1669639 +%patch55 -p1 -b .1669442 + +# Fedora patches +%patch215 -p1 -b .addons +%patch219 -p1 -b .rhbz-1173156 +%patch221 -p1 -b .fedora-ua +%patch224 -p1 -b .1170092 +#ARM run-time patch +%ifarch aarch64 +%patch226 -p1 -b .1354671 +%endif +%patch227 -p1 -b .locale-debug +%patch228 -p1 -b .disable-openh264-download + +%patch402 -p1 -b .1196777 +%patch403 -p1 -b .1656505-1 +%patch404 -p1 -b .1656505-2 +%patch405 -p1 -b .1665324 +%patch406 -p1 -b .1665329 +%patch407 -p1 -b .1667096 +%patch408 -p1 -b .1663844 +%patch409 -p1 -b .1640567 +%patch410 -p1 -b .1661192 +%patch411 -p1 -b .1668771 +%patch412 -p1 -b .1634404 +%patch413 -p1 -b .1669495 +%patch414 -p1 -b .1656727 + +# Wayland specific upstream patches +%if 0%{?fedora} < 32 +%patch574 -p1 -b .firefox-pipewire-0-2 +%else +%patch575 -p1 -b .firefox-pipewire-0-3 +%endif + +# VA-API fixes +%patch584 -p1 -b .firefox-disable-ffvpx-with-vapi +%patch585 -p1 -b .firefox-vaapi-extra-frames + +# PGO patches +%if %{build_with_pgo} +%if !%{build_with_clang} +%patch600 -p1 -b .pgo +%patch602 -p1 -b .1516803 +%endif +%endif + +%{__rm} -f .mozconfig +%{__cp} %{SOURCE10} .mozconfig +echo "ac_add_options --enable-default-toolkit=cairo-gtk3-wayland" >> .mozconfig +%if %{official_branding} +echo "ac_add_options --enable-official-branding" >> .mozconfig +%endif +%{__cp} %{SOURCE24} mozilla-api-key +%{__cp} %{SOURCE27} google-api-key +%{__cp} %{SOURCE35} google-loc-api-key + +echo "ac_add_options --prefix=\"%{_prefix}\"" >> .mozconfig +echo "ac_add_options --libdir=\"%{_libdir}\"" >> .mozconfig + +%if %{?system_nss} +echo "ac_add_options --with-system-nspr" >> .mozconfig +echo "ac_add_options --with-system-nss" >> .mozconfig +%else +echo "ac_add_options --without-system-nspr" >> .mozconfig +echo "ac_add_options --without-system-nss" >> .mozconfig +%endif + +%if %{?system_ffi} +echo "ac_add_options --enable-system-ffi" >> .mozconfig +%endif + +%ifarch %{arm} +echo "ac_add_options --disable-elf-hack" >> .mozconfig +%endif + +%if %{?debug_build} +echo "ac_add_options --enable-debug" >> .mozconfig +echo "ac_add_options --disable-optimize" >> .mozconfig +%else +%global optimize_flags "none" +%ifarch ppc64le aarch64 +%global optimize_flags "-g -O2" +%endif +%if %{optimize_flags} != "none" +echo 'ac_add_options --enable-optimize=%{?optimize_flags}' >> .mozconfig +%else +echo 'ac_add_options --enable-optimize' >> .mozconfig +%endif +echo "ac_add_options --disable-debug" >> .mozconfig +%endif + +# Second arches fail to start with jemalloc enabled +%ifnarch %{ix86} x86_64 +echo "ac_add_options --disable-jemalloc" >> .mozconfig +%endif + +%if !%{enable_mozilla_crashreporter} +echo "ac_add_options --disable-crashreporter" >> .mozconfig +%endif + +%if 0%{?build_tests} +echo "ac_add_options --enable-tests" >> .mozconfig +%else +echo "ac_add_options --disable-tests" >> .mozconfig +%endif + +%if !%{?system_jpeg} +echo "ac_add_options --without-system-jpeg" >> .mozconfig +%else +echo "ac_add_options --with-system-jpeg" >> .mozconfig +%endif + +%if %{?system_libvpx} +echo "ac_add_options --with-system-libvpx" >> .mozconfig +%else +echo "ac_add_options --without-system-libvpx" >> .mozconfig +%endif + +%ifarch s390 s390x +echo "ac_add_options --disable-jit" >> .mozconfig +%endif + +%if %{build_with_asan} +echo "ac_add_options --enable-address-sanitizer" >> .mozconfig +echo "ac_add_options --disable-jemalloc" >> .mozconfig +%endif + +# api keys full path +echo "ac_add_options --with-mozilla-api-keyfile=`pwd`/mozilla-api-key" >> .mozconfig +# It seems that the api key we have is for the safe browsing only +echo "ac_add_options --with-google-location-service-api-keyfile=`pwd`/google-loc-api-key" >> .mozconfig +echo "ac_add_options --with-google-safebrowsing-api-keyfile=`pwd`/google-api-key" >> .mozconfig + +echo 'export NODEJS="%{_buildrootdir}/bin/node-stdout-nonblocking-wrapper"' >> .mozconfig + +# Remove executable bit to make brp-mangle-shebangs happy. +chmod -x third_party/rust/itertools/src/lib.rs +chmod a-x third_party/rust/gfx-backend-vulkan/src/*.rs +chmod a-x third_party/rust/gfx-hal/src/*.rs +chmod a-x third_party/rust/ash/src/extensions/ext/*.rs +chmod a-x third_party/rust/ash/src/extensions/khr/*.rs + +#--------------------------------------------------------------------- + +%build +# Disable LTO to work around rhbz#1883904 +%define _lto_cflags %{nil} + +%if 0%{?use_bundled_cbindgen} + +mkdir -p my_rust_vendor +cd my_rust_vendor +%{__tar} xf %{SOURCE2} +mkdir -p .cargo +cat > .cargo/config < 30 +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -fpermissive" +%endif +%if %{?hardened_build} +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -fPIC -Wl,-z,relro -Wl,-z,now" +%endif +%if %{?debug_build} +MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-O2//') +%endif +%ifarch s390 +MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-g/-g1/') +# If MOZ_DEBUG_FLAGS is empty, firefox's build will default it to "-g" which +# overrides the -g1 from line above and breaks building on s390/arm +# (OOM when linking, rhbz#1238225) +export MOZ_DEBUG_FLAGS=" " +%endif +%ifarch %{arm} %{ix86} +MOZ_OPT_FLAGS=$(echo "$MOZ_OPT_FLAGS" | %{__sed} -e 's/-g/-g0/') +export MOZ_DEBUG_FLAGS=" " +%endif +%if !%{build_with_clang} +%ifarch s390 ppc aarch64 %{ix86} +MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--reduce-memory-overheads" +%endif +%ifarch %{arm} +MOZ_LINK_FLAGS="-Wl,--no-keep-memory -Wl,--strip-debug" +echo "ac_add_options --enable-linker=gold" >> .mozconfig +%endif +%endif +%if 0%{?flatpak} +# Make sure the linker can find libraries in /app/lib64 as we don't use +# __global_ldflags that normally sets this. +MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -L%{_libdir}" +%endif +%ifarch %{arm} %{ix86} +export RUSTFLAGS="-Cdebuginfo=0" +%endif +%if %{build_with_asan} +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -fsanitize=address -Dxmalloc=myxmalloc" +MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -fsanitize=address -ldl" +%endif + +# We don't wantfirefox to use CK_GCM_PARAMS_V3 in nss +MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT" + +echo "export CFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig +echo "export CXXFLAGS=\"$MOZ_OPT_FLAGS\"" >> .mozconfig +echo "export LDFLAGS=\"$MOZ_LINK_FLAGS\"" >> .mozconfig + +%if %{build_with_clang} +echo "export LLVM_PROFDATA=\"llvm-profdata\"" >> .mozconfig +echo "export AR=\"llvm-ar\"" >> .mozconfig +echo "export NM=\"llvm-nm\"" >> .mozconfig +echo "export RANLIB=\"llvm-ranlib\"" >> .mozconfig +echo "ac_add_options --enable-linker=lld" >> .mozconfig +%else +echo "export CC=gcc" >> .mozconfig +echo "export CXX=g++" >> .mozconfig +echo "export AR=\"gcc-ar\"" >> .mozconfig +echo "export NM=\"gcc-nm\"" >> .mozconfig +echo "export RANLIB=\"gcc-ranlib\"" >> .mozconfig +%endif +%if 0%{?build_with_pgo} +echo "ac_add_options MOZ_PGO=1" >> .mozconfig +# Temporary disabled due to GCC bug +%if 0%{?fedora} > 32 +echo "ac_add_options --enable-lto" >> .mozconfig +%endif +# PGO build doesn't work with ccache +export CCACHE_DISABLE=1 +%endif + +MOZ_SMP_FLAGS=-j1 +# On x86_64 architectures, Mozilla can build up to 4 jobs at once in parallel, +# however builds tend to fail on other arches when building in parallel. +%ifarch %{ix86} +[ -z "$RPM_BUILD_NCPUS" ] && \ + RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +%endif +%ifarch x86_64 ppc ppc64 ppc64le %{arm} aarch64 +[ -z "$RPM_BUILD_NCPUS" ] && \ + RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" +[ "$RPM_BUILD_NCPUS" -ge 2 ] && MOZ_SMP_FLAGS=-j2 +[ "$RPM_BUILD_NCPUS" -ge 4 ] && MOZ_SMP_FLAGS=-j4 +[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 +[ "$RPM_BUILD_NCPUS" -ge 16 ] && MOZ_SMP_FLAGS=-j16 +[ "$RPM_BUILD_NCPUS" -ge 24 ] && MOZ_SMP_FLAGS=-j24 +%endif + +echo "mk_add_options MOZ_MAKE_FLAGS=\"$MOZ_SMP_FLAGS\"" >> .mozconfig +echo "mk_add_options MOZ_SERVICES_SYNC=1" >> .mozconfig +echo "export STRIP=/bin/true" >> .mozconfig +export MACH_USE_SYSTEM_PYTHON=1 +%if %{build_with_pgo} +%if %{pgo_wayland} +if [ -z "$XDG_RUNTIME_DIR" ]; then + export XDG_RUNTIME_DIR=$HOME +fi +xvfb-run mutter --wayland --nested & +if [ -z "$WAYLAND_DISPLAY" ]; then + export WAYLAND_DISPLAY=wayland-0 +else + export WAYLAND_DISPLAY=wayland-1 +fi +MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - +%else +GDK_BACKEND=x11 xvfb-run ./mach build 2>&1 | cat - +%endif +%else +./mach build -v 2>&1 | cat - +%endif + +# create debuginfo for crash-stats.mozilla.com +%if %{enable_mozilla_crashreporter} +make -C objdir buildsymbols +%endif + +%if %{?run_tests} +%if %{?system_nss} +ln -s %{_prefix}/bin/certutil objdir/dist/bin/certutil +ln -s %{_prefix}/bin/pk12util objdir/dist/bin/pk12util + +%endif +mkdir test_results +./mach --log-no-times check-spidermonkey &> test_results/check-spidermonkey || true +./mach --log-no-times check-spidermonkey &> test_results/check-spidermonkey-2nd-run || true +./mach --log-no-times cppunittest &> test_results/cppunittest || true +xvfb-run ./mach --log-no-times crashtest &> test_results/crashtest || true +./mach --log-no-times gtest &> test_results/gtest || true +xvfb-run ./mach --log-no-times jetpack-test &> test_results/jetpack-test || true +# not working right now ./mach marionette-test &> test_results/marionette-test || true +xvfb-run ./mach --log-no-times mochitest-a11y &> test_results/mochitest-a11y || true +xvfb-run ./mach --log-no-times mochitest-browser &> test_results/mochitest-browser || true +xvfb-run ./mach --log-no-times mochitest-chrome &> test_results/mochitest-chrome || true +xvfb-run ./mach --log-no-times mochitest-devtools &> test_results/mochitest-devtools || true +xvfb-run ./mach --log-no-times mochitest-plain &> test_results/mochitest-plain || true +xvfb-run ./mach --log-no-times reftest &> test_results/reftest || true +xvfb-run ./mach --log-no-times webapprt-test-chrome &> test_results/webapprt-test-chrome || true +xvfb-run ./mach --log-no-times webapprt-test-content &> test_results/webapprt-test-content || true +./mach --log-no-times webidl-parser-test &> test_results/webidl-parser-test || true +xvfb-run ./mach --log-no-times xpcshell-test &> test_results/xpcshell-test || true +%if %{?system_nss} +rm -f objdir/dist/bin/certutil +rm -f objdir/dist/bin/pk12util +%endif + +%endif +#--------------------------------------------------------------------- + +%install + +# set up our default bookmarks +%if !0%{?flatpak} +%{__cp} -p %{default_bookmarks_file} objdir/dist/bin/browser/chrome/en-US/locale/browser/bookmarks.html +%endif + +# Make sure locale works for langpacks +%{__cat} > objdir/dist/bin/browser/defaults/preferences/firefox-l10n.js << EOF +pref("general.useragent.locale", "chrome://global/locale/intl.properties"); +EOF + +DESTDIR=%{buildroot} make -C objdir install + +%{__mkdir_p} %{buildroot}{%{_libdir},%{_bindir},%{_datadir}/applications} + +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE20} +%if 0%{?wayland_backend_default} +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE31} +%endif +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE29} + +# set up the firefox start script +%if 0%{?wayland_backend_default} +%global wayland_default true +%else +%global wayland_default false +%endif +%{__rm} -rf %{buildroot}%{_bindir}/firefox +%{__sed} -e 's/__DEFAULT_WAYLAND__/%{wayland_default}/' \ + -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE21} > %{buildroot}%{_bindir}/firefox +%{__chmod} 755 %{buildroot}%{_bindir}/firefox + + +%if 0%{?flatpak} +sed -i -e 's|%FLATPAK_ENV_VARS%|export TMPDIR="$XDG_CACHE_HOME/tmp"|' %{buildroot}%{_bindir}/firefox +%else +sed -i -e 's|%FLATPAK_ENV_VARS%||' %{buildroot}%{_bindir}/firefox +%endif + +%if 0%{?wayland_backend_default} +%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE30} > %{buildroot}%{_bindir}/firefox-x11 +%{__chmod} 755 %{buildroot}%{_bindir}/firefox-x11 +%endif +%{__sed} -e 's,/__PREFIX__,%{_prefix},g' %{SOURCE28} > %{buildroot}%{_bindir}/firefox-wayland +%{__chmod} 755 %{buildroot}%{_bindir}/firefox-wayland + +%{__install} -p -D -m 644 %{SOURCE23} %{buildroot}%{_mandir}/man1/firefox.1 + +%{__rm} -f %{buildroot}/%{mozappdir}/firefox-config +%{__rm} -f %{buildroot}/%{mozappdir}/update-settings.ini + +for s in 16 22 24 32 48 256; do + %{__mkdir_p} %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps + %{__cp} -p browser/branding/official/default${s}.png \ + %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/firefox.png +done + +# Install hight contrast icon +%{__mkdir_p} %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps +%{__cp} -p %{SOURCE25} \ + %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps + +echo > %{name}.lang +%if %{with langpacks} +# Extract langpacks, make any mods needed, repack the langpack, and install it. +%{__mkdir_p} %{buildroot}%{langpackdir} +%{__tar} xf %{SOURCE1} +for langpack in `ls firefox-langpacks/*.xpi`; do + language=`basename $langpack .xpi` + extensionID=langpack-$language@firefox.mozilla.org + %{__mkdir_p} $extensionID + unzip -qq $langpack -d $extensionID + find $extensionID -type f | xargs chmod 644 + + cd $extensionID + zip -qq -r9mX ../${extensionID}.xpi * + cd - + + %{__install} -m 644 ${extensionID}.xpi %{buildroot}%{langpackdir} + language=`echo $language | sed -e 's/-/_/g'` +%if 0%{?flatpak} + echo "%{langpackdir}/${extensionID}.xpi" >> %{name}.lang +%else + echo "%%lang($language) %{langpackdir}/${extensionID}.xpi" >> %{name}.lang +%endif +done +%{__rm} -rf firefox-langpacks + +# Install langpack workaround (see #707100, #821169) +function create_default_langpack() { +language_long=$1 +language_short=$2 +cd %{buildroot}%{langpackdir} +ln -s langpack-$language_long@firefox.mozilla.org.xpi langpack-$language_short@firefox.mozilla.org.xpi +cd - +echo "%%lang($language_short) %{langpackdir}/langpack-$language_short@firefox.mozilla.org.xpi" >> %{name}.lang +} + +# Table of fallbacks for each language +# please file a bug at bugzilla.redhat.com if the assignment is incorrect +#create_default_langpack "bn-IN" "bn" +create_default_langpack "es-AR" "es" +create_default_langpack "fy-NL" "fy" +create_default_langpack "ga-IE" "ga" +create_default_langpack "gu-IN" "gu" +create_default_langpack "hi-IN" "hi" +create_default_langpack "hy-AM" "hy" +create_default_langpack "nb-NO" "nb" +create_default_langpack "nn-NO" "nn" +create_default_langpack "pa-IN" "pa" +create_default_langpack "pt-PT" "pt" +create_default_langpack "sv-SE" "sv" +create_default_langpack "zh-TW" "zh" +%endif + +%{__mkdir_p} %{buildroot}/%{mozappdir}/browser/defaults/preferences + +# System config dir +%{__mkdir_p} %{buildroot}/%{_sysconfdir}/%{name}/pref + +# System extensions +%{__mkdir_p} %{buildroot}%{_datadir}/mozilla/extensions/%{firefox_app_id} +%{__mkdir_p} %{buildroot}%{_libdir}/mozilla/extensions/%{firefox_app_id} + +# Copy over the LICENSE +%{__install} -p -c -m 644 LICENSE %{buildroot}/%{mozappdir} + +# Use the system hunspell dictionaries +%{__rm} -rf %{buildroot}%{mozappdir}/dictionaries +ln -s %{_datadir}/myspell %{buildroot}%{mozappdir}/dictionaries + +# Enable crash reporter for Firefox application +%if %{enable_mozilla_crashreporter} +sed -i -e "s/\[Crash Reporter\]/[Crash Reporter]\nEnabled=1/" %{buildroot}/%{mozappdir}/application.ini +# Add debuginfo for crash-stats.mozilla.com +%{__mkdir_p} %{buildroot}/%{moz_debug_dir} +%{__cp} objdir/dist/%{symbols_file_name} %{buildroot}/%{moz_debug_dir} +%endif + +%if %{run_tests} +# Add debuginfo for crash-stats.mozilla.com +%{__mkdir_p} %{buildroot}/test_results +%{__cp} test_results/* %{buildroot}/test_results +%endif + +# Default +%{__cp} %{SOURCE12} %{buildroot}%{mozappdir}/browser/defaults/preferences + +# Copy over run-mozilla.sh +%{__cp} build/unix/run-mozilla.sh %{buildroot}%{mozappdir} + +# Add distribution.ini +%{__mkdir_p} %{buildroot}%{mozappdir}/distribution +%{__cp} %{SOURCE26} %{buildroot}%{mozappdir}/distribution + +# Install appdata file +mkdir -p %{buildroot}%{_datadir}/metainfo +%{__sed} -e 's/__VERSION__/%{version}/' %{SOURCE33} > %{buildroot}%{_datadir}/metainfo/firefox.appdata.xml + +# Install Gnome search provider files +mkdir -p %{buildroot}%{_datadir}/gnome-shell/search-providers +%{__cp} %{SOURCE34} %{buildroot}%{_datadir}/gnome-shell/search-providers + +# Remove copied libraries to speed up build +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozjs.so +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libmozalloc.so +rm -f %{buildroot}%{mozappdirdev}/sdk/lib/libxul.so +#--------------------------------------------------------------------- + +# Moves defaults/preferences to browser/defaults/preferences +%pretrans -p +require 'posix' +require 'os' +if (posix.stat("%{mozappdir}/browser/defaults/preferences", "type") == "link") then + posix.unlink("%{mozappdir}/browser/defaults/preferences") + posix.mkdir("%{mozappdir}/browser/defaults/preferences") + if (posix.stat("%{mozappdir}/defaults/preferences", "type") == "directory") then + for i,filename in pairs(posix.dir("%{mozappdir}/defaults/preferences")) do + os.rename("%{mozappdir}/defaults/preferences/"..filename, "%{mozappdir}/browser/defaults/preferences/"..filename) + end + f = io.open("%{mozappdir}/defaults/preferences/README","w") + if f then + f:write("Content of this directory has been moved to %{mozappdir}/browser/defaults/preferences.") + f:close() + end + end +end + +%check +appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.appdata.xml + +%preun +# is it a final removal? +if [ $1 -eq 0 ]; then + %{__rm} -rf %{mozappdir}/components + %{__rm} -rf %{mozappdir}/extensions + %{__rm} -rf %{mozappdir}/plugins + %{__rm} -rf %{langpackdir} +fi + +%post +update-desktop-database &> /dev/null || : +touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : + +%postun +update-desktop-database &> /dev/null || : +if [ $1 -eq 0 ] ; then + touch --no-create %{_datadir}/icons/hicolor &>/dev/null + gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : +fi + +%posttrans +gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + +%files -f %{name}.lang +%{_bindir}/firefox +%{mozappdir}/firefox +%{mozappdir}/firefox-bin +%doc %{_mandir}/man1/* +%dir %{_sysconfdir}/%{name} +%dir %{_sysconfdir}/%{name}/* +%dir %{_datadir}/mozilla/extensions/* +%dir %{_libdir}/mozilla/extensions/* +%{_datadir}/applications/%{name}.desktop +%{_datadir}/metainfo/*.appdata.xml +%{_datadir}/gnome-shell/search-providers/*.ini +%dir %{mozappdir} +%license %{mozappdir}/LICENSE +%{mozappdir}/browser/chrome +%{mozappdir}/browser/defaults/preferences/firefox-redhat-default-prefs.js +%{mozappdir}/browser/features/*.xpi +%{mozappdir}/distribution/distribution.ini +# That's Windows only +%ghost %{mozappdir}/browser/features/aushelper@mozilla.org.xpi +%if %{with langpacks} +%dir %{langpackdir} +%endif +%{mozappdir}/browser/omni.ja +%{mozappdir}/run-mozilla.sh +%{mozappdir}/application.ini +%{mozappdir}/pingsender +%exclude %{mozappdir}/removed-files +%{_datadir}/icons/hicolor/16x16/apps/firefox.png +%{_datadir}/icons/hicolor/22x22/apps/firefox.png +%{_datadir}/icons/hicolor/24x24/apps/firefox.png +%{_datadir}/icons/hicolor/256x256/apps/firefox.png +%{_datadir}/icons/hicolor/32x32/apps/firefox.png +%{_datadir}/icons/hicolor/48x48/apps/firefox.png +%{_datadir}/icons/hicolor/symbolic/apps/firefox-symbolic.svg +%if %{enable_mozilla_crashreporter} +%{mozappdir}/crashreporter +%{mozappdir}/crashreporter.ini +%{mozappdir}/minidump-analyzer +%{mozappdir}/Throbber-small.gif +%{mozappdir}/browser/crashreporter-override.ini +%endif +%{mozappdir}/*.so +%{mozappdir}/gtk2/*.so +%{mozappdir}/defaults/pref/channel-prefs.js +%{mozappdir}/dependentlibs.list +%{mozappdir}/dictionaries +%{mozappdir}/omni.ja +%{mozappdir}/platform.ini +%{mozappdir}/plugin-container +%{mozappdir}/gmp-clearkey +%{mozappdir}/fonts/TwemojiMozilla.ttf +%if !%{?system_nss} +%exclude %{mozappdir}/libnssckbi.so +%endif +%if %{build_with_asan} +%{mozappdir}/llvm-symbolizer +%endif + +#--------------------------------------------------------------------- + +%changelog +* Mon Oct 12 2020 Martin Stransky - 81.0.2-2 +- Added a partial fox for rhbz#1886722 + +* Mon Oct 12 2020 Martin Stransky - 81.0.2-1 +- Updated to latest upstream - 81.0.2 + +* Thu Oct 8 2020 Martin Stransky - 81.0.1-9 +- Added an updated fix for mozbz#1656727 + +* Thu Oct 8 2020 Martin Stransky - 81.0.1-8 +- Added fixes for mozbz#1634404, mozbz#1669495 + +* Thu Oct 8 2020 Martin Stransky - 81.0.1-7 +- Removed mozbz#1656727 as it causes a regression rhbz#1886243 + +* Wed Oct 7 2020 Martin Stransky - 81.0.1-6 +- PGO patch update +- Added fix for mzbz#1669442 (LTO builds) + +* Mon Oct 5 2020 Martin Stransky - 81.0.1-5 +- Added fix for mozbz#1656727 + +* Fri Oct 2 2020 Martin Stransky - 81.0.1-4 +- Added fix for mozbz#1668771 + +* Thu Oct 1 2020 Martin Stransky - 81.0.1-3 +- Added fix for mozbz#1661192 + +* Thu Oct 1 2020 Martin Stransky - 81.0.1-2 +- Added fix for mozbz#1640567 +- Enable PGO + +* Wed Sep 30 2020 Martin Stransky - 81.0.1-1 +- Updated to 81.0.1 + +* Wed Sep 30 2020 Martin Stransky - 81.0-9 +- Disabled openh264 download +- Removed fdk-aac-free dependency (rhbz#1883672) +- Enabled LTO + +* Sat Sep 26 2020 Dan Horák - 81.0-8 +- Re-enable builds for ppc64le + +* Fri Sep 25 2020 Martin Stransky - 81.0-7 +- Added openh264 fixes + +* Wed Sep 23 2020 Martin Stransky - 81.0-6 +- Added fix for rhbz#1731371 + +* Tue Sep 22 2020 Kalev Lember - 81.0-5 +- Re-enable builds for armv7hl and aarch64 architectures + +* Tue Sep 22 2020 Kalev Lember - 81.0-4 +- Disable LTO to work around firefox build failing in F33+ + +* Mon Sep 21 2020 Martin Stransky - 81.0-3 +- Updated to 81.0 Build 2 +- Updated firefox-disable-ffvpx-with-vapi patch +- Deleted old changelog entries + +* Thu Sep 17 2020 Martin Stransky - 81.0-2 +- Added upstream patches mzbz#1665324 mozbz#1665329 +- Updated requested nss version to 3.56 + +* Tue Sep 15 2020 Martin Stransky - 81.0-1 +- Updated to 81.0 + +* Thu Sep 10 2020 Martin Stransky - 80.0.1-3 +- Test build for all arches. + +* Fri Sep 4 2020 Martin Stransky - 80.0.1-2 +- Added patch for mozbz#1875469 + +* Tue Sep 1 2020 Martin Stransky - 80.0.1-1 +- Updated to 80.0.1 + +* Tue Aug 18 2020 Martin Stransky - 80.0-1 +- Updated to 80.0 Build 2 +- Go back to gcc +- Disabled WebGL dmabuf backend due to reported errors + (mzbz#1655323, mozbz#1656505). + +* Tue Aug 18 2020 Martin Stransky - 79.0-6 +- Enabled pgo +- Build with clang + +* Tue Aug 4 2020 Martin Stransky - 79.0-5 +- Added upstream fix for mozbz#1656436. + +* Mon Aug 3 2020 Martin Stransky - 79.0-4 +- Updated fix for mozbz#1645671 + +* Thu Jul 30 2020 Martin Stransky - 79.0-3 +- Added VA-API fix for mozbz#1645671 + +* Wed Jul 29 2020 Martin Stransky - 79.0-2 +- Try to enable armv7hl again. +- Disabled ppc64le due to cargo crash (rhbz#1862012). + +* Mon Jul 27 2020 Martin Stransky - 79.0-1 +- Update to 79.0 +- Disabled PGO due to rhbz#1849165 (gcc internal error). + +* Mon Jul 27 2020 Fedora Release Engineering - 78.0.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jul 23 2020 Frantisek Zatloukal - 78.0-4 +- Use python3 instead of python2 for build + +* Tue Jul 21 2020 Martin Stransky - 78.0-3 +- Added fix for mozbz#1651701/rhbz#1855730 + +* Fri Jul 10 2020 Jan Horak - 78.0.2-2 +- Fixing clang build - linker setup + +* Thu Jul 09 2020 Jan Horak - 78.0.2-1 +- Update to 78.0.2 build2 + +* Wed Jul 01 2020 Jan Horak - 78.0.1-1 +- Update to 78.0.1 build1 + +* Wed Jul 1 2020 Martin Stransky - 78.0-2 +- Add 'Open the Profile Manager' desktop file entry + +* Mon Jun 29 2020 Jan Horak - 78.0-1 +- Update to 78.0 build2 + +* Tue Jun 23 2020 Martin Stransky - 77.0.1-3 +- Build with PGO/LTO again. + +* Wed Jun 03 2020 Jan Horak - 77.0.1-2 +- Update to 77.0.1 build1 + +* Wed Jun 03 2020 Jan Horak - 77.0.1-1 +- Fixing pipewire patch +- New upstream version (77.0.1) + +* Tue Jun 2 2020 Martin Stransky - 77.0-2 +- Rebuild with updated langpacks (rhbz#1843028). + +* Fri May 29 2020 Martin Stransky - 77.0-1 +- Updated to Firefox 77.0 + +* Mon May 25 2020 Martin Stransky - 76.0.1-7 +- Added fix for mozbz#1632456 + +* Mon May 25 2020 Martin Stransky - 76.0.1-6 +- Added fix for mozbz#1634213 + +* Mon May 25 2020 Martin Stransky - 76.0.1-5 +- Added fix for mozbz#1619882 - video flickering when va-api is used. + +* Thu May 21 2020 Jan Grulich - 76.0.1-4 +- Add support for PipeWire 0.3 + +* Wed May 20 2020 Peter Robinson - 76.0.1-3 +- Build aarch64 again so aarch64 users get updates + +* Wed May 13 2020 Martin Stransky - 76.0.1-2 +- Added extra va-api frames to vp8/9 decoder. + +* Fri May 8 2020 Martin Stransky - 76.0.1-1 +- Updated to 76.0.1 + +* Thu May 7 2020 Martin Stransky - 76.0-3 +- Disable ffvpx when va-api is enabled. + +* Tue May 05 2020 Jan Horak - 76.0-2 +- Don't use google safe browsing api key for the geolocation + +* Sun May 3 2020 Martin Stransky - 76.0-1 +- Updated to 76.0 + +* Thu Apr 23 2020 Martin Stransky - 75.0-3 +- Added fix for mozilla bug #1527976 (browser D&D) + +* Tue Apr 14 2020 Jan Horak - 75.0-2 +- Removed gconf-2.0 build requirement + +* Mon Apr 06 2020 Martin Stransky - 75.0-1 +- Updated to 75.0 + +* Mon Apr 06 2020 Martin Stransky - 74.0.1-3 +- Added fix for mozbz#1627469 + +* Mon Apr 06 2020 Jan Horak - 74.0.1-2 +- Fixing pipewire patch + +* Sat Apr 4 2020 Martin Stransky - 74.0.1-1 +- Updated to latest upstream +- Added fix for mozbz#1624745 + +* Wed Apr 1 2020 Martin Stransky - 74.0-14 +- Added fixes to gnome shell search provider + +* Tue Mar 31 2020 Jan Horak - 74.0-13 +- Allow addons sideload to fix missing langpacks issues + +* Thu Mar 19 2020 Martin Stransky - 74.0-12 +- Added fix for rhbz#1814850 by Daniel Rusek + +* Tue Mar 17 2020 Martin Stransky - 74.0-11 +- Added fix for mozbz#1623106 + +* Tue Mar 17 2020 Martin Stransky - 74.0-9 +- Added fix for mozbz#1623060 + +* Tue Mar 17 2020 Jan Grulich - 74-0-8 +- Add support for window sharing + +* Mon Mar 16 2020 Martin Stransky - 74.0-7 +- Use D-Bus remote exclusively for both X11 and Wayland backends + when WAYLAND_DISPLAY is present. + +* Fri Mar 13 2020 Martin Stransky - 74.0-6 +- Added fix for mozbz#1615098 + +* Thu Mar 12 2020 Martin Stransky - 74.0-5 +- Added fix for mozbz#1196777 + +* Tue Mar 10 2020 Kalev Lember - 74.0-4 +- Remove unused libIDL build dep +- Disabled arm due to build failures + +* Tue Mar 10 2020 Martin Stransky - 74.0-3 +- Update to 74.0 Build 3 + +* Mon Mar 09 2020 Martin Stransky - 74.0-2 +- Update to 74.0 Build 2 + +* Tue Mar 03 2020 Martin Stransky - 74.0-1 +- Update to 74.0 Build 1 +- Added mozbz#1609538 + +* Mon Feb 24 2020 Martin Stransky - 73.0.1-4 +- Using pipewire-0.2 as buildrequire +- Added armv7hl fixes by Gabriel Hojda + +* Mon Feb 24 2020 Martin Stransky - 73.0.1-2 +- Fixed Bug 1804787 - Some .desktop menu entries unlocalized + +* Thu Feb 20 2020 Martin Stransky - 73.0.1-1 +- Update to 73.0.1 + +* Tue Feb 11 2020 Jan Horak - 73.0-1 +- Update to 73.0 build3 + +* Tue Feb 04 2020 Kalev Lember - 72.0.2-3 +- Fix various issues with appdata, making the validation pass again +- Validate appdata during the build +- Make sure the release tag in appdata is in sync with the package version + +* Tue Jan 28 2020 Fedora Release Engineering - 72.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Jan 20 2020 Jan Horak - 72.0.2-1 +- Update to 72.0.2 build1 + +* Wed Jan 15 2020 Jan Horak - 72.0.1-2 +- Added fix for wrong cursor offset of popup windows and bumped required nss + version + +* Wed Jan 08 2020 Jan Horak - 72.0.1-1 +- Update to 72.0.1 build1 + +* Mon Jan 06 2020 Jan Horak - 72.0-2 +- Update to 72.0 build4 + +* Fri Jan 03 2020 Jan Horak - 72.0-1 +- Update to 72.0 build3 + +* Wed Dec 18 2019 Jan Horak - 71.0-17 +- Fix for wrong intl.accept_lang when using non en-us langpack + +* Mon Dec 9 2019 Martin Stransky - 71.0-16 +- Build with asan + +* Mon Dec 9 2019 Martin Stransky - 71.0-15 +- Enabled Mozilla crash reporter +- Enabled PGO builds + +* Mon Dec 9 2019 Martin Stransky - 71.0-14 +- Updated workaround for mzbz#1601707 + +* Sat Dec 7 2019 Martin Stransky - 71.0-13 +- Built with -fno-lifetime-dse + +* Fri Dec 6 2019 Martin Stransky - 71.0-12 +- Clang test build, should fix extension breakage + +* Fri Dec 6 2019 Martin Stransky - 71.0-11 +- Added workaround for: + https://bugzilla.mozilla.org/show_bug.cgi?id=1601707 + http://gcc.gnu.org/PR92831 + +* Fri Dec 6 2019 Martin Stransky - 71.0-10 +- Remove appdata and ship metainfo only + +* Wed Dec 4 2019 Martin Stransky - 71.0-9 +- Included kiosk mode workaround (mozbz#1594738) + +* Tue Dec 3 2019 Martin Stransky - 71.0-8 +- Disabled PGO due to startup crash + +* Mon Dec 2 2019 Martin Stransky - 71.0-7 +- Updated to 71.0 Build 5 +- Updated Gnome search provider + +* Wed Nov 27 2019 Martin Stransky - 71.0-6 +- Enable Gnome search provider + +* Wed Nov 27 2019 Martin Stransky - 71.0-5 +- Added fix for mozbz#1593408 +- Temporary disable Gnome search provider + +* Tue Nov 26 2019 Martin Stransky - 71.0-2 +- Enable Gnome search provider + +* Tue Nov 26 2019 Martin Stransky - 71.0-1 +- Updated to 71.0 Build 2 + +* Tue Nov 19 2019 Jan Horak - 70.0.1-5 +- Added fixes for missing popup and overflow widget glitches + +* Mon Nov 04 2019 Jan Horak - 70.0.1-4 +- Added fix for non-scrollable popups + +* Fri Nov 1 2019 Martin Stransky - 70.0.1-1 +- Updated to 70.0.1 +- Built with system-nss (reverted 70.0-2 change). + +* Thu Oct 31 2019 Martin Stransky - 70.0-2 +- Switched to in-tree nss due to rhbz#1752303 + +* Tue Oct 15 2019 Martin Stransky - 70.0-1 +- Updated to 70.0 diff --git a/gen_cbindgen-vendor.sh b/gen_cbindgen-vendor.sh new file mode 100755 index 0000000..8ddb8cd --- /dev/null +++ b/gen_cbindgen-vendor.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -x + +# Dummy Cargo.toml file with cbindgen dependency +cat > Cargo.toml </pref ++ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, ++ getter_AddRefs(jsFile)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = jsFile->AppendNative(nsLiteralCString("pref")); ++ NS_ENSURE_SUCCESS(rv, rv); ++ rv = jsFile->AppendNative(nsDependentCString(aFileName)); ++ NS_ENSURE_SUCCESS(rv, rv); + ++ rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } + } else { + nsAutoCString location("resource://gre/defaults/autoconfig/"); + location += aFileName; +diff -up firefox-75.0/modules/libpref/Preferences.cpp.1170092 firefox-75.0/modules/libpref/Preferences.cpp +--- firefox-75.0/modules/libpref/Preferences.cpp.1170092 2020-04-06 22:40:02.761674865 +0200 ++++ firefox-75.0/modules/libpref/Preferences.cpp 2020-04-06 22:40:57.675325227 +0200 +@@ -4468,6 +4468,9 @@ nsresult Preferences::InitInitialObjects + // + // Thus, in the omni.jar case, we always load app-specific default + // preferences from omni.jar, whether or not `$app == $gre`. ++ // ++ // At very end load configuration from system config location: ++ // - /etc/firefox/pref/*.js + + nsresult rv = NS_ERROR_FAILURE; + UniquePtr find; +diff -up firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-75.0/toolkit/xre/nsXREDirProvider.cpp +--- firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2020-04-03 21:35:39.000000000 +0200 ++++ firefox-75.0/toolkit/xre/nsXREDirProvider.cpp 2020-04-06 22:40:02.761674865 +0200 +@@ -60,6 +60,7 @@ + #endif + #ifdef XP_UNIX + # include ++# include "nsIXULAppInfo.h" + #endif + #ifdef XP_IOS + # include "UIKitDirProvider.h" +@@ -533,6 +534,21 @@ nsXREDirProvider::GetFile(const char* aP + } + } + } ++ ++#if defined(XP_UNIX) ++ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) { ++ nsCString sysConfigDir = nsLiteralCString("/etc/"); ++ nsCOMPtr appInfo = do_GetService("@mozilla.org/xre/app-info;1"); ++ if (!appInfo) ++ return NS_ERROR_NOT_AVAILABLE; ++ nsCString appName; ++ appInfo->GetName(appName); ++ ToLowerCase(appName); ++ sysConfigDir.Append(appName); ++ return NS_NewNativeLocalFile(sysConfigDir, false, aFile); ++ } ++#endif ++ + if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE; + + if (ensureFilePermissions) { +@@ -845,6 +861,16 @@ nsresult nsXREDirProvider::GetFilesInter + + LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories); + ++ // Add /etc//pref/ directory if it exists ++ nsCOMPtr systemPrefDir; ++ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR, ++ getter_AddRefs(systemPrefDir)); ++ if (NS_SUCCEEDED(rv)) { ++ rv = systemPrefDir->AppendNative(nsLiteralCString("pref")); ++ if (NS_SUCCEEDED(rv)) ++ directories.AppendObject(systemPrefDir); ++ } ++ + rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile)); + } else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) { + // NS_APP_CHROME_DIR_LIST is only used to get default (native) icons +diff -up firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h +--- firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2020-04-03 21:35:39.000000000 +0200 ++++ firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h 2020-04-06 22:40:02.761674865 +0200 +@@ -60,6 +60,7 @@ + #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL" + #define NS_APP_PREFS_OVERRIDE_DIR \ + "PrefDOverride" // Directory for per-profile defaults ++#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration + + #define NS_APP_USER_PROFILE_50_DIR "ProfD" + #define NS_APP_USER_PROFILE_LOCAL_50_DIR "ProfLD" diff --git a/mozilla-1196777.patch b/mozilla-1196777.patch new file mode 100644 index 0000000..721c897 --- /dev/null +++ b/mozilla-1196777.patch @@ -0,0 +1,13 @@ +diff -up firefox-80.0/widget/gtk/nsWindow.cpp.1196777 firefox-80.0/widget/gtk/nsWindow.cpp +--- firefox-80.0/widget/gtk/nsWindow.cpp.1196777 2020-08-18 09:47:18.662833910 +0200 ++++ firefox-80.0/widget/gtk/nsWindow.cpp 2020-08-18 09:48:19.437478136 +0200 +@@ -158,7 +158,8 @@ const gint kEvents = + GDK_EXPOSURE_MASK | GDK_STRUCTURE_MASK | GDK_VISIBILITY_NOTIFY_MASK | + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | +- GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK; ++ GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK | ++ GDK_FOCUS_CHANGE_MASK; + + #if !GTK_CHECK_VERSION(3, 22, 0) + typedef enum { diff --git a/mozilla-1516803.patch b/mozilla-1516803.patch new file mode 100644 index 0000000..f1f37f4 --- /dev/null +++ b/mozilla-1516803.patch @@ -0,0 +1,16 @@ +diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build +--- a/security/sandbox/linux/moz.build ++++ b/security/sandbox/linux/moz.build +@@ -99,9 +99,8 @@ + # gcc lto likes to put the top level asm in syscall.cc in a different partition + # from the function using it which breaks the build. Work around that by + # forcing there to be only one partition. +-for f in CONFIG['OS_CXXFLAGS']: +- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang': +- LDFLAGS += ['--param lto-partitions=1'] ++if CONFIG['CC_TYPE'] != 'clang': ++ LDFLAGS += ['--param', 'lto-partitions=1'] + + DEFINES['NS_NO_XPCOM'] = True + DisableStlWrapping() + diff --git a/mozilla-1634404.patch b/mozilla-1634404.patch new file mode 100644 index 0000000..75ea8ce --- /dev/null +++ b/mozilla-1634404.patch @@ -0,0 +1,20 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1593,7 +1593,14 @@ + // Get anchor rectangle + LayoutDeviceIntRect anchorRect(0, 0, 0, 0); + nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame()); +- int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor(); ++ ++ int32_t p2a; ++ double devPixelsPerCSSPixel = StaticPrefs::layout_css_devPixelsPerPx(); ++ if (devPixelsPerCSSPixel > 0.0) { ++ p2a = AppUnitsPerCSSPixel() / devPixelsPerCSSPixel * GdkScaleFactor(); ++ } else { ++ p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor(); ++ } + if (popupFrame) { + #ifdef MOZ_WAYLAND + anchorRect = LayoutDeviceIntRect::FromAppUnitsToOutside( + diff --git a/mozilla-1640567.patch b/mozilla-1640567.patch new file mode 100644 index 0000000..c1f3f44 --- /dev/null +++ b/mozilla-1640567.patch @@ -0,0 +1,18 @@ +diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp +--- a/layout/xul/nsMenuPopupFrame.cpp ++++ b/layout/xul/nsMenuPopupFrame.cpp +@@ -1422,11 +1422,9 @@ + !GDK_IS_X11_DISPLAY(gdk_display_get_default())) { + screenPoint = nsPoint(anchorRect.x, anchorRect.y); + mAnchorRect = anchorRect; +- } else ++ } + #endif +- { +- screenPoint = AdjustPositionForAnchorAlign(anchorRect, hFlip, vFlip); +- } ++ screenPoint = AdjustPositionForAnchorAlign(anchorRect, hFlip, vFlip); + } else { + // with no anchor, the popup is positioned relative to the root frame + anchorRect = rootScreenRect; + diff --git a/mozilla-1640982.patch b/mozilla-1640982.patch new file mode 100644 index 0000000..b63ba3b --- /dev/null +++ b/mozilla-1640982.patch @@ -0,0 +1,16 @@ +diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk +--- a/config/makefiles/rust.mk ++++ b/config/makefiles/rust.mk +@@ -61,7 +61,11 @@ + # Enable link-time optimization for release builds, but not when linking + # gkrust_gtest. + ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE))) ++# Pass -Clto for older versions of rust, and CARGO_PROFILE_RELEASE_LTO=true ++# for newer ones that support it. Combining the latter with -Clto works, so ++# set both everywhere. + cargo_rustc_flags += -Clto ++export CARGO_PROFILE_RELEASE_LTO=true + endif + endif + endif + diff --git a/mozilla-1645671.patch b/mozilla-1645671.patch new file mode 100644 index 0000000..0943469 --- /dev/null +++ b/mozilla-1645671.patch @@ -0,0 +1,67 @@ +changeset: 544864:a8603f131703 +tag: tip +parent: 544861:161920b70ae4 +user: Martin Stransky +date: Fri Jul 31 13:39:48 2020 +0200 +files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +description: +Bug 1645671 [Linux/VA-API] Create DMABufSurfaceWrapper directly at nsTAttay and disable DMABufSurfaceWrapper class copy and assignment constructors, r?jya + +When DMABufSurfaceWrapper is added to nsTArray, a temporary local DMABufSurfaceWrapper object is created. When the temporary +object is deleted after the adding, associated dmabuf data is released which leads to rendering artifact during VA-API video playback. + +As a fix in this patch we create DMABufSurfaceWrapper 'in-place' at nsTAttay. +We also disable DMABufSurfaceWrapper class copy and assignment constructors to avoid similar potential issues. + +Differential Revision: https://phabricator.services.mozilla.com/D85152 + + +diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp ++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +@@ -777,17 +777,17 @@ MediaResult FFmpegVideoDecoderSetUID(++uid); + FFMPEG_LOG("Created new DMABufSurface UID = %d", uid); + # endif +- mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib)); ++ mDMABufSurfaces.EmplaceBack(surface, mLib); + surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]); + } else { + surface = surfaceWrapper->GetDMABufSurface(); + bool ret; + + if (mVAAPIDeviceContext) { + ret = surface->UpdateYUVData(vaDesc); + } else { +diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h ++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h +@@ -70,16 +70,22 @@ class DMABufSurfaceWrapper final { + // Check if DMABufSurface is used by any gecko rendering process + // (WebRender or GL compositor) or by DMABUFSurfaceImage/VideoData. + bool IsUsed() const { return mSurface->IsGlobalRefSet(); } + + RefPtr GetDMABufSurface() const { + return mSurface->GetAsDMABufSurfaceYUV(); + } + ++ // Don't allow DMABufSurfaceWrapper plain copy as it leads to ++ // enexpected DMABufSurface/HW buffer releases and we don't want to ++ // deep copy them. ++ DMABufSurfaceWrapper(const DMABufSurfaceWrapper&) = delete; ++ const DMABufSurfaceWrapper& operator=(DMABufSurfaceWrapper const&) = delete; ++ + private: + const RefPtr mSurface; + const FFmpegLibWrapper* mLib; + AVBufferRef* mAVHWFramesContext; + AVBufferRef* mHWAVBuffer; + }; + #endif + + diff --git a/mozilla-1656505-1.patch b/mozilla-1656505-1.patch new file mode 100644 index 0000000..23ec35c --- /dev/null +++ b/mozilla-1656505-1.patch @@ -0,0 +1,15 @@ +diff --git a/widget/gtk/DMABufLibWrapper.cpp b/widget/gtk/DMABufLibWrapper.cpp +--- a/widget/gtk/DMABufLibWrapper.cpp ++++ b/widget/gtk/DMABufLibWrapper.cpp +@@ -149,8 +149,8 @@ + } + + nsDMABufDevice::nsDMABufDevice() +- : mXRGBFormat({true, false, GBM_FORMAT_ARGB8888, nullptr, 0}), +- mARGBFormat({true, true, GBM_FORMAT_XRGB8888, nullptr, 0}), ++ : mXRGBFormat({true, false, GBM_FORMAT_XRGB8888, nullptr, 0}), ++ mARGBFormat({true, true, GBM_FORMAT_ARGB8888, nullptr, 0}), + mGbmDevice(nullptr), + mGbmFd(-1), + mGdmConfigured(false), + diff --git a/mozilla-1656505-2.patch b/mozilla-1656505-2.patch new file mode 100644 index 0000000..48ee37b --- /dev/null +++ b/mozilla-1656505-2.patch @@ -0,0 +1,113 @@ +diff -up firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp.1656505-2 firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp +--- firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp.1656505-2 2020-09-15 03:48:28.000000000 +0200 ++++ firefox-81.0/gfx/gl/SharedSurfaceDMABUF.cpp 2020-09-15 18:13:03.683458125 +0200 +@@ -63,6 +63,8 @@ UniquePtr Surface + return dmabufFactory; + } + ++ LOGDMABUF( ++ ("SurfaceFactory_DMABUF::Create() failed, fallback to SW buffers.\n")); + gfxPlatformGtk::GetPlatform()->DisableDMABufWebGL(); + return nullptr; + } +diff -up firefox-81.0/widget/gtk/DMABufSurface.cpp.1656505-2 firefox-81.0/widget/gtk/DMABufSurface.cpp +--- firefox-81.0/widget/gtk/DMABufSurface.cpp.1656505-2 2020-09-15 03:48:38.000000000 +0200 ++++ firefox-81.0/widget/gtk/DMABufSurface.cpp 2020-09-15 18:13:03.683458125 +0200 +@@ -26,6 +26,7 @@ + #include "GLContextTypes.h" // for GLContext, etc + #include "GLContextEGL.h" + #include "GLContextProvider.h" ++#include "ScopedGLHelpers.h" + + #include "mozilla/layers/LayersSurfaces.h" + +@@ -320,6 +321,9 @@ bool DMABufSurfaceRGBA::Create(int aWidt + mWidth = aWidth; + mHeight = aHeight; + ++ LOGDMABUF(("DMABufSurfaceRGBA::Create() UID %d size %d x %d\n", mUID, mWidth, ++ mHeight)); ++ + mGmbFormat = GetDMABufDevice()->GetGbmFormat(mSurfaceFlags & DMABUF_ALPHA); + if (!mGmbFormat) { + // Requested DRM format is not supported. +@@ -329,6 +333,7 @@ bool DMABufSurfaceRGBA::Create(int aWidt + bool useModifiers = (aDMABufSurfaceFlags & DMABUF_USE_MODIFIERS) && + mGmbFormat->mModifiersCount > 0; + if (useModifiers) { ++ LOGDMABUF((" Creating with modifiers\n")); + mGbmBufferObject[0] = nsGbmLib::CreateWithModifiers( + GetDMABufDevice()->GetGbmDevice(), mWidth, mHeight, mGmbFormat->mFormat, + mGmbFormat->mModifiers, mGmbFormat->mModifiersCount); +@@ -360,6 +365,7 @@ bool DMABufSurfaceRGBA::Create(int aWidt + } + + if (!mGbmBufferObject[0]) { ++ LOGDMABUF((" Failed to create GbmBufferObject\n")); + return false; + } + +@@ -429,6 +435,8 @@ void DMABufSurfaceRGBA::ImportSurfaceDes + if (desc.refCount().Length() > 0) { + GlobalRefCountImport(desc.refCount()[0].ClonePlatformHandle().release()); + } ++ ++ LOGDMABUF(("DMABufSurfaceRGBA::Import() UID %d\n", mUID)); + } + + bool DMABufSurfaceRGBA::Create(const SurfaceDescriptor& aDesc) { +@@ -448,6 +456,8 @@ bool DMABufSurfaceRGBA::Serialize( + AutoTArray fenceFDs; + AutoTArray refCountFDs; + ++ LOGDMABUF(("DMABufSurfaceRGBA::Serialize() UID %d\n", mUID)); ++ + width.AppendElement(mWidth); + height.AppendElement(mHeight); + format.AppendElement(mGmbFormat->mFormat); +@@ -469,7 +479,6 @@ bool DMABufSurfaceRGBA::Serialize( + SurfaceDescriptorDMABuf(mSurfaceType, mBufferModifier, mGbmBufferFlags, + fds, width, height, format, strides, offsets, + GetYUVColorSpace(), fenceFDs, mUID, refCountFDs); +- + return true; + } + +@@ -556,7 +565,7 @@ bool DMABufSurfaceRGBA::CreateTexture(GL + + aGLContext->MakeCurrent(); + aGLContext->fGenTextures(1, &mTexture); +- aGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture); ++ const ScopedBindTexture savedTex(aGLContext, mTexture); + aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, + LOCAL_GL_CLAMP_TO_EDGE); + aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, +@@ -567,6 +576,7 @@ bool DMABufSurfaceRGBA::CreateTexture(GL + LOCAL_GL_LINEAR); + aGLContext->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mEGLImage); + mGL = aGLContext; ++ + return true; + } + +@@ -611,6 +621,10 @@ void* DMABufSurface::MapInternal(uint32_ + return nullptr; + } + ++ LOGDMABUF( ++ ("DMABufSurfaceRGBA::MapInternal() UID %d size %d x %d -> %d x %d\n", ++ mUID, aX, aY, aWidth, aHeight)); ++ + mMappedRegionStride[aPlane] = 0; + mMappedRegionData[aPlane] = nullptr; + mMappedRegion[aPlane] = nsGbmLib::Map( +@@ -988,7 +1002,7 @@ bool DMABufSurfaceYUV::CreateTexture(GLC + + aGLContext->MakeCurrent(); + aGLContext->fGenTextures(1, &mTexture[aPlane]); +- aGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture[aPlane]); ++ const ScopedBindTexture savedTex(aGLContext, mTexture[aPlane]); + aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, + LOCAL_GL_CLAMP_TO_EDGE); + aGLContext->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, + diff --git a/mozilla-1656727.patch b/mozilla-1656727.patch new file mode 100644 index 0000000..586fa9d --- /dev/null +++ b/mozilla-1656727.patch @@ -0,0 +1,213 @@ +diff -up firefox-81.0.1/widget/gtk/WindowSurfaceWayland.cpp.1656727 firefox-81.0.1/widget/gtk/WindowSurfaceWayland.cpp +--- firefox-81.0.1/widget/gtk/WindowSurfaceWayland.cpp.1656727 2020-10-08 11:35:41.921508799 +0200 ++++ firefox-81.0.1/widget/gtk/WindowSurfaceWayland.cpp 2020-10-08 11:37:05.036686876 +0200 +@@ -158,7 +158,6 @@ We allocate shared memory (shm) by mmap( + between us and wayland compositor. We draw our graphics data to the shm and + handle to wayland compositor by WindowBackBuffer/WindowSurfaceWayland + (wl_buffer/wl_surface). +- + */ + + #define EVENT_LOOP_DELAY (1000 / 240) +@@ -166,6 +165,44 @@ handle to wayland compositor by WindowBa + #define BUFFER_BPP 4 + gfx::SurfaceFormat WindowBackBuffer::mFormat = gfx::SurfaceFormat::B8G8R8A8; + ++static mozilla::Mutex* gDelayedCommitLock = nullptr; ++static GList* gDelayedCommits = nullptr; ++ ++static void DelayedCommitsEnsureMutext() { ++ if (!gDelayedCommitLock) { ++ gDelayedCommitLock = new mozilla::Mutex("DelayedCommit lock"); ++ } ++} ++ ++static bool DelayedCommitsCheckAndRemoveSurface( ++ WindowSurfaceWayland* aSurface) { ++ MutexAutoLock lock(*gDelayedCommitLock); ++ GList* foundCommit = g_list_find(gDelayedCommits, aSurface); ++ if (foundCommit) { ++ gDelayedCommits = g_list_delete_link(gDelayedCommits, foundCommit); ++ } ++ return foundCommit != nullptr; ++} ++ ++static bool DelayedCommitsCheckAndAddSurface(WindowSurfaceWayland* aSurface) { ++ MutexAutoLock lock(*gDelayedCommitLock); ++ GList* foundCommit = g_list_find(gDelayedCommits, aSurface); ++ if (!foundCommit) { ++ gDelayedCommits = g_list_prepend(gDelayedCommits, aSurface); ++ } ++ return foundCommit == nullptr; ++} ++ ++// When a new window is created we may not have a valid wl_surface ++// for drawing (Gtk haven't created it yet). All commits are queued ++// and CommitWaylandBuffer() is called by timer when wl_surface is ready ++// for drawing. ++static void WaylandBufferDelayCommitHandler(WindowSurfaceWayland* aSurface) { ++ if (DelayedCommitsCheckAndRemoveSurface(aSurface)) { ++ aSurface->CommitWaylandBuffer(); ++ } ++} ++ + nsWaylandDisplay* WindowBackBuffer::GetWaylandDisplay() { + return mWindowSurfaceWayland->GetWaylandDisplay(); + } +@@ -398,7 +435,6 @@ WindowSurfaceWayland::WindowSurfaceWayla + mWaylandFullscreenDamage(false), + mFrameCallback(nullptr), + mLastCommittedSurface(nullptr), +- mDelayedCommitHandle(nullptr), + mLastCommitTime(0), + mDrawToWaylandBufferDirectly(true), + mCanSwitchWaylandBuffer(true), +@@ -410,6 +446,7 @@ WindowSurfaceWayland::WindowSurfaceWayla + for (int i = 0; i < BACK_BUFFER_NUM; i++) { + mShmBackupBuffer[i] = nullptr; + } ++ DelayedCommitsEnsureMutext(); + } + + WindowSurfaceWayland::~WindowSurfaceWayland() { +@@ -417,12 +454,9 @@ WindowSurfaceWayland::~WindowSurfaceWayl + NS_WARNING("Deleted WindowSurfaceWayland with a pending commit!"); + } + +- if (mDelayedCommitHandle) { +- // Delete reference to this to prevent WaylandBufferDelayCommitHandler() +- // operate on released this. mDelayedCommitHandle itself will +- // be released at WaylandBufferDelayCommitHandler(). +- *mDelayedCommitHandle = nullptr; +- } ++ // Delete reference to this to prevent WaylandBufferDelayCommitHandler() ++ // operate on released this. ++ DelayedCommitsCheckAndRemoveSurface(this); + + if (mFrameCallback) { + wl_callback_destroy(mFrameCallback); +@@ -863,23 +897,11 @@ bool WindowSurfaceWayland::CommitImageCa + return true; + } + +-static void WaylandBufferDelayCommitHandler(WindowSurfaceWayland** aSurface) { +- if (*aSurface) { +- (*aSurface)->DelayedCommitHandler(); +- } else { +- // Referenced WindowSurfaceWayland is already deleted. +- // Do nothing but just release the mDelayedCommitHandle allocated at +- // WindowSurfaceWayland::CommitWaylandBuffer(). +- free(aSurface); +- } +-} +- + void WindowSurfaceWayland::CommitWaylandBuffer() { + LOGWAYLAND(("WindowSurfaceWayland::CommitWaylandBuffer [%p]\n", (void*)this)); + LOGWAYLAND( + (" mDrawToWaylandBufferDirectly = %d\n", mDrawToWaylandBufferDirectly)); + LOGWAYLAND((" mCanSwitchWaylandBuffer = %d\n", mCanSwitchWaylandBuffer)); +- LOGWAYLAND((" mDelayedCommitHandle = %p\n", mDelayedCommitHandle)); + LOGWAYLAND((" mFrameCallback = %p\n", mFrameCallback)); + LOGWAYLAND((" mLastCommittedSurface = %p\n", mLastCommittedSurface)); + LOGWAYLAND((" mBufferPendingCommit = %d\n", mBufferPendingCommit)); +@@ -915,16 +937,10 @@ void WindowSurfaceWayland::CommitWayland + MOZ_ASSERT(!mFrameCallback || waylandSurface != mLastCommittedSurface, + "Missing wayland surface at frame callback!"); + +- // Do nothing if there's already mDelayedCommitHandle pending. +- if (!mDelayedCommitHandle) { +- mDelayedCommitHandle = static_cast( +- moz_xmalloc(sizeof(*mDelayedCommitHandle))); +- *mDelayedCommitHandle = this; +- ++ if (DelayedCommitsCheckAndAddSurface(this)) { + MessageLoop::current()->PostDelayedTask( + NewRunnableFunction("WaylandBackBufferCommit", +- &WaylandBufferDelayCommitHandler, +- mDelayedCommitHandle), ++ &WaylandBufferDelayCommitHandler, this), + EVENT_LOOP_DELAY); + } + return; +@@ -1036,25 +1052,6 @@ void WindowSurfaceWayland::FrameCallback + + CommitWaylandBuffer(); + } +- +-void WindowSurfaceWayland::DelayedCommitHandler() { +- MOZ_ASSERT(mIsMainThread == NS_IsMainThread()); +- MOZ_ASSERT(mDelayedCommitHandle != nullptr, "Missing mDelayedCommitHandle!"); +- +- LOGWAYLAND( +- ("WindowSurfaceWayland::DelayedCommitHandler [%p]\n", (void*)this)); +- +- if (!mDelayedCommitHandle) { +- LOGWAYLAND((" We're missing mDelayedCommitHandle!\n")); +- return; +- } +- +- *mDelayedCommitHandle = nullptr; +- free(mDelayedCommitHandle); +- mDelayedCommitHandle = nullptr; +- +- CommitWaylandBuffer(); +-} + + } // namespace widget + } // namespace mozilla +diff -up firefox-81.0.1/widget/gtk/WindowSurfaceWayland.h.1656727 firefox-81.0.1/widget/gtk/WindowSurfaceWayland.h +--- firefox-81.0.1/widget/gtk/WindowSurfaceWayland.h.1656727 2020-09-30 19:42:37.000000000 +0200 ++++ firefox-81.0.1/widget/gtk/WindowSurfaceWayland.h 2020-10-08 11:35:41.928508817 +0200 +@@ -161,7 +161,7 @@ class WindowSurfaceWayland : public Wind + // If we fail (wayland compositor is busy, + // wl_surface is not created yet) we queue the painting + // and we send it to wayland compositor in FrameCallbackHandler()/ +- // DelayedCommitHandler/CommitWaylandBuffer(). ++ // CommitWaylandBuffer(). + already_AddRefed Lock( + const LayoutDeviceIntRegion& aRegion) override; + void Commit(const LayoutDeviceIntRegion& aInvalidRegion) final; +@@ -171,12 +171,6 @@ class WindowSurfaceWayland : public Wind + // queued commits. + void FrameCallbackHandler(); + +- // When a new window is created we may not have a valid wl_surface +- // for drawing (Gtk haven't created it yet). All commits are queued +- // and DelayedCommitHandler() is called by timer when wl_surface is ready +- // for drawing. +- void DelayedCommitHandler(); +- + // Try to commit all queued drawings to Wayland compositor. This is usually + // called from other routines but can be used to explicitly flush + // all drawings as we do when wl_buffer is released +@@ -249,17 +243,14 @@ class WindowSurfaceWayland : public Wind + wl_callback* mFrameCallback; + wl_surface* mLastCommittedSurface; + +- // Registered reference to pending DelayedCommitHandler() call. +- WindowSurfaceWayland** mDelayedCommitHandle; +- + // Cached drawings. If we can't get WaylandBuffer (wl_buffer) at + // WindowSurfaceWayland::Lock() we direct gecko rendering to + // mImageSurface. + // If we can't get WaylandBuffer at WindowSurfaceWayland::Commit() + // time, mImageSurface is moved to mDelayedImageCommits which + // holds all cached drawings. +- // mDelayedImageCommits can be drawn by FrameCallbackHandler(), +- // DelayedCommitHandler() or when WaylandBuffer is detached. ++ // mDelayedImageCommits can be drawn by FrameCallbackHandler() ++ // or when WaylandBuffer is detached. + RefPtr mImageSurface; + AutoTArray mDelayedImageCommits; + +@@ -282,8 +273,8 @@ class WindowSurfaceWayland : public Wind + // We can't send WaylandBuffer (wl_buffer) to compositor when gecko + // is rendering into it (i.e. between WindowSurfaceWayland::Lock() / + // WindowSurfaceWayland::Commit()). +- // Thus we use mBufferCommitAllowed to disable commit by callbacks +- // (FrameCallbackHandler(), DelayedCommitHandler()) ++ // Thus we use mBufferCommitAllowed to disable commit by ++ // CommitWaylandBuffer(). + bool mBufferCommitAllowed; + + // We need to clear WaylandBuffer when entire transparent window is repainted. diff --git a/mozilla-1661192.patch b/mozilla-1661192.patch new file mode 100644 index 0000000..fa3cd42 --- /dev/null +++ b/mozilla-1661192.patch @@ -0,0 +1,25 @@ +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1600,9 +1600,11 @@ + #endif + } + ++ bool hasAnchorRect = true; + if (anchorRect.width == 0) { + LOG((" No anchor rect given, use aPosition for anchor")); + anchorRect.SetRect(aPosition->x, aPosition->y, 1, 1); ++ hasAnchorRect = false; + } + LOG((" anchor x %d y %d width %d height %d (absolute coords)\n", + anchorRect.x, anchorRect.y, anchorRect.width, anchorRect.height)); +@@ -1704,7 +1706,7 @@ + nsPoint cursorOffset(0, 0); + #ifdef MOZ_WAYLAND + // Offset is already computed to the tooltips +- if (popupFrame && mPopupType != ePopupTypeTooltip) { ++ if (hasAnchorRect && popupFrame && mPopupType != ePopupTypeTooltip) { + nsMargin margin(0, 0, 0, 0); + popupFrame->StyleMargin()->GetMargin(margin); + switch (popupFrame->GetPopupAlignment()) { + diff --git a/mozilla-1663844.patch b/mozilla-1663844.patch new file mode 100644 index 0000000..3e55e80 --- /dev/null +++ b/mozilla-1663844.patch @@ -0,0 +1,36 @@ +diff --git a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +--- a/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp ++++ b/dom/media/platforms/agnostic/gmp/GMPDecoderModule.cpp +@@ -86,7 +86,7 @@ bool GMPDecoderModule::SupportsMimeType( + + bool GMPDecoderModule::SupportsMimeType( + const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const { +- return false; ++ return MP4Decoder::IsH264(aMimeType); + } + + } // namespace mozilla +diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp +--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp ++++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp +@@ -67,6 +67,8 @@ void GMPVideoDecoder::Decoded(GMPVideoi4 + RefPtr self = this; + if (v) { + mDecodedData.AppendElement(std::move(v)); ++ mDecodePromise.ResolveIfExists(std::move(mDecodedData), __func__); ++ mDecodedData = DecodedData(); + } else { + mDecodedData.Clear(); + mDecodePromise.RejectIfExists( +diff -up firefox-81.0.2/dom/media/gmp/GMPSharedMemManager.h.oldd firefox-81.0.2/dom/media/gmp/GMPSharedMemManager.h +--- firefox-81.0.2/dom/media/gmp/GMPSharedMemManager.h.oldd 2020-10-12 18:19:09.158070701 +0200 ++++ firefox-81.0.2/dom/media/gmp/GMPSharedMemManager.h 2020-10-12 18:19:18.398109540 +0200 +@@ -27,7 +27,7 @@ class GMPSharedMem { + // returned to the parent pool (which is not included). If more than + // this are needed, we presume the client has either crashed or hung + // (perhaps temporarily). +- static const uint32_t kGMPBufLimit = 20; ++ static const uint32_t kGMPBufLimit = 40; + + GMPSharedMem() { + for (size_t i = 0; i < sizeof(mGmpAllocated) / sizeof(mGmpAllocated[0]); diff --git a/mozilla-1665324.patch b/mozilla-1665324.patch new file mode 100644 index 0000000..9fdffdb --- /dev/null +++ b/mozilla-1665324.patch @@ -0,0 +1,36 @@ +diff --git a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h +--- a/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h ++++ b/dom/media/platforms/ffmpeg/FFmpegDecoderModule.h +@@ -38,14 +38,6 @@ + if (aParams.VideoConfig().HasAlpha()) { + return nullptr; + } +- if (VPXDecoder::IsVPX(aParams.mConfig.mMimeType) && +- aParams.mOptions.contains(CreateDecoderParams::Option::LowLatency) && +- !StaticPrefs::media_ffmpeg_low_latency_enabled()) { +- // We refuse to create a decoder with low latency enabled if it's VP8 or +- // VP9 unless specifically allowed: this will fallback to libvpx later. +- // We do allow it for h264. +- return nullptr; +- } + RefPtr decoder = new FFmpegVideoDecoder( + mLib, aParams.VideoConfig(), aParams.mKnowsCompositor, + aParams.mImageContainer, +diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml +--- a/modules/libpref/init/StaticPrefList.yaml ++++ b/modules/libpref/init/StaticPrefList.yaml +@@ -7109,13 +7109,6 @@ + mirror: always + #endif + +-#if defined(MOZ_FFMPEG) || defined(MOZ_FFVPX) +-- name: media.ffmpeg.low-latency.enabled +- type: RelaxedAtomicBool +- value: false +- mirror: always +-#endif +- + #ifdef MOZ_WMF + + - name: media.wmf.enabled + diff --git a/mozilla-1665329.patch b/mozilla-1665329.patch new file mode 100644 index 0000000..62ce5ae --- /dev/null +++ b/mozilla-1665329.patch @@ -0,0 +1,16 @@ +diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml +--- a/modules/libpref/init/StaticPrefList.yaml ++++ b/modules/libpref/init/StaticPrefList.yaml +@@ -7565,11 +7565,7 @@ + # acceleration for decoding. + - name: media.navigator.mediadatadecoder_vpx_enabled + type: RelaxedAtomicBool +- #if defined(NIGHTLY_BUILD) + value: true +- #else +- value: false +- #endif + mirror: always + + # Use MediaDataDecoder API for H264 in WebRTC. This includes hardware + diff --git a/mozilla-1667096.patch b/mozilla-1667096.patch new file mode 100644 index 0000000..5d98fe2 --- /dev/null +++ b/mozilla-1667096.patch @@ -0,0 +1,473 @@ +changeset: 551978:40c95986d358 +tag: tip +parent: 551976:daadcfadb2f8 +user: stransky +date: Thu Sep 24 15:51:06 2020 +0200 +files: media/ffvpx/libavcodec/codec_list.c media/ffvpx/libavcodec/libfdk-aacdec.c media/ffvpx/libavcodec/moz.build toolkit/moz.configure +description: +Bug 1667096 Add libfdk-aacdec.c to bundled ffvpx and allow build Firefox with system fdk-aac-free library, r?jya + +Differential Revision: https://phabricator.services.mozilla.com/D91278 + + +diff --git a/media/ffvpx/libavcodec/codec_list.c b/media/ffvpx/libavcodec/codec_list.c +--- a/media/ffvpx/libavcodec/codec_list.c ++++ b/media/ffvpx/libavcodec/codec_list.c +@@ -11,4 +11,8 @@ static const AVCodec * const codec_list[ + #if CONFIG_MP3_DECODER + &ff_mp3_decoder, + #endif ++#ifdef CONFIG_LIBFDK_AAC ++ &ff_libfdk_aac_decoder, ++#endif ++ + NULL }; +diff --git a/media/ffvpx/libavcodec/libfdk-aacdec.c b/media/ffvpx/libavcodec/libfdk-aacdec.c +new file mode 100644 +--- /dev/null ++++ b/media/ffvpx/libavcodec/libfdk-aacdec.c +@@ -0,0 +1,409 @@ ++/* ++ * AAC decoder wrapper ++ * Copyright (c) 2012 Martin Storsjo ++ * ++ * This file is part of FFmpeg. ++ * ++ * Permission to use, copy, modify, and/or distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++ ++#include "libavutil/channel_layout.h" ++#include "libavutil/common.h" ++#include "libavutil/opt.h" ++#include "avcodec.h" ++#include "internal.h" ++ ++#ifdef AACDECODER_LIB_VL0 ++#define FDKDEC_VER_AT_LEAST(vl0, vl1) \ ++ ((AACDECODER_LIB_VL0 > vl0) || \ ++ (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)) ++#else ++#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0 ++#endif ++ ++#if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10 ++#define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS ++#endif ++ ++enum ConcealMethod { ++ CONCEAL_METHOD_SPECTRAL_MUTING = 0, ++ CONCEAL_METHOD_NOISE_SUBSTITUTION = 1, ++ CONCEAL_METHOD_ENERGY_INTERPOLATION = 2, ++ CONCEAL_METHOD_NB, ++}; ++ ++typedef struct FDKAACDecContext { ++ const AVClass *class; ++ HANDLE_AACDECODER handle; ++ uint8_t *decoder_buffer; ++ int decoder_buffer_size; ++ uint8_t *anc_buffer; ++ int conceal_method; ++ int drc_level; ++ int drc_boost; ++ int drc_heavy; ++ int drc_effect; ++ int drc_cut; ++ int level_limit; ++} FDKAACDecContext; ++ ++ ++#define DMX_ANC_BUFFSIZE 128 ++#define DECODER_MAX_CHANNELS 8 ++#define DECODER_BUFFSIZE 2048 * sizeof(INT_PCM) ++ ++#define OFFSET(x) offsetof(FDKAACDecContext, x) ++#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM ++static const AVOption fdk_aac_dec_options[] = { ++ { "conceal", "Error concealment method", OFFSET(conceal_method), AV_OPT_TYPE_INT, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, CONCEAL_METHOD_SPECTRAL_MUTING, CONCEAL_METHOD_NB - 1, AD, "conceal" }, ++ { "spectral", "Spectral muting", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_SPECTRAL_MUTING }, INT_MIN, INT_MAX, AD, "conceal" }, ++ { "noise", "Noise Substitution", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_NOISE_SUBSTITUTION }, INT_MIN, INT_MAX, AD, "conceal" }, ++ { "energy", "Energy Interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = CONCEAL_METHOD_ENERGY_INTERPOLATION }, INT_MIN, INT_MAX, AD, "conceal" }, ++ { "drc_boost", "Dynamic Range Control: boost, where [0] is none and [127] is max boost", ++ OFFSET(drc_boost), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL }, ++ { "drc_cut", "Dynamic Range Control: attenuation factor, where [0] is none and [127] is max compression", ++ OFFSET(drc_cut), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 127, AD, NULL }, ++ { "drc_level", "Dynamic Range Control: reference level, quantized to 0.25dB steps where [0] is 0dB and [127] is -31.75dB", ++ OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL }, ++ { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off", ++ OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL }, ++#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 ++ { "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD }, ++#endif ++#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0 ++ { "drc_effect","Dynamic Range Control: effect type, where e.g. [0] is none and [6] is general", ++ OFFSET(drc_effect), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 8, AD, NULL }, ++#endif ++ { NULL } ++}; ++ ++static const AVClass fdk_aac_dec_class = { ++ .class_name = "libfdk-aac decoder", ++ .item_name = av_default_item_name, ++ .option = fdk_aac_dec_options, ++ .version = LIBAVUTIL_VERSION_INT, ++}; ++ ++static int get_stream_info(AVCodecContext *avctx) ++{ ++ FDKAACDecContext *s = avctx->priv_data; ++ CStreamInfo *info = aacDecoder_GetStreamInfo(s->handle); ++ int channel_counts[0x24] = { 0 }; ++ int i, ch_error = 0; ++ uint64_t ch_layout = 0; ++ ++ if (!info) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to get stream info\n"); ++ return AVERROR_UNKNOWN; ++ } ++ ++ if (info->sampleRate <= 0) { ++ av_log(avctx, AV_LOG_ERROR, "Stream info not initialized\n"); ++ return AVERROR_UNKNOWN; ++ } ++ avctx->sample_rate = info->sampleRate; ++ avctx->frame_size = info->frameSize; ++ ++ for (i = 0; i < info->numChannels; i++) { ++ AUDIO_CHANNEL_TYPE ctype = info->pChannelType[i]; ++ if (ctype <= ACT_NONE || ctype >= FF_ARRAY_ELEMS(channel_counts)) { ++ av_log(avctx, AV_LOG_WARNING, "unknown channel type\n"); ++ break; ++ } ++ channel_counts[ctype]++; ++ } ++ av_log(avctx, AV_LOG_DEBUG, ++ "%d channels - front:%d side:%d back:%d lfe:%d top:%d\n", ++ info->numChannels, ++ channel_counts[ACT_FRONT], channel_counts[ACT_SIDE], ++ channel_counts[ACT_BACK], channel_counts[ACT_LFE], ++ channel_counts[ACT_FRONT_TOP] + channel_counts[ACT_SIDE_TOP] + ++ channel_counts[ACT_BACK_TOP] + channel_counts[ACT_TOP]); ++ ++ switch (channel_counts[ACT_FRONT]) { ++ case 4: ++ ch_layout |= AV_CH_LAYOUT_STEREO | AV_CH_FRONT_LEFT_OF_CENTER | ++ AV_CH_FRONT_RIGHT_OF_CENTER; ++ break; ++ case 3: ++ ch_layout |= AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER; ++ break; ++ case 2: ++ ch_layout |= AV_CH_LAYOUT_STEREO; ++ break; ++ case 1: ++ ch_layout |= AV_CH_FRONT_CENTER; ++ break; ++ default: ++ av_log(avctx, AV_LOG_WARNING, ++ "unsupported number of front channels: %d\n", ++ channel_counts[ACT_FRONT]); ++ ch_error = 1; ++ break; ++ } ++ if (channel_counts[ACT_SIDE] > 0) { ++ if (channel_counts[ACT_SIDE] == 2) { ++ ch_layout |= AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT; ++ } else { ++ av_log(avctx, AV_LOG_WARNING, ++ "unsupported number of side channels: %d\n", ++ channel_counts[ACT_SIDE]); ++ ch_error = 1; ++ } ++ } ++ if (channel_counts[ACT_BACK] > 0) { ++ switch (channel_counts[ACT_BACK]) { ++ case 3: ++ ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | AV_CH_BACK_CENTER; ++ break; ++ case 2: ++ ch_layout |= AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT; ++ break; ++ case 1: ++ ch_layout |= AV_CH_BACK_CENTER; ++ break; ++ default: ++ av_log(avctx, AV_LOG_WARNING, ++ "unsupported number of back channels: %d\n", ++ channel_counts[ACT_BACK]); ++ ch_error = 1; ++ break; ++ } ++ } ++ if (channel_counts[ACT_LFE] > 0) { ++ if (channel_counts[ACT_LFE] == 1) { ++ ch_layout |= AV_CH_LOW_FREQUENCY; ++ } else { ++ av_log(avctx, AV_LOG_WARNING, ++ "unsupported number of LFE channels: %d\n", ++ channel_counts[ACT_LFE]); ++ ch_error = 1; ++ } ++ } ++ if (!ch_error && ++ av_get_channel_layout_nb_channels(ch_layout) != info->numChannels) { ++ av_log(avctx, AV_LOG_WARNING, "unsupported channel configuration\n"); ++ ch_error = 1; ++ } ++ if (ch_error) ++ avctx->channel_layout = 0; ++ else ++ avctx->channel_layout = ch_layout; ++ ++ avctx->channels = info->numChannels; ++ ++ return 0; ++} ++ ++static av_cold int fdk_aac_decode_close(AVCodecContext *avctx) ++{ ++ FDKAACDecContext *s = avctx->priv_data; ++ ++ if (s->handle) ++ aacDecoder_Close(s->handle); ++ av_freep(&s->decoder_buffer); ++ av_freep(&s->anc_buffer); ++ ++ return 0; ++} ++ ++static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) ++{ ++ FDKAACDecContext *s = avctx->priv_data; ++ AAC_DECODER_ERROR err; ++ ++ s->handle = aacDecoder_Open(avctx->extradata_size ? TT_MP4_RAW : TT_MP4_ADTS, 1); ++ if (!s->handle) { ++ av_log(avctx, AV_LOG_ERROR, "Error opening decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ ++ if (avctx->extradata_size) { ++ if ((err = aacDecoder_ConfigRaw(s->handle, &avctx->extradata, ++ &avctx->extradata_size)) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set extradata\n"); ++ return AVERROR_INVALIDDATA; ++ } ++ } ++ ++ if ((err = aacDecoder_SetParam(s->handle, AAC_CONCEAL_METHOD, ++ s->conceal_method)) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set error concealment method\n"); ++ return AVERROR_UNKNOWN; ++ } ++ ++ if (avctx->request_channel_layout > 0 && ++ avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE) { ++ int downmix_channels = -1; ++ ++ switch (avctx->request_channel_layout) { ++ case AV_CH_LAYOUT_STEREO: ++ case AV_CH_LAYOUT_STEREO_DOWNMIX: ++ downmix_channels = 2; ++ break; ++ case AV_CH_LAYOUT_MONO: ++ downmix_channels = 1; ++ break; ++ default: ++ av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n"); ++ break; ++ } ++ ++ if (downmix_channels != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_PCM_MAX_OUTPUT_CHANNELS, ++ downmix_channels) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_WARNING, "Unable to set output channels in the decoder\n"); ++ } else { ++ s->anc_buffer = av_malloc(DMX_ANC_BUFFSIZE); ++ if (!s->anc_buffer) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to allocate ancillary buffer for the decoder\n"); ++ return AVERROR(ENOMEM); ++ } ++ if (aacDecoder_AncDataInit(s->handle, s->anc_buffer, DMX_ANC_BUFFSIZE)) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to register downmix ancillary buffer in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ } ++ } ++ ++ if (s->drc_boost != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_DRC_BOOST_FACTOR, s->drc_boost) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC boost factor in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ ++ if (s->drc_cut != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_DRC_ATTENUATION_FACTOR, s->drc_cut) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC attenuation factor in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ ++ if (s->drc_level != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_DRC_REFERENCE_LEVEL, s->drc_level) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC reference level in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ ++ if (s->drc_heavy != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_DRC_HEAVY_COMPRESSION, s->drc_heavy) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC heavy compression in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++ ++#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 ++ if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++#endif ++ ++#if FDKDEC_VER_AT_LEAST(3, 0) // 3.0.0 ++ if (s->drc_effect != -1) { ++ if (aacDecoder_SetParam(s->handle, AAC_UNIDRC_SET_EFFECT, s->drc_effect) != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "Unable to set DRC effect type in the decoder\n"); ++ return AVERROR_UNKNOWN; ++ } ++ } ++#endif ++ ++ avctx->sample_fmt = AV_SAMPLE_FMT_S16; ++ ++ s->decoder_buffer_size = DECODER_BUFFSIZE * DECODER_MAX_CHANNELS; ++ s->decoder_buffer = av_malloc(s->decoder_buffer_size); ++ if (!s->decoder_buffer) ++ return AVERROR(ENOMEM); ++ ++ return 0; ++} ++ ++static int fdk_aac_decode_frame(AVCodecContext *avctx, void *data, ++ int *got_frame_ptr, AVPacket *avpkt) ++{ ++ FDKAACDecContext *s = avctx->priv_data; ++ AVFrame *frame = data; ++ int ret; ++ AAC_DECODER_ERROR err; ++ UINT valid = avpkt->size; ++ ++ err = aacDecoder_Fill(s->handle, &avpkt->data, &avpkt->size, &valid); ++ if (err != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, "aacDecoder_Fill() failed: %x\n", err); ++ return AVERROR_INVALIDDATA; ++ } ++ ++ err = aacDecoder_DecodeFrame(s->handle, (INT_PCM *) s->decoder_buffer, s->decoder_buffer_size / sizeof(INT_PCM), 0); ++ if (err == AAC_DEC_NOT_ENOUGH_BITS) { ++ ret = avpkt->size - valid; ++ goto end; ++ } ++ if (err != AAC_DEC_OK) { ++ av_log(avctx, AV_LOG_ERROR, ++ "aacDecoder_DecodeFrame() failed: %x\n", err); ++ ret = AVERROR_UNKNOWN; ++ goto end; ++ } ++ ++ if ((ret = get_stream_info(avctx)) < 0) ++ goto end; ++ frame->nb_samples = avctx->frame_size; ++ ++ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) ++ goto end; ++ ++ memcpy(frame->extended_data[0], s->decoder_buffer, ++ avctx->channels * avctx->frame_size * ++ av_get_bytes_per_sample(avctx->sample_fmt)); ++ ++ *got_frame_ptr = 1; ++ ret = avpkt->size - valid; ++ ++end: ++ return ret; ++} ++ ++static av_cold void fdk_aac_decode_flush(AVCodecContext *avctx) ++{ ++ FDKAACDecContext *s = avctx->priv_data; ++ AAC_DECODER_ERROR err; ++ ++ if (!s->handle) ++ return; ++ ++ if ((err = aacDecoder_SetParam(s->handle, ++ AAC_TPDEC_CLEAR_BUFFER, 1)) != AAC_DEC_OK) ++ av_log(avctx, AV_LOG_WARNING, "failed to clear buffer when flushing\n"); ++} ++ ++AVCodec ff_libfdk_aac_decoder = { ++ .name = "libfdk_aac", ++ .long_name = NULL_IF_CONFIG_SMALL("Fraunhofer FDK AAC"), ++ .type = AVMEDIA_TYPE_AUDIO, ++ .id = AV_CODEC_ID_AAC, ++ .priv_data_size = sizeof(FDKAACDecContext), ++ .init = fdk_aac_decode_init, ++ .decode = fdk_aac_decode_frame, ++ .close = fdk_aac_decode_close, ++ .flush = fdk_aac_decode_flush, ++ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, ++ .priv_class = &fdk_aac_dec_class, ++ .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | ++ FF_CODEC_CAP_INIT_CLEANUP, ++ .wrapper_name = "libfdk", ++}; +diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build +--- a/media/ffvpx/libavcodec/moz.build ++++ b/media/ffvpx/libavcodec/moz.build +@@ -97,6 +97,12 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']: + 'vp9recon.c' + ] + ++if CONFIG['MOZ_FDK_AAC']: ++ SOURCES += [ ++ 'libfdk-aacdec.c', ++ ] ++ OS_LIBS += CONFIG['MOZ_FDK_AAC_LIBS'] ++ + if CONFIG['MOZ_LIBAV_FFT']: + SOURCES += [ + 'avfft.c', +diff --git a/toolkit/moz.configure b/toolkit/moz.configure +--- a/toolkit/moz.configure ++++ b/toolkit/moz.configure +@@ -1592,6 +1592,14 @@ with only_when(compile_environment): + set_define('MOZ_LIBAV_FFT', depends(when=libav_fft)(lambda: True)) + set_config('LIBAV_FFT_ASFLAGS', libav_fft.flags) + ++# fdk aac support ++option('--with-system-fdk-aac', ++ help='Use system libfdk-aac (located with pkgconfig)') ++ ++system_fdk_aac = pkg_check_modules('MOZ_FDK_AAC', 'fdk-aac', ++ when='--with-system-fdk-aac') ++ ++set_config('MOZ_FDK_AAC', depends(when=system_fdk_aac)(lambda: True)) + + # FFmpeg's ffvpx configuration + # ============================================================== + diff --git a/mozilla-1668771.patch b/mozilla-1668771.patch new file mode 100644 index 0000000..4b3cb3e --- /dev/null +++ b/mozilla-1668771.patch @@ -0,0 +1,41 @@ +changeset: 552978:b50cb0696eef +tag: tip +parent: 552976:2ce12e3e063c +user: stransky +date: Fri Oct 02 12:19:53 2020 +0200 +files: widget/gtk/WindowSurfaceWayland.cpp +description: +Bug 1668771 [Wayland] Use timeout for frame callbacks for basic compositor, r?jhorak + +Differential Revision: https://phabricator.services.mozilla.com/D92200 + + +diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp +--- a/widget/gtk/WindowSurfaceWayland.cpp ++++ b/widget/gtk/WindowSurfaceWayland.cpp +@@ -37,6 +37,9 @@ extern mozilla::LazyLogModule gWidgetWay + // Maximal compositing timeout it miliseconds + #define COMPOSITING_TIMEOUT 200 + ++// Maximal timeout between frame callbacks ++#define FRAME_CALLBACK_TIMEOUT 20 ++ + namespace mozilla { + namespace widget { + +@@ -941,8 +944,12 @@ void WindowSurfaceWayland::CommitWayland + if (waylandSurface == mLastCommittedSurface) { + LOGWAYLAND((" [%p] wait for frame callback.\n", (void*)this)); + // We have an active frame callback pending from our recent surface. +- // It means we should defer the commit to FrameCallbackHandler(). +- return; ++ // It means we should defer the commit to FrameCallbackHandler(), ++ // but only if we're under frame callback timeout range. ++ if (mLastCommitTime && (g_get_monotonic_time() / 1000) - mLastCommitTime < ++ FRAME_CALLBACK_TIMEOUT) { ++ return; ++ } + } + // If our stored wl_surface does not match the actual one it means the frame + // callback is no longer active and we should release it. + diff --git a/mozilla-1669442.patch b/mozilla-1669442.patch new file mode 100644 index 0000000..6373816 --- /dev/null +++ b/mozilla-1669442.patch @@ -0,0 +1,13 @@ +diff --git a/config/recurse.mk b/config/recurse.mk +--- a/config/recurse.mk ++++ b/config/recurse.mk +@@ -206,7 +206,7 @@ + # Interdependencies that moz.build world don't know about yet for compilation. + # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py + ifeq ($(MOZ_WIDGET_TOOLKIT),gtk) +-toolkit/library/target: widget/gtk/mozgtk/gtk3/target ++toolkit/library/build/target: widget/gtk/mozgtk/gtk3/target + endif + + ifndef MOZ_FOLD_LIBS + diff --git a/mozilla-1669495.patch b/mozilla-1669495.patch new file mode 100644 index 0000000..3ef027c --- /dev/null +++ b/mozilla-1669495.patch @@ -0,0 +1,130 @@ +diff -up firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp.1669495 firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp +--- firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp.1669495 2020-10-08 10:09:23.765819989 +0200 ++++ firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp 2020-10-08 10:09:23.771820010 +0200 +@@ -533,6 +533,26 @@ void nsMenuPopupFrame::LayoutPopup(nsBox + } + prefSize = XULBoundsCheck(minSize, prefSize, maxSize); + ++#ifdef MOZ_WAYLAND ++ static bool inWayland = gdk_display_get_default() && ++ !GDK_IS_X11_DISPLAY(gdk_display_get_default()); ++#else ++ static bool inWayland = false; ++#endif ++ if (inWayland) { ++ // If prefSize it is not a whole number in css pixels we need round it up ++ // to avoid reflow of the tooltips/popups and putting the text on two lines ++ // (usually happens with 200% scale factor and font scale factor <> 1) ++ // because GTK thrown away the decimals. ++ int32_t appPerCSS = AppUnitsPerCSSPixel(); ++ if (prefSize.width % appPerCSS > 0) { ++ prefSize.width += appPerCSS; ++ } ++ if (prefSize.height % appPerCSS > 0) { ++ prefSize.height += appPerCSS; ++ } ++ } ++ + bool sizeChanged = (mPrefSize != prefSize); + // if the size changed then set the bounds to be the preferred size + if (sizeChanged) { +diff -up firefox-81.0.1/widget/gtk/nsWindow.cpp.1669495 firefox-81.0.1/widget/gtk/nsWindow.cpp +--- firefox-81.0.1/widget/gtk/nsWindow.cpp.1669495 2020-10-08 10:09:23.770820007 +0200 ++++ firefox-81.0.1/widget/gtk/nsWindow.cpp 2020-10-08 10:10:29.225052014 +0200 +@@ -1090,11 +1090,13 @@ void nsWindow::Show(bool aState) { + + void nsWindow::ResizeInt(int aX, int aY, int aWidth, int aHeight, bool aMove, + bool aRepaint) { +- LOG(("nsWindow::ResizeInt [%p] %d %d -> %d %d repaint %d\n", (void*)this, aX, +- aY, aWidth, aHeight, aRepaint)); ++ LOG(("nsWindow::ResizeInt [%p] x:%d y:%d -> w:%d h:%d repaint %d aMove %d\n", ++ (void*)this, aX, aY, aWidth, aHeight, aRepaint, aMove)); + + ConstrainSize(&aWidth, &aHeight); + ++ LOG((" ConstrainSize: w:%d h;%d\n", aWidth, aHeight)); ++ + if (aMove) { + mBounds.x = aX; + mBounds.y = aY; +@@ -1132,8 +1134,7 @@ void nsWindow::ResizeInt(int aX, int aY, + } + + void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) { +- LOG(("nsWindow::Resize [%p] %d %d\n", (void*)this, (int)aWidth, +- (int)aHeight)); ++ LOG(("nsWindow::Resize [%p] %f %f\n", (void*)this, aWidth, aHeight)); + + double scale = + BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0; +@@ -1145,8 +1146,8 @@ void nsWindow::Resize(double aWidth, dou + + void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight, + bool aRepaint) { +- LOG(("nsWindow::Resize [%p] %d %d repaint %d\n", (void*)this, (int)aWidth, +- (int)aHeight, aRepaint)); ++ LOG(("nsWindow::Resize [%p] %f %f repaint %d\n", (void*)this, aWidth, aHeight, ++ aRepaint)); + + double scale = + BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0; +@@ -1469,14 +1470,15 @@ void nsWindow::NativeMoveResizeWaylandPo + + newBounds.x = GdkCoordToDevicePixels(newBounds.x); + newBounds.y = GdkCoordToDevicePixels(newBounds.y); +- LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x, +- newBounds.y, newBounds.width, newBounds.height)); + + double scale = + BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0; + int32_t newWidth = NSToIntRound(scale * newBounds.width); + int32_t newHeight = NSToIntRound(scale * newBounds.height); + ++ LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x, ++ newBounds.y, newWidth, newHeight)); ++ + bool needsPositionUpdate = + (newBounds.x != mBounds.x || newBounds.y != mBounds.y); + bool needsSizeUpdate = +@@ -1484,6 +1486,7 @@ void nsWindow::NativeMoveResizeWaylandPo + // Update view + + if (needsSizeUpdate) { ++ LOG((" needSizeUpdate\n")); + int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor(); + mPreferredPopupRect = nsRect(NSIntPixelsToAppUnits(newBounds.x, p2a), + NSIntPixelsToAppUnits(newBounds.y, p2a), +@@ -1502,6 +1505,7 @@ void nsWindow::NativeMoveResizeWaylandPo + } + + if (needsPositionUpdate) { ++ LOG((" needPositionUpdate\n")); + // The newBounds are in coordinates relative to the parent window/popup. + // The NotifyWindowMoved requires the coordinates relative to the toplevel. + // We use the gdk_window_get_origin to get correct coordinates. +@@ -4211,6 +4215,8 @@ nsresult nsWindow::Create(nsIWidget* aPa + + // save our bounds + mBounds = aRect; ++ LOG((" mBounds: x:%d y:%d w:%d h:%d\n", mBounds.x, mBounds.y, mBounds.width, ++ mBounds.height)); + + mPreferredPopupRectFlushed = false; + +@@ -5061,13 +5067,16 @@ void nsWindow::NativeShow(bool aAction) + } + } + ++ LOG((" calling gtk_widget_show(mShell)\n")); + gtk_widget_show(mShell); + if (!mIsX11Display) { + WaylandStartVsync(); + } + } else if (mContainer) { ++ LOG((" calling gtk_widget_show(mContainer)\n")); + gtk_widget_show(GTK_WIDGET(mContainer)); + } else if (mGdkWindow) { ++ LOG((" calling gdk_window_show_unraised\n")); + gdk_window_show_unraised(mGdkWindow); + } + } else { diff --git a/mozilla-1669639.patch b/mozilla-1669639.patch new file mode 100644 index 0000000..2d79542 --- /dev/null +++ b/mozilla-1669639.patch @@ -0,0 +1,15 @@ +diff -up firefox-81.0.1/build/mach_bootstrap.py.old firefox-81.0.1/build/mach_bootstrap.py +--- firefox-81.0.1/build/mach_bootstrap.py.old 2020-10-06 14:16:06.212974910 +0200 ++++ firefox-81.0.1/build/mach_bootstrap.py 2020-10-06 14:19:03.313179557 +0200 +@@ -507,7 +507,10 @@ class ImportHook(object): + # doesn't happen or because it doesn't matter). + if not os.path.exists(module.__file__[:-1]): + if os.path.exists(module.__file__): +- os.remove(module.__file__) ++ try: ++ os.remove(module.__file__) ++ except: ++ pass + del sys.modules[module.__name__] + module = self(name, globals, locals, fromlist, level) + diff --git a/mozilla-440908.patch b/mozilla-440908.patch new file mode 100644 index 0000000..cce5248 --- /dev/null +++ b/mozilla-440908.patch @@ -0,0 +1,111 @@ +diff -up firefox-56.0/modules/libpref/prefapi.cpp.440908 firefox-56.0/modules/libpref/prefapi.cpp +--- firefox-56.0/modules/libpref/prefapi.cpp.440908 2017-09-14 22:15:52.000000000 +0200 ++++ firefox-56.0/modules/libpref/prefapi.cpp 2017-09-25 10:39:39.266572792 +0200 +@@ -1036,8 +1036,8 @@ void PREF_ReaderCallback(void *clo + PrefValue value, + PrefType type, + bool isDefault, +- bool isStickyDefault) +- ++ bool isStickyDefault, ++ bool isLocked) + { + uint32_t flags = 0; + if (isDefault) { +@@ -1049,4 +1049,6 @@ void PREF_ReaderCallback(void *clo + flags |= kPrefForceSet; + } + pref_HashPref(pref, value, type, flags); ++ if (isLocked) ++ PREF_LockPref(pref, true); + } +diff -up firefox-56.0/modules/libpref/prefapi.h.440908 firefox-56.0/modules/libpref/prefapi.h +--- firefox-56.0/modules/libpref/prefapi.h.440908 2017-07-31 18:20:51.000000000 +0200 ++++ firefox-56.0/modules/libpref/prefapi.h 2017-09-25 10:39:39.267572789 +0200 +@@ -246,8 +246,8 @@ void PREF_ReaderCallback( void *closure, + PrefValue value, + PrefType type, + bool isDefault, +- bool isStickyDefault); +- ++ bool isStickyDefault, ++ bool isLocked); + + /* + * Callback whenever we change a preference +diff -up firefox-56.0/modules/libpref/prefread.cpp.440908 firefox-56.0/modules/libpref/prefread.cpp +--- firefox-56.0/modules/libpref/prefread.cpp.440908 2017-09-14 22:15:52.000000000 +0200 ++++ firefox-56.0/modules/libpref/prefread.cpp 2017-09-25 10:39:39.267572789 +0200 +@@ -43,6 +43,7 @@ enum { + #define BITS_PER_HEX_DIGIT 4 + + static const char kUserPref[] = "user_pref"; ++static const char kLockPref[] = "lockPref"; + static const char kPref[] = "pref"; + static const char kPrefSticky[] = "sticky_pref"; + static const char kTrue[] = "true"; +@@ -146,7 +147,7 @@ pref_DoCallback(PrefParseState *ps) + break; + } + (*ps->reader)(ps->closure, ps->lb, value, ps->vtype, ps->fdefault, +- ps->fstickydefault); ++ ps->fstickydefault, ps->flock); + return true; + } + +@@ -215,6 +216,7 @@ PREF_ParseBuf(PrefParseState *ps, const + ps->vtype = PrefType::Invalid; + ps->fdefault = false; + ps->fstickydefault = false; ++ ps->flock = false; + } + switch (c) { + case '/': /* begin comment block or line? */ +@@ -225,11 +227,14 @@ PREF_ParseBuf(PrefParseState *ps, const + break; + case 'u': /* indicating user_pref */ + case 's': /* indicating sticky_pref */ ++ case 'l': /* indicating lockPref */ + case 'p': /* indicating pref */ + if (c == 'u') { + ps->smatch = kUserPref; + } else if (c == 's') { + ps->smatch = kPrefSticky; ++ } else if (c == 'l') { ++ ps->smatch = kLockPref; + } else { + ps->smatch = kPref; + } +@@ -277,8 +282,10 @@ PREF_ParseBuf(PrefParseState *ps, const + /* name parsing */ + case PREF_PARSE_UNTIL_NAME: + if (c == '\"' || c == '\'') { +- ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky); ++ ps->fdefault = (ps->smatch == kPref || ps->smatch == kPrefSticky ++ || ps->smatch == kLockPref); + ps->fstickydefault = (ps->smatch == kPrefSticky); ++ ps->flock = (ps->smatch == kLockPref); + ps->quotechar = c; + ps->nextstate = PREF_PARSE_UNTIL_COMMA; /* return here when done */ + state = PREF_PARSE_QUOTED_STRING; +diff -up firefox-56.0/modules/libpref/prefread.h.440908 firefox-56.0/modules/libpref/prefread.h +--- firefox-56.0/modules/libpref/prefread.h.440908 2017-09-14 22:15:52.000000000 +0200 ++++ firefox-56.0/modules/libpref/prefread.h 2017-09-25 10:39:39.267572789 +0200 +@@ -34,7 +34,8 @@ typedef void (*PrefReader)(void *c + PrefValue val, + PrefType type, + bool defPref, +- bool stickyPref); ++ bool stickyPref, ++ bool lockPref); + + /** + * Report any errors or warnings we encounter during parsing. +@@ -62,6 +63,7 @@ typedef struct PrefParseState { + PrefType vtype; /* PREF_STRING,INT,BOOL */ + bool fdefault; /* true if (default) pref */ + bool fstickydefault; /* true if (sticky) pref */ ++ bool flock; /* true if pref to be locked */ + } PrefParseState; + + /** diff --git a/mozilla-api-key b/mozilla-api-key new file mode 100644 index 0000000..81877bc --- /dev/null +++ b/mozilla-api-key @@ -0,0 +1 @@ +9008bb7e-1e22-4038-94fe-047dd48ccc0b diff --git a/mozilla-build-arm.patch b/mozilla-build-arm.patch new file mode 100644 index 0000000..e390a28 --- /dev/null +++ b/mozilla-build-arm.patch @@ -0,0 +1,14 @@ +diff -up firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h.arm firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h +--- firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h.arm 2017-03-03 13:53:52.480754536 +0100 ++++ firefox-52.0/gfx/skia/skia/include/core/SkPreConfig.h 2017-03-03 13:56:01.476018102 +0100 +@@ -203,6 +203,10 @@ + #define SK_ARM_HAS_CRC32 + #endif + ++#if defined(__aarch64__) ++ #undef SK_ARM_HAS_NEON ++#endif ++ + ////////////////////////////////////////////////////////////////////// + + #if !defined(SKIA_IMPLEMENTATION) diff --git a/node-stdout-nonblocking-wrapper b/node-stdout-nonblocking-wrapper new file mode 100755 index 0000000..b2814b8 --- /dev/null +++ b/node-stdout-nonblocking-wrapper @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/node "$@" 2>&1 | cat - diff --git a/pgo.patch b/pgo.patch new file mode 100644 index 0000000..c4a6bf4 --- /dev/null +++ b/pgo.patch @@ -0,0 +1,153 @@ +diff -up firefox-81.0.1/build/moz.configure/lto-pgo.configure.pgo firefox-81.0.1/build/moz.configure/lto-pgo.configure +--- firefox-81.0.1/build/moz.configure/lto-pgo.configure.pgo 2020-09-30 19:41:10.000000000 +0200 ++++ firefox-81.0.1/build/moz.configure/lto-pgo.configure 2020-10-07 09:16:44.071786956 +0200 +@@ -69,12 +69,14 @@ set_config('PGO_PROFILE_PATH', pgo_profi + @imports(_from='__builtin__', _import='min') + def pgo_flags(compiler, profdata, target_is_windows): + if compiler.type == 'gcc': ++ #profile_use = '-fprofile-use=$(topobjdir)' ++ profile_use = '-fprofile-use' + return namespace( + gen_cflags=['-fprofile-generate'], + gen_ldflags=['-fprofile-generate'], +- use_cflags=['-fprofile-use', '-fprofile-correction', ++ use_cflags=[profile_use, '-fprofile-correction', + '-Wcoverage-mismatch'], +- use_ldflags=['-fprofile-use'], ++ use_ldflags=[profile_use], + ) + + if compiler.type in ('clang-cl', 'clang'): +@@ -192,13 +194,13 @@ def lto(value, c_compiler, ld64_known_go + cflags.append("-flto") + ldflags.append("-flto") + else: +- cflags.append("-flto=thin") +- ldflags.append("-flto=thin") ++ cflags.append("-flto") ++ ldflags.append("-flto") + elif c_compiler.type == 'clang-cl': + if len(value) and value[0].lower() == 'full': + cflags.append("-flto") + else: +- cflags.append("-flto=thin") ++ cflags.append("-flto") + # With clang-cl, -flto can only be used with -c or -fuse-ld=lld. + # AC_TRY_LINKs during configure don't have -c, so pass -fuse-ld=lld. + cflags.append("-fuse-ld=lld"); +@@ -232,7 +234,7 @@ def lto(value, c_compiler, ld64_known_go + if len(value) and value[0].lower() == 'full': + cflags.append("-flto") + else: +- cflags.append("-flto=thin") ++ cflags.append("-flto") + cflags.append("-flifetime-dse=1") + + ldflags.append("-flto=%s" % num_cores) +diff -up firefox-81.0.1/build/pgo/profileserver.py.pgo firefox-81.0.1/build/pgo/profileserver.py +--- firefox-81.0.1/build/pgo/profileserver.py.pgo 2020-09-30 19:41:10.000000000 +0200 ++++ firefox-81.0.1/build/pgo/profileserver.py 2020-10-07 09:16:44.071786956 +0200 +@@ -11,7 +11,7 @@ import glob + import subprocess + + import mozcrash +-from mozbuild.base import MozbuildObject, BinaryNotFoundException ++from mozbuild.base import MozbuildObject, BinaryNotFoundException, BuildEnvironmentNotFoundException + from mozfile import TemporaryDirectory + from mozhttpd import MozHttpd + from mozprofile import FirefoxProfile, Preferences +@@ -84,9 +84,22 @@ if __name__ == '__main__': + port=PORT, + options='primary,privileged') + +- old_profraw_files = glob.glob('*.profraw') +- for f in old_profraw_files: +- os.remove(f) ++ using_gcc = False ++ try: ++ if build.config_environment.substs.get('CC_TYPE') == 'gcc': ++ using_gcc = True ++ except BuildEnvironmentNotFoundException: ++ pass ++ ++ if using_gcc: ++ for dirpath, _, filenames in os.walk('.'): ++ for f in filenames: ++ if f.endswith('.gcda'): ++ os.remove(os.path.join(dirpath, f)) ++ else: ++ old_profraw_files = glob.glob('*.profraw') ++ for f in old_profraw_files: ++ os.remove(f) + + with TemporaryDirectory() as profilePath: + # TODO: refactor this into mozprofile +@@ -191,6 +204,11 @@ if __name__ == '__main__': + print("Firefox exited successfully, but produced a crashreport") + sys.exit(1) + ++ ++ print('Copying profile data....') ++ os.system('pwd'); ++ os.system('tar cf profdata.tar.gz `find . -name "*.gcda"`; cd ..; tar xf instrumented/profdata.tar.gz;'); ++ + llvm_profdata = env.get('LLVM_PROFDATA') + if llvm_profdata: + profraw_files = glob.glob('*.profraw') +diff -up firefox-81.0.1/build/unix/mozconfig.unix.pgo firefox-81.0.1/build/unix/mozconfig.unix +--- firefox-81.0.1/build/unix/mozconfig.unix.pgo 2020-09-30 19:41:10.000000000 +0200 ++++ firefox-81.0.1/build/unix/mozconfig.unix 2020-10-07 09:16:44.071786956 +0200 +@@ -6,6 +6,15 @@ if [ -n "$FORCE_GCC" ]; then + CC="$MOZ_FETCHES_DIR/gcc/bin/gcc" + CXX="$MOZ_FETCHES_DIR/gcc/bin/g++" + ++ if [ -n "$MOZ_PGO" ]; then ++ if [ -z "$USE_ARTIFACT" ]; then ++ ac_add_options --enable-lto ++ fi ++ export AR="$topsrcdir/gcc/bin/gcc-ar" ++ export NM="$topsrcdir/gcc/bin/gcc-nm" ++ export RANLIB="$topsrcdir/gcc/bin/gcc-ranlib" ++ fi ++ + # We want to make sure we use binutils and other binaries in the tooltool + # package. + mk_add_options "export PATH=$MOZ_FETCHES_DIR/gcc/bin:$PATH" +diff -up firefox-81.0.1/extensions/spellcheck/src/moz.build.pgo firefox-81.0.1/extensions/spellcheck/src/moz.build +--- firefox-81.0.1/extensions/spellcheck/src/moz.build.pgo 2020-09-30 19:41:17.000000000 +0200 ++++ firefox-81.0.1/extensions/spellcheck/src/moz.build 2020-10-07 09:16:44.071786956 +0200 +@@ -31,3 +31,5 @@ EXPORTS.mozilla += [ + + if CONFIG['CC_TYPE'] in ('clang', 'gcc'): + CXXFLAGS += ['-Wno-error=shadow'] ++ ++CXXFLAGS += ['-fno-devirtualize'] +\ No newline at end of file +diff -up firefox-81.0.1/python/mozbuild/mozbuild/build_commands.py.pgo firefox-81.0.1/python/mozbuild/mozbuild/build_commands.py +--- firefox-81.0.1/python/mozbuild/mozbuild/build_commands.py.pgo 2020-09-30 19:41:46.000000000 +0200 ++++ firefox-81.0.1/python/mozbuild/mozbuild/build_commands.py 2020-10-07 09:16:44.071786956 +0200 +@@ -108,7 +108,8 @@ class Build(MachCommandBase): + return status + + pgo_env = os.environ.copy() +- pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA') ++ if instr.config_environment.substs.get('CC_TYPE') != 'gcc': ++ pgo_env['LLVM_PROFDATA'] = instr.config_environment.substs.get('LLVM_PROFDATA') + pgo_env['JARLOG_FILE'] = mozpath.join(orig_topobjdir, 'jarlog/en-US.log') + pgo_cmd = [ + instr.virtualenv_manager.python_path, +diff -up firefox-81.0.1/toolkit/components/terminator/nsTerminator.cpp.pgo firefox-81.0.1/toolkit/components/terminator/nsTerminator.cpp +--- firefox-81.0.1/toolkit/components/terminator/nsTerminator.cpp.pgo 2020-10-07 09:22:26.698243673 +0200 ++++ firefox-81.0.1/toolkit/components/terminator/nsTerminator.cpp 2020-10-07 09:22:43.026312999 +0200 +@@ -418,6 +418,11 @@ void nsTerminator::StartWatchdog() { + } + #endif + ++ // Disable watchdog for PGO train builds - writting profile information at ++ // exit may take time and it is better to make build hang rather than ++ // silently produce poorly performing binary. ++ crashAfterMS = INT32_MAX; ++ + UniquePtr options(new Options()); + const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000); + options->crashAfterTicks = crashAfterMS / ticksDuration; diff --git a/rhbz-1173156.patch b/rhbz-1173156.patch new file mode 100644 index 0000000..c35d901 --- /dev/null +++ b/rhbz-1173156.patch @@ -0,0 +1,12 @@ +diff -up firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp.rhbz-1173156 firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp +--- firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp.rhbz-1173156 2019-01-22 10:36:09.284069020 +0100 ++++ firefox-60.5.0/extensions/auth/nsAuthSambaNTLM.cpp 2019-01-22 10:37:12.669757744 +0100 +@@ -161,7 +161,7 @@ nsresult nsAuthSambaNTLM::SpawnNTLMAuthH + const char* username = PR_GetEnv("USER"); + if (!username) return NS_ERROR_FAILURE; + +- const char* const args[] = {"ntlm_auth", ++ const char* const args[] = {"/usr/bin/ntlm_auth", + "--helper-protocol", + "ntlmssp-client-1", + "--use-cached-creds", diff --git a/rhbz-1219542-s390-build.patch b/rhbz-1219542-s390-build.patch new file mode 100644 index 0000000..f94e43a --- /dev/null +++ b/rhbz-1219542-s390-build.patch @@ -0,0 +1,23 @@ +diff -up firefox-55.0/js/src/old-configure.in.rhbz-1219542-s390 firefox-55.0/js/src/old-configure.in +--- firefox-55.0/js/src/old-configure.in.rhbz-1219542-s390 2017-07-31 18:20:48.000000000 +0200 ++++ firefox-55.0/js/src/old-configure.in 2017-08-02 14:31:32.190243669 +0200 +@@ -541,7 +541,7 @@ case "$host" in + + *-linux*|*-kfreebsd*-gnu|*-gnu*) + HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" +- HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}" ++ HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O1}" + ;; + + *) +@@ -617,8 +617,8 @@ case "$target" in + + *-*linux*) + if test "$GNU_CC" -o "$GNU_CXX"; then +- MOZ_PGO_OPTIMIZE_FLAGS="-O3" +- MOZ_OPTIMIZE_FLAGS="-O3" ++ MOZ_PGO_OPTIMIZE_FLAGS="-O1" ++ MOZ_OPTIMIZE_FLAGS="-O1" + if test -z "$CLANG_CC"; then + MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS" + fi diff --git a/rhbz-1354671.patch b/rhbz-1354671.patch new file mode 100644 index 0000000..b6e8bbd --- /dev/null +++ b/rhbz-1354671.patch @@ -0,0 +1,12 @@ +diff -up firefox-70.0/layout/base/PresShell.h.1354671 firefox-70.0/layout/base/PresShell.h +--- firefox-70.0/layout/base/PresShell.h.1354671 2019-10-22 12:33:12.987775587 +0200 ++++ firefox-70.0/layout/base/PresShell.h 2019-10-22 12:36:39.999366086 +0200 +@@ -257,7 +257,7 @@ class PresShell final : public nsStubDoc + * to the same aSize value. AllocateFrame is infallible and will abort + * on out-of-memory. + */ +- void* AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { ++ void* __attribute__((optimize("no-lifetime-dse"))) AllocateFrame(nsQueryFrame::FrameIID aID, size_t aSize) { + #define FRAME_ID(classname, ...) \ + static_assert(size_t(nsQueryFrame::FrameIID::classname##_id) == \ + size_t(eArenaObjectID_##classname), \ diff --git a/rhbz-1400293-fix-mozilla-1324096.patch b/rhbz-1400293-fix-mozilla-1324096.patch new file mode 100644 index 0000000..4a2691e --- /dev/null +++ b/rhbz-1400293-fix-mozilla-1324096.patch @@ -0,0 +1,72 @@ +diff --git a/security/certverifier/CertVerifier.cpp b/security/certverifier/CertVerifier.cpp +--- a/security/certverifier/CertVerifier.cpp ++++ b/security/certverifier/CertVerifier.cpp +@@ -120,16 +120,20 @@ IsCertChainRootBuiltInRoot(const UniqueC + } + CERTCertificate* root = rootNode->cert; + if (!root) { + return Result::FATAL_ERROR_LIBRARY_FAILURE; + } + return IsCertBuiltInRoot(root, result); + } + ++// The term "builtin root" traditionally refers to a root CA certificate that ++// has been added to the NSS trust store, because it has been approved ++// for inclusion according to the Mozilla CA policy, and might be accepted ++// by Mozilla applications as an issuer for certificates seen on the public web. + Result + IsCertBuiltInRoot(CERTCertificate* cert, bool& result) + { + result = false; + #ifdef DEBUG + nsCOMPtr component(do_GetService(PSM_COMPONENT_CONTRACTID)); + if (!component) { + return Result::FATAL_ERROR_LIBRARY_FAILURE; +@@ -142,25 +146,38 @@ IsCertBuiltInRoot(CERTCertificate* cert, + return Success; + } + #endif // DEBUG + AutoSECMODListReadLock lock; + for (SECMODModuleList* list = SECMOD_GetDefaultModuleList(); list; + list = list->next) { + for (int i = 0; i < list->module->slotCount; i++) { + PK11SlotInfo* slot = list->module->slots[i]; +- // PK11_HasRootCerts should return true if and only if the given slot has +- // an object with a CKA_CLASS of CKO_NETSCAPE_BUILTIN_ROOT_LIST, which +- // should be true only of the builtin root list. +- // If we can find a copy of the given certificate on the slot with the +- // builtin root list, that certificate must be a builtin. +- if (PK11_IsPresent(slot) && PK11_HasRootCerts(slot) && +- PK11_FindCertInSlot(slot, cert, nullptr) != CK_INVALID_HANDLE) { +- result = true; +- return Success; ++ // We're searching for the "builtin root module", which is a module that ++ // contains an object with a CKA_CLASS of CKO_NETSCAPE_BUILTIN_ROOT_LIST. ++ // We use PK11_HasRootCerts() to identify a module with that property. ++ // In the past, we exclusively used the PKCS#11 module named nssckbi, ++ // which is provided by the NSS library. ++ // Nowadays, some distributions use a replacement module, which contains ++ // the builtin roots, but which also contains additional CA certificates, ++ // such as CAs trusted in a local deployment. ++ // We want to be able to distinguish between these two categories, ++ // because a CA, which may issue certificates for the public web, ++ // is expected to comply with additional requirements. ++ // If the certificate has attribute CKA_NSS_MOZILLA_CA_POLICY set to true, ++ // then we treat it as a "builtin root". ++ if (PK11_IsPresent(slot) && PK11_HasRootCerts(slot)) { ++ CK_OBJECT_HANDLE handle = PK11_FindCertInSlot(slot, cert, nullptr); ++ if (handle != CK_INVALID_HANDLE && ++ PK11_HasAttributeSet(slot, handle, CKA_NSS_MOZILLA_CA_POLICY, ++ false)) { ++ // Attribute was found, and is set to true ++ result = true; ++ break; ++ } + } + } + } + return Success; + } + + static Result + BuildCertChainForOneKeyUsage(NSSCertDBTrustDomain& trustDomain, Input certDER, diff --git a/rust-thirdparty-checksum-fix.patch b/rust-thirdparty-checksum-fix.patch new file mode 100644 index 0000000..8047ea8 --- /dev/null +++ b/rust-thirdparty-checksum-fix.patch @@ -0,0 +1,6 @@ +diff -up firefox-72.0/third_party/rust/backtrace-sys/.cargo-checksum.json.checksum-fix firefox-72.0/third_party/rust/backtrace-sys/.cargo-checksum.json +--- firefox-72.0/third_party/rust/backtrace-sys/.cargo-checksum.json.checksum-fix 2020-01-07 10:55:14.265047927 +0100 ++++ firefox-72.0/third_party/rust/backtrace-sys/.cargo-checksum.json 2020-01-07 10:55:18.109059804 +0100 +@@ -1 +1 @@ +-{"files":{"Cargo.toml":"d7b29a5b7e31bc0ffb83473b2f78041527903740402c1a6394329857045174f7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","build.rs":"0fe1e551ab35e7589f96979cf1d366561b62925e9c7da6249c25f25684ce9ede","src/lib.rs":"cb45ba047240bceac6ea74da50c2f48ae81a965b578c833a766a3ea0db1075f3","src/libbacktrace/LICENSE":"ef8a9b3247488f8901ca60de9b17b745d7bd67e5ec1e622f80d62364572200d8","src/libbacktrace/Makefile.am":"5353e0ce3a4732b42ccf031c474f7234336992cb23ba76cbfda3aa5262e69988","src/libbacktrace/Makefile.in":"1802d55fa8ef616a407c69311b3fa4e579093d124a215c834149ab1c50b4f3ad","src/libbacktrace/Mark.Twain-Tom.Sawyer.txt":"461eb7cb2d57d293fc680c836464c9125e4382be3596f7d415093ae9db8fcb0e","src/libbacktrace/README.md":"3b27ca2f7ddaf464ad81366a278ed4d34ad513de3766b330a51464828fa3131f","src/libbacktrace/acinclude.m4":"7f1d64805039b0e41d4c4106265618a6f8921d3cf091d64ab31fa7b900dc892f","src/libbacktrace/aclocal.m4":"4899cfe70722ba1de2b42b4e9965c1db1b173b5d6d4522cdc785becd5a5c212c","src/libbacktrace/alloc.c":"33891bbaf755c050058f8fd7dd3708e6062ef65245a0717216af45b78bab0fd0","src/libbacktrace/atomic.c":"82fd23c7ee7154d1ce4fc823637ede9cfa0e469f4073f38fff4dd9081070f1aa","src/libbacktrace/backtrace-supported.h.in":"42277f3c383386b6cfa3d3d889336e92303fac0ae1a9fb8a6a56737245dfb8f3","src/libbacktrace/backtrace.c":"837ea7b781a737d1ed37e4d03c463bcbe1432b2dc3b79b37344b21013cdfcca4","src/libbacktrace/backtrace.h":"9f035b3830c1c6000259c8ecf0bf53144f7c2e6064dfc95975b89f7f612ebf0e","src/libbacktrace/btest.c":"41c774496d58177e408b1dc33d6a792d0940634885978eed73fb192f732cafc5","src/libbacktrace/config.guess":"9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b","src/libbacktrace/config.h.in":"b5002d9f96f6a26f54317f9d23a5ffff71fa3ee520fd8993810891d43b9a9bf7","src/libbacktrace/config.sub":"c8e70ab53f04d2f2b0280aa0e8a5432e90a902bfa2af7b0854168eb1fb3a84c0","src/libbacktrace/config/libtool.m4":"644ce34d5e9fcc544f3ef5c707f4cb29add798bbfc24e29932b55fb251e50353","src/libbacktrace/config/ltoptions.m4":"9d294950c4d97e2c891d472933113f397d410ef2a8ed875d714f81761626bbd8","src/libbacktrace/config/ltsugar.m4":"2c6618a04aa6389a2a528cde2e69ed5de55acc6c50892b486ea3e56e4e5b2c3b","src/libbacktrace/config/ltversion.m4":"8d129a46367fadad9f202dac50e708696d4d628313d01745127388e9c736e996","src/libbacktrace/config/lt~obsolete.m4":"c6c668594337aafef7d59f585bce7010436153815fe341461d81301a2235b959","src/libbacktrace/configure":"59763fc255248b54fba5d0761d61093a73d51fa4cb400b0df1b5f339b9c2f48a","src/libbacktrace/configure.ac":"b9292548330eb4d2cb014e9d9e6cd4df656aed982917365896a8f2534e9732e5","src/libbacktrace/dwarf.c":"c2103af5f94dd135e5df2a98dfc28ef2cbe0f3d56783d21e1487b9f314bfcbbc","src/libbacktrace/edtest.c":"947b9878ae45f6ba95d3b949bb080e9feed4ffdb27536cf5602b81ce79556ccf","src/libbacktrace/edtest2.c":"964bb0bb510a19013fb1cb56552929ed15cf55787eba4369d5820b74be07d249","src/libbacktrace/elf.c":"fe3e10d33c0c0965f016381302128ce82d664071095ad5077932377e3a789679","src/libbacktrace/fileline.c":"7b3b92044648f45becc498d4ed41ddc8ec08f0d11f6491cc05cfccd8a4d7627a","src/libbacktrace/filenames.h":"2c23cde7dd12dd9e0343cb37b5066036112deca703b61178f07c01f3e01398c9","src/libbacktrace/filetype.awk":"aa38776487a77dc13c93efa2a861204b384c3c4333501ed9bdb4ccbde2a784c0","src/libbacktrace/install-sh":"e7064b5e01a8d173409749c337966698fa04661cde1e3ef1a93be250eec0d2c3","src/libbacktrace/internal.h":"88c63ad6acc7e68330df3028675be4d4e3374bd787255fe22dd3febbbbc438b6","src/libbacktrace/ltmain.sh":"873bdcbc8690bd90c0f3632aac40027e880fd95ea45fb5a02ed901fea4afa4fe","src/libbacktrace/macho.c":"9a8864901eede4c34305b05bb6e815b25b76f04b59caf74381ca9dfbe8f1a8c4","src/libbacktrace/missing":"300bea3fb273b763eca2e4bb1576c663605d9b49de385fd375f82be8d912f506","src/libbacktrace/mmap.c":"5be917f3e9eba1fe49eb1bb391e28609e8377b4ce4593cace6012bf17434a33c","src/libbacktrace/mmapio.c":"be5719c4f92e70045fe6014a0493a5b4adc165ecde42c20130ea6e9da1ce978f","src/libbacktrace/move-if-change":"689762b92d23003926ba729acf98b9a109abf46de0698c09ddfa0d20490d8af5","src/libbacktrace/nounwind.c":"5eee9cc7298b7d0d2aea68eef62175541f34f88acf17736e0612056c5bb7318d","src/libbacktrace/pecoff.c":"bb536ae71a1a1c4dad5508d26032e7e81860df6d8ddfc8d696378ebefbc513b1","src/libbacktrace/posix.c":"f5e0ff701a1a1e29a25462ea49f174b049dafc6c25e040ee0eb77dd189353277","src/libbacktrace/print.c":"2d446406c8e2d9a1258d46d119be1c563bd86b6a4039cbf773b6de09c541390d","src/libbacktrace/read.c":"d0d4007f681f265a6c31e27ded45f4007502c90464eefdb4e80b69e4ae2ede28","src/libbacktrace/simple.c":"b0f767d3740195015aeadaa67e84bf6eb255a730f258485ca86bdbe02b066eca","src/libbacktrace/sort.c":"a82f911fc826a353ea5616379748dfa318ad4e57e20791af7ead853f7e73583d","src/libbacktrace/state.c":"a45abbe4077a47d17fb9687057c40828e633df12d21b8ed40b71a78d86918100","src/libbacktrace/stest.c":"7443fe435f1ee5ce49a3e634faf81a4137d66a057577fe88a211cfa819ddb2e2","src/libbacktrace/testlib.c":"a7e096e895b36db7f997a6673ce48f92a032046876511e813a8a52de6079b29a","src/libbacktrace/testlib.h":"02e02404dc89dd4f3dd82635f794a927541dd78d490d777bedf8a5424e5033fc","src/libbacktrace/ttest.c":"380f3b2be164bd6770768181fa05f1778cee8f0322434896d19724ae7cd105df","src/libbacktrace/unknown.c":"d2d148ea045dcad96ba1c5528b7036b000eeb8439ae397bca01deb0d8b287972","src/libbacktrace/xcoff.c":"e70ed97743306f71ea6132a058d68f1bb7be1380a2d38725b5dc877f5e07905d","src/libbacktrace/ztest.c":"7ad8277664e596aecb6af25818b7671e199ef6002ec2c38d9288179c5cad2082","symbol-map":"c81ced08aa32f0edb1d0ed6e4aaf5d3d516f8c158417d2ba3fa36b45b6ae08fd"},"package":"c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"} ++{"files":{"Cargo.toml":"d7b29a5b7e31bc0ffb83473b2f78041527903740402c1a6394329857045174f7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","build.rs":"0fe1e551ab35e7589f96979cf1d366561b62925e9c7da6249c25f25684ce9ede","src/lib.rs":"cb45ba047240bceac6ea74da50c2f48ae81a965b578c833a766a3ea0db1075f3","src/libbacktrace/LICENSE":"ef8a9b3247488f8901ca60de9b17b745d7bd67e5ec1e622f80d62364572200d8","src/libbacktrace/Makefile.am":"5353e0ce3a4732b42ccf031c474f7234336992cb23ba76cbfda3aa5262e69988","src/libbacktrace/Makefile.in":"1802d55fa8ef616a407c69311b3fa4e579093d124a215c834149ab1c50b4f3ad","src/libbacktrace/Mark.Twain-Tom.Sawyer.txt":"461eb7cb2d57d293fc680c836464c9125e4382be3596f7d415093ae9db8fcb0e","src/libbacktrace/README.md":"3b27ca2f7ddaf464ad81366a278ed4d34ad513de3766b330a51464828fa3131f","src/libbacktrace/acinclude.m4":"7f1d64805039b0e41d4c4106265618a6f8921d3cf091d64ab31fa7b900dc892f","src/libbacktrace/aclocal.m4":"4899cfe70722ba1de2b42b4e9965c1db1b173b5d6d4522cdc785becd5a5c212c","src/libbacktrace/alloc.c":"33891bbaf755c050058f8fd7dd3708e6062ef65245a0717216af45b78bab0fd0","src/libbacktrace/atomic.c":"82fd23c7ee7154d1ce4fc823637ede9cfa0e469f4073f38fff4dd9081070f1aa","src/libbacktrace/backtrace-supported.h.in":"42277f3c383386b6cfa3d3d889336e92303fac0ae1a9fb8a6a56737245dfb8f3","src/libbacktrace/backtrace.c":"837ea7b781a737d1ed37e4d03c463bcbe1432b2dc3b79b37344b21013cdfcca4","src/libbacktrace/backtrace.h":"9f035b3830c1c6000259c8ecf0bf53144f7c2e6064dfc95975b89f7f612ebf0e","src/libbacktrace/btest.c":"41c774496d58177e408b1dc33d6a792d0940634885978eed73fb192f732cafc5","src/libbacktrace/config.guess":"0913c6ce799fbfca156ae5fb55fc2e5950808b4d1435e71c6a8b768e54424052","src/libbacktrace/config.h.in":"b5002d9f96f6a26f54317f9d23a5ffff71fa3ee520fd8993810891d43b9a9bf7","src/libbacktrace/config.sub":"c8e70ab53f04d2f2b0280aa0e8a5432e90a902bfa2af7b0854168eb1fb3a84c0","src/libbacktrace/config/libtool.m4":"644ce34d5e9fcc544f3ef5c707f4cb29add798bbfc24e29932b55fb251e50353","src/libbacktrace/config/ltoptions.m4":"9d294950c4d97e2c891d472933113f397d410ef2a8ed875d714f81761626bbd8","src/libbacktrace/config/ltsugar.m4":"2c6618a04aa6389a2a528cde2e69ed5de55acc6c50892b486ea3e56e4e5b2c3b","src/libbacktrace/config/ltversion.m4":"8d129a46367fadad9f202dac50e708696d4d628313d01745127388e9c736e996","src/libbacktrace/config/lt~obsolete.m4":"c6c668594337aafef7d59f585bce7010436153815fe341461d81301a2235b959","src/libbacktrace/configure":"59763fc255248b54fba5d0761d61093a73d51fa4cb400b0df1b5f339b9c2f48a","src/libbacktrace/configure.ac":"b9292548330eb4d2cb014e9d9e6cd4df656aed982917365896a8f2534e9732e5","src/libbacktrace/dwarf.c":"c2103af5f94dd135e5df2a98dfc28ef2cbe0f3d56783d21e1487b9f314bfcbbc","src/libbacktrace/edtest.c":"947b9878ae45f6ba95d3b949bb080e9feed4ffdb27536cf5602b81ce79556ccf","src/libbacktrace/edtest2.c":"964bb0bb510a19013fb1cb56552929ed15cf55787eba4369d5820b74be07d249","src/libbacktrace/elf.c":"fe3e10d33c0c0965f016381302128ce82d664071095ad5077932377e3a789679","src/libbacktrace/fileline.c":"7b3b92044648f45becc498d4ed41ddc8ec08f0d11f6491cc05cfccd8a4d7627a","src/libbacktrace/filenames.h":"2c23cde7dd12dd9e0343cb37b5066036112deca703b61178f07c01f3e01398c9","src/libbacktrace/filetype.awk":"aa38776487a77dc13c93efa2a861204b384c3c4333501ed9bdb4ccbde2a784c0","src/libbacktrace/install-sh":"e7064b5e01a8d173409749c337966698fa04661cde1e3ef1a93be250eec0d2c3","src/libbacktrace/internal.h":"88c63ad6acc7e68330df3028675be4d4e3374bd787255fe22dd3febbbbc438b6","src/libbacktrace/ltmain.sh":"873bdcbc8690bd90c0f3632aac40027e880fd95ea45fb5a02ed901fea4afa4fe","src/libbacktrace/macho.c":"9a8864901eede4c34305b05bb6e815b25b76f04b59caf74381ca9dfbe8f1a8c4","src/libbacktrace/missing":"300bea3fb273b763eca2e4bb1576c663605d9b49de385fd375f82be8d912f506","src/libbacktrace/mmap.c":"5be917f3e9eba1fe49eb1bb391e28609e8377b4ce4593cace6012bf17434a33c","src/libbacktrace/mmapio.c":"be5719c4f92e70045fe6014a0493a5b4adc165ecde42c20130ea6e9da1ce978f","src/libbacktrace/move-if-change":"689762b92d23003926ba729acf98b9a109abf46de0698c09ddfa0d20490d8af5","src/libbacktrace/nounwind.c":"5eee9cc7298b7d0d2aea68eef62175541f34f88acf17736e0612056c5bb7318d","src/libbacktrace/pecoff.c":"bb536ae71a1a1c4dad5508d26032e7e81860df6d8ddfc8d696378ebefbc513b1","src/libbacktrace/posix.c":"f5e0ff701a1a1e29a25462ea49f174b049dafc6c25e040ee0eb77dd189353277","src/libbacktrace/print.c":"2d446406c8e2d9a1258d46d119be1c563bd86b6a4039cbf773b6de09c541390d","src/libbacktrace/read.c":"d0d4007f681f265a6c31e27ded45f4007502c90464eefdb4e80b69e4ae2ede28","src/libbacktrace/simple.c":"b0f767d3740195015aeadaa67e84bf6eb255a730f258485ca86bdbe02b066eca","src/libbacktrace/sort.c":"a82f911fc826a353ea5616379748dfa318ad4e57e20791af7ead853f7e73583d","src/libbacktrace/state.c":"a45abbe4077a47d17fb9687057c40828e633df12d21b8ed40b71a78d86918100","src/libbacktrace/stest.c":"7443fe435f1ee5ce49a3e634faf81a4137d66a057577fe88a211cfa819ddb2e2","src/libbacktrace/testlib.c":"a7e096e895b36db7f997a6673ce48f92a032046876511e813a8a52de6079b29a","src/libbacktrace/testlib.h":"02e02404dc89dd4f3dd82635f794a927541dd78d490d777bedf8a5424e5033fc","src/libbacktrace/ttest.c":"380f3b2be164bd6770768181fa05f1778cee8f0322434896d19724ae7cd105df","src/libbacktrace/unknown.c":"d2d148ea045dcad96ba1c5528b7036b000eeb8439ae397bca01deb0d8b287972","src/libbacktrace/xcoff.c":"e70ed97743306f71ea6132a058d68f1bb7be1380a2d38725b5dc877f5e07905d","src/libbacktrace/ztest.c":"7ad8277664e596aecb6af25818b7671e199ef6002ec2c38d9288179c5cad2082","symbol-map":"c81ced08aa32f0edb1d0ed6e4aaf5d3d516f8c158417d2ba3fa36b45b6ae08fd"},"package":"c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"} diff --git a/sources b/sources new file mode 100644 index 0000000..4597967 --- /dev/null +++ b/sources @@ -0,0 +1,3 @@ +SHA512 (cbindgen-vendor.tar.xz) = f0425020e2d43a3d28b03f82bdb9719728112a2c94b1d595da384d0674ca21d0940a6f729a690434d670e598fbc6bb5193c89da0a4633a734c70dd786222e711 +SHA512 (firefox-81.0.2.source.tar.xz) = 8a3ef4819120e93b860344ef05b4ef05262e3f127053ef66b3c1eb4b157932913f72fd4ba5500e86c2ef29f25be58e0c6e2c47a1c1ecde2abe77ece5f948fd75 +SHA512 (firefox-langpacks-81.0.2-20201012.tar.xz) = 5cc72b8a2e27318a55cda9156c6ade3613ae7f560d76fa0a12182626c6051b8d02f23b95597d185daf35b85bd8491bc44a6ca214619b641dc47f98564db75c97