Permalink
Browse files

Merge pull request #3582 from ulion/ffmpeg_multi_thread_switch

Add video player switch for multi-thread decoding
  • Loading branch information...
2 parents 50bb60c + 6a532d3 commit c0726e302c5b9324f96bf1fc26a2d996111e64cf @jmarshallnz jmarshallnz committed Nov 11, 2013
View
13 language/English/strings.po
@@ -5995,7 +5995,11 @@ msgctxt "#13439"
msgid "Allow hardware acceleration (MediaCodec)"
msgstr ""
-#empty strings from id 13440 to 13499
+msgctxt "#13440"
+msgid "Frame Multi Threaded Decoding (less reliable)"
+msgstr ""
+
+#empty strings from id 13441 to 13499
#: system/settings/settings.xml
msgctxt "#13500"
@@ -14566,7 +14570,12 @@ msgctxt "#36422"
msgid "Enable hardware video decode using AMLogic decoder"
msgstr ""
-#empty strings from id 36423 to 36499
+#: system/settings/settings.xml
+msgctxt "#36423"
+msgid "Use ffmpeg frame multiple thread decoding when hardware decoding not working or disabled. (less reliable than default single thread mode)"
+msgstr ""
+
+#empty strings from id 36424 to 36499
#end reservation
#: system/settings/settings.xml
View
5 system/settings/settings.xml
@@ -466,6 +466,11 @@
<default>true</default>
<control type="toggle" />
</setting>
+ <setting id="videoplayer.useframemtdec" type="boolean" label="13440" help="36423">
+ <level>2</level>
+ <default>false</default>
+ <control type="toggle" />
+ </setting>
<setting id="videoplayer.adjustrefreshrate" type="integer" label="170" help="36164">
<level>2</level>
<default>0</default> <!-- ADJUST_REFRESHRATE_OFF -->
View
5 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -253,6 +253,11 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Keep default threading for Hi10p: %d",
m_pCodecContext->thread_type);
}
+ else if (CSettings::Get().GetBool("videoplayer.useframemtdec"))
+ {
+ CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Keep default threading %d by videoplayer.useframemtdec",
+ m_pCodecContext->thread_type);
+ }
else
m_pCodecContext->thread_type = FF_THREAD_SLICE;

5 comments on commit c0726e3

@da-anda
Team Kodi member

When I enable this setting it's breaking DXVA(2) accelerated playback (XBMC stays in GUI mode and only audio is played) and freezes/crashes XBMC when I stop playback. Video playback mode is set to "automatic" and DXVA2 is enabled (XBMC default settings, besides enabling multithreaded setting). Can somebody else reproduce this on windows? Can provide debug log in forum.

edit: This happens when I play a ordinary high profile h264 file. From the description the multithreaded decoding should only kick in when hw acceleration is not possible, but for me it's also kicking in when DXVA is used (which seems to kick in after the MT switch has been enabled according to the log)

@FernetMenta
Team Kodi member

the setting does not what the help string pretends. it enables mt regardless of hw decoders are chosen.

@fritsch
Team Kodi member

Yeah - I exactly knew, that users will just enable it - regardless of any background. Therefore - thanks god - we have the debug log string :-) to actually see this.

@da-anda
Team Kodi member

so I'm just a user now? ;)

I was testing this thing and it failed because it didn't do what the description said - if description and actual behavior would have matched I wouldn't have reported anything (it already says it's unstable), but it didn't. So either we fix the description or change the code to behave like description says (which would be the better thing IMO).

@fritsch
Team Kodi member

@da-anda: Nope. But I feared this, when the PR started. Without the additional logline we would not be able to do any postmortem analysis.

We have the big problem, that most users also won't read, if the description would match. Additionally it would not help to query the GUI settings - cause think of hi10p. No hwaccel would be added, but we would disable multithreading cause of e.g. vdpau would be enabled.

I did not find a good solution to that problem yet. Last time, we discussed this approach, a white list was discussed, which also won't work for codecs that are "normally" decoded via hwaccels

Please sign in to comment.