This is a big change, and unfortunately impossible to break down with independently functional commits.
There are four main changes being applied here:
* Code cleanup, including making all MediaDataDecoder related code mozilla coding style compliant
* Make MediaDataDecoder use MozPromise
* Making Flush and Shutdown processes fully asynchronous
* Fixing few data races encountered across the code, in particular in the Android PDM
MozReview-Commit-ID: DpiZucGofJT
--HG--
extra : rebase_source : 80bd6c6f9726d536b6f306c40d9af6df27333be9
Additionally, mark non fatal decoding error as such.
Due to the complexity of WMF decoder error handling, this will be done in a follow up bug.
MozReview-Commit-ID: KHWORM8899c
--HG--
extra : rebase_source : 77ada9bb95ba4d44d1bca209e4a7d28369f24f6e
We provide even further details for the GMP decoder. Other decoders to follow.
MozReview-Commit-ID: 7NxJPec8xWv
--HG--
extra : rebase_source : f44120983070e5c107ecd5cafc762da90aab44bf
The OggReader always passed a complete ogg_packet to the vorbis decoder, ensuring that the right number of frames was be returned. In the conversion to the new architecture, this information got lost making the vorbis decoder always return more frames than normal on the last packet.
MozReview-Commit-ID: HYHxqXfYntJ
--HG--
extra : rebase_source : 3d2a59b011ec1e996ab7aaf29e16baa495f7d31c
The OggReader always passed a complete ogg_packet to the vorbis decoder, ensuring that the right number of frames was be returned. In the conversion to the new architecture, this information got lost making the vorbis decoder always return more frames than normal on the last packet.
MozReview-Commit-ID: HYHxqXfYntJ
--HG--
extra : rebase_source : 3aa215576fe77357dd9a484626c0e5759aeedb3c
r?cpearce
A hack was in place to ensure that the first returned sample would have
a time of 0 so that the media start time would be 0. This was incorrect
for two primary reasons:
- The media start time is adjusted according to the first sample anyway.
- When seeking to 0, the first sample would have a time different to the
first sample decoded (when we want them to have the same time).
MozReview-Commit-ID: IyuT9O2F4EZ
--HG--
extra : rebase_source : 74b29eb5970c67aed6ca568d1882e3b6c54a6637
Extract all the parameters passed to CreateAudioDecoder/CreateVideoDecoder and
place them into a structure that is passed down to the creation of the actual
decoder, where the relevant parameters can be extracted.
This makes it easier to add more arguments to the Create*Decoder calls in future.
MozReview-Commit-ID: 9LZlcfRVz6A
--HG--
extra : rebase_source : ce3f0c7d0784b96267728697ff5d535ccb8ee7a6
The way we pass in AudioDataValue arrays into AudioData is non-uniform:
sometimes we have nsAutoArrayPtrs, sometimes we don't, and it's not
immediately obvious from the function signature of the constructor that
we're actually taking ownership of this array. Let's fix that by using
UniquePtr<AudioDataValue[]> smart pointers to hold the data prior to
creating AudioData values, and for passing in to AudioData's
constructor. Using standard-er C++ things instead of our homegrown ones
is a good thing.
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout. The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.
CLOSED TREE makes big refactorings like this a piece of cake.
# The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
xargs perl -p -i -e '
s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
s/nsRefPtr ?</RefPtr</g; # handle declarations and variables
'
# Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h
# Handle nsRefPtr.h itself, a couple places that define constructors
# from nsRefPtr, and code generators specially. We do this here, rather
# than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
# things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
mfbt/nsRefPtr.h \
xpcom/glue/nsCOMPtr.h \
xpcom/base/OwningNonNull.h \
ipc/ipdl/ipdl/lower.py \
ipc/ipdl/ipdl/builtin.py \
dom/bindings/Codegen.py \
python/lldbutils/lldbutils/utils.py
# In our indiscriminate substitution above, we renamed
# nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'
if [ -d .git ]; then
git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi
--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h