diff options
author | Moonchild <wolfbeast@users.noreply.github.com> | 2016-12-31 23:49:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-31 23:49:50 +0100 |
commit | c2e68c5c2591116dbd0e7da0aadf9f27dd910dc7 (patch) | |
tree | de95af14441a7226e77ac42af8488d35466b665a | |
parent | e688fd9e6c8c56095cf89e1b31ee356eb8e7de25 (diff) | |
parent | 579c40982c1be25ec0fe84981b596fd0e435cd84 (diff) | |
download | palemoon-gre-c2e68c5c2591116dbd0e7da0aadf9f27dd910dc7.tar.gz |
Merge pull request #802 from trav90/ffmpeg-work
Don't let FFmpeg be a resource hog
-rw-r--r-- | dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp | 22 | ||||
-rw-r--r-- | media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp | 2 |
2 files changed, 14 insertions, 10 deletions
diff --git a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp b/dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp index a3a7c1b22..ba80a923b 100644 --- a/dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegH264Decoder.cpp @@ -126,17 +126,21 @@ FFmpegH264Decoder<LIBAV_VER>::InitCodecContext() // We use the same logic as libvpx in determining the number of threads to use // so that we end up behaving in the same fashion when using ffmpeg as // we would otherwise cause various crashes (see bug 1236167) - int decode_threads = 2; - if (mCodecID != AV_CODEC_ID_VP8) { - if (mDisplayWidth >= 2048) { - decode_threads = 8; - } else if (mDisplayWidth >= 1024) { - decode_threads = 4; - } + int decode_threads = 1; + if (mDisplayWidth >= 2048) { + decode_threads = 8; + } else if (mDisplayWidth >= 1024) { + decode_threads = 4; + } else if (mDisplayWidth >= 320) { + decode_threads = 2; } - decode_threads = std::min(decode_threads, PR_GetNumberOfProcessors()); + + decode_threads = std::min(decode_threads, PR_GetNumberOfProcessors() - 1); + decode_threads = std::max(decode_threads, 1); mCodecContext->thread_count = decode_threads; - mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME; + if (decode_threads > 1) { + mCodecContext->thread_type = FF_THREAD_SLICE | FF_THREAD_FRAME; + } // FFmpeg will call back to this to negotiate a video pixel format. mCodecContext->get_format = ChoosePixelFormat; diff --git a/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp b/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp index ff98b4c30..a1c40a8fc 100644 --- a/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/frameworks/av/media/libstagefright/SampleTable.cpp @@ -375,7 +375,7 @@ status_t SampleTable::setTimeToSampleParams( status_t SampleTable::setCompositionTimeToSampleParams( off64_t data_offset, size_t data_size) { - ALOGI("There are reordered frames present."); + ALOGV("There are reordered frames present."); if (mCompositionTimeDeltaEntries != NULL || data_size < 8) { return ERROR_MALFORMED; |