Skip to content
This repository
Browse code

Merge pull request #2064 from fritsch/xbmc-upstream

dvdplayer: Allow multithread decoding when software is used
  • Loading branch information...
commit 2c8e509660fcb186f0c59faff76d5338ca5fee36 2 parents 5731da5 + 42271fa
Joakim Plate authored March 01, 2013
18  xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -138,6 +138,7 @@ CDVDVideoCodecFFmpeg::CDVDVideoCodecFFmpeg() : CDVDVideoCodec()
138 138
   m_iScreenHeight = 0;
139 139
   m_iOrientation = 0;
140 140
   m_bSoftware = false;
  141
+  m_isHi10p = false;
141 142
   m_pHardware = NULL;
142 143
   m_iLastKeyframe = 0;
143 144
   m_dts = DVD_NOPTS_VALUE;
@@ -187,7 +188,10 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
187 188
       case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
188 189
       case FF_PROFILE_H264_HIGH_444_INTRA:
189 190
       case FF_PROFILE_H264_CAVLC_444:
  191
+      // this is needed to not open the decoders
190 192
       m_bSoftware = true;
  193
+      // this we need to enable multithreading for hi10p via advancedsettings
  194
+      m_isHi10p = true;
191 195
       break;
192 196
     }
193 197
   }
@@ -247,8 +251,18 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
247 251
   m_pCodecContext->codec_tag = hints.codec_tag;
248 252
   /* Only allow slice threading, since frame threading is more
249 253
    * sensitive to changes in frame sizes, and it causes crashes
250  
-   * during HW accell */
251  
-  m_pCodecContext->thread_type = FF_THREAD_SLICE;
  254
+   * during HW accell - so we unset it in this case.
  255
+   *
  256
+   * When we detect Hi10p and user did not disable hi10pmultithreading
  257
+   * via advancedsettings.xml we keep the ffmpeg default thread type.
  258
+   * */
  259
+  if(m_isHi10p && !g_advancedSettings.m_videoDisableHi10pMultithreading)
  260
+  {
  261
+    CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Keep default threading for Hi10p: %d",
  262
+                        m_pCodecContext->thread_type);
  263
+  }
  264
+  else
  265
+    m_pCodecContext->thread_type = FF_THREAD_SLICE;
252 266
 
253 267
 #if defined(TARGET_DARWIN_IOS)
254 268
   // ffmpeg with enabled neon will crash and burn if this is enabled
1  xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
@@ -114,6 +114,7 @@ class CDVDVideoCodecFFmpeg : public CDVDVideoCodec
114 114
 
115 115
   std::string m_name;
116 116
   bool              m_bSoftware;
  117
+  bool  m_isHi10p;
117 118
   IHardwareDecoder *m_pHardware;
118 119
   int m_iLastKeyframe;
119 120
   double m_dts;
2  xbmc/settings/AdvancedSettings.cpp
@@ -112,6 +112,7 @@ void CAdvancedSettings::Initialize()
112 112
   m_DXVANoDeintProcForProgressive = false;
113 113
   m_videoFpsDetect = 1;
114 114
   m_videoDefaultLatency = 0.0;
  115
+  m_videoDisableHi10pMultithreading = false;
115 116
 
116 117
   m_musicUseTimeSeeking = true;
117 118
   m_musicTimeSeekForward = 10;
@@ -493,6 +494,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
493 494
     XMLUtils::GetBoolean(pElement,"enablehighqualityhwscalers", m_videoEnableHighQualityHwScalers);
494 495
     XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f);
495 496
     XMLUtils::GetBoolean(pElement,"allowmpeg4vdpau",m_videoAllowMpeg4VDPAU);
  497
+    XMLUtils::GetBoolean(pElement,"disablehi10pmultithreading",m_videoDisableHi10pMultithreading);
496 498
     XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI);    
497 499
     XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace);
498 500
     XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1);
1  xbmc/settings/AdvancedSettings.h
@@ -164,6 +164,7 @@ class CAdvancedSettings
164 164
     bool m_DXVAForceProcessorRenderer;
165 165
     bool m_DXVANoDeintProcForProgressive;
166 166
     int  m_videoFpsDetect;
  167
+    bool m_videoDisableHi10pMultithreading;
167 168
 
168 169
     CStdString m_videoDefaultPlayer;
169 170
     CStdString m_videoDefaultDVDPlayer;

0 notes on commit 2c8e509

Please sign in to comment.
Something went wrong with that request. Please try again.