Wow, lots of patches.
The signed vs. unsigned change really deserves some inline comment otherwise it'll be hard for anyone reading the code to understand why an unsigned codec is used for an advertised-as-signed one.

What about merging all patches in a single one and adding proper comments to explain what's being done ?

This is particularly needed as we have NO AUTOMATED TESTS to ensure a regression is not introduced.

Note: Speex codec is not tested due to the lack of tools (SWFmill currently
doesn't know how to deal with Ogg/Speex file). Asao/Nellymoser codec is not
tested due to the lack of decoding support in my libAV installation
(`gnash --media=gst` played it nicely though).

Also, current sample count calculation ignores the possibility of the
decoded audio being 1 byte/sample (which is the case when 8-bit
`UNCOMPRESSED`/`RAW PCM audio is being played).

This patch makes the division depends on the decoded sample format.
(Additional divide-by-2 only if the audio is 16-bit or 16-bit planar)

Note: This patch provides no provision for audio codec that decodes into
32/24-bit PCM, 32-bit float, or 64-bit double sample formats. To my knowledge,
Flash didn't really support any codec that decodes into these formats.
(Well, unless Gnash somehow used `ffmp3float` decoder for MP3 codec.
Original code didn't have any provision for it however)

Note #1: There are multiple issues in Gnash's FFmpeg codec and resampler
backend which are closely tangled together. As these patches tries to fix
each of them individually, the symptom will change or worsen as the patching go,
but will get better at the end where all the patches are completely applied.

Note #2: I haven't tested on multiple variants of FFmpeg/libAV (especially
ones that came with `swresample.h` or `avresample.h`). So it would need
a more intensive review and testing to make sure that this series of fix
doesn't introduce regression on other FFmpeg/libAV version or other non-PCM codecs.

Patch 1 of 5:
See the attached `0004_use-source-sample-format-in-ffmpeg-audio-resampler.patch`