Skip to content

Commit

Permalink
upstream sync, init ffmpeg threads like LAVFilters does xbmc#9899 and…
Browse files Browse the repository at this point in the history
… fix for android
  • Loading branch information
davilla authored and koying committed Jun 29, 2016
1 parent afb3c40 commit 1783d42
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
#ifdef TARGET_DARWIN_OSX
#include "VDA.h"
#endif
#if defined(TARGET_ANDROID)
#include "android/activity/AndroidFeatures.h"
#endif
#include "utils/StringUtils.h"

extern "C" {
Expand Down Expand Up @@ -264,9 +267,13 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
}
else
{
int num_threads = std::min(8 /*MAX_THREADS*/, g_cpuInfo.getCPUCount());
if( num_threads > 1)
m_pCodecContext->thread_count = num_threads;
#if defined(TARGET_ANDROID)
int num_threads = CAndroidFeatures::GetCPUCount() * 3 / 2;
#else
int num_threads = av_cpu_count() * 3 / 2;
#endif
num_threads = std::max(1, std::min(num_threads, 16));
m_pCodecContext->thread_count = num_threads;
m_pCodecContext->thread_safe_callbacks = 1;
m_decoderState = STATE_SW_MULTI;
CLog::Log(LOGDEBUG, "CDVDVideoCodecFFmpeg - open frame threaded with %d threads", num_threads);
Expand Down

0 comments on commit 1783d42

Please sign in to comment.