Closed Bug 1237210 Opened 8 years ago Closed 8 years ago

FFmpeg PDM uses too many threads

Categories

(Core :: Audio/Video: Playback, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: jya, Assigned: jya)

References

Details

Attachments

(2 files)

FFmpeg PDM currently use as many cores (virtual or otherwise) is available *per* decoder.

On your typical quad-core machines, that's 8 threads per video.

We should reduces the number of threads to a more reasonable amount, similar to what libvpx is doing and do so according to the resolution.

Currently this appear to be the primary suspect for bug 1236167.

We can end up in the layout/reftest/webm-video with over 2000 threads in use. This leads to various crashes in the gfx component due to OOM.
A common initialization procedure is too restrictive, and we end up setting up audio configuration for video decoding and vice-versa
Attachment #8704545 - Flags: review?(gsquelart)
We use the same logic as what is used in libvpx to ensure that we won't get a regression due to excessive memory/thread use when replacing libvpx with ffmpeg.
Attachment #8704546 - Flags: review?(gsquelart)
Comment on attachment 8704545 [details] [diff] [review]
[ffmpeg] P1. Have specialized AVCodecContext initialization.

Review of attachment 8704545 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with tiny nit (if you agree).

::: dom/media/platforms/ffmpeg/FFmpegAudioDecoder.cpp
@@ +47,5 @@
> +  uint32_t major, minor;
> +  FFmpegRuntimeLinker::GetVersion(major, minor);
> +  // LibAV 0.8 produces rubbish float interleaved samples, request 16 bits audio.
> +  mCodecContext->request_sample_fmt = major == 53 ?
> +    AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_FLT;

Nit: For slightly better readability, I'd suggest moving the test down in the ?: statement, and adding parens around the test, i.e.:
  mCodecContext->request_sample_fmt =
    (major == 53) ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_FLT;
Attachment #8704545 - Flags: review?(gsquelart) → review+
Attachment #8704546 - Flags: review?(gsquelart) → review+
It was a copy/paste of the original code. But sure.
https://hg.mozilla.org/mozilla-central/rev/e079e281ae09
https://hg.mozilla.org/mozilla-central/rev/84db9e4cf212
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: