View Issue Details

IDProjectCategoryView StatusLast Update
0004507The Dark ModCodingpublic14.06.2018 07:16
Reporterstgatilov Assigned Tostgatilov  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.06Fixed in VersionTDM 2.06 
Summary0004507: Horrible performance of playing ROQ video from pk4
DescriptionPlaying some ROQ videos is very slow.
Steps To ReproduceStart mission "A score to settle" and watch briefing videos.

It is quite slow, FPS often drops to less than 5.
Process explorer shows that TDM reads about 6 GB of data from disk during briefing playback.
Additional InformationOriginal ID's code for playing ROQ videos (located in renderer/Cinematic.cpp) was replaced with code calling FFMPEG library (located in renderer/CinematicFFMpeg.cpp). This changes were ported from dhewm3 repository into our x64 branch. Now the x64 branch is merged intro trunk, so we have to fix it.
Tagsx64

Relationships

related to 0004504 resolvedstgatilov Performance of reading OGG from PK4 
related to 0004529 resolvedstgatilov Check how compression removal works in tdm_update 

Activities

stgatilov

stgatilov

15.04.2017 08:27

administrator   ~0008794

It turns out that the problem gets away if you unpack the videos from pk4 archive.
So most likely the problem is caused by lots of seeking through pk4 file. The same problem applies to reading ogg files from pk4, see the related issue.
duzenko

duzenko

01.05.2017 19:24

developer   ~0008822

Added code to unpack any video from a pk4 to fm/mission_name on first play.
nbohr1more

nbohr1more

02.05.2017 01:32

developer   ~0008823

Last edited: 02.05.2017 01:32

View 2 revisions

I think this is a good solution for now.

Taaaki and Greebo can pow-wow about tdm_updater or other options like making changes to the in-game downloader for 2.07 (etc)

stgatilov

stgatilov

02.05.2017 17:19

administrator   ~0008826

I have just committed the repacking code.
More explanations in the related 4504 issue.
stgatilov

stgatilov

06.05.2017 17:22

administrator   ~0008837

I believe there is no reason for unpacking the videos from pk4 now.
Duzenko, can I rollback your changes from revision 6844 now? Or at least put them behind cvar?
duzenko

duzenko

06.05.2017 17:57

developer   ~0008838

Last edited: 06.05.2017 17:59

View 2 revisions

By all means.
Mine was just a temporary workaround.
...
The less workaround stuff the better.

stgatilov

stgatilov

07.05.2017 02:12

administrator  

4507_duzenko_roq_fix.patch (838 bytes)   
Index: renderer/CinematicFFMpeg.cpp
===================================================================
--- renderer/CinematicFFMpeg.cpp	(revision 6866)
+++ renderer/CinematicFFMpeg.cpp	(working copy)
@@ -127,12 +127,22 @@
     _packetTimeOffset = 0;
     _looping = looping;
 
-    return OpenAVDecoder();
+	return true;// OpenAVDecoder();
 }
 
 bool idCinematicFFMpeg::OpenAVDecoder()
 {
     _file = fileSystem->OpenFileRead(_path.c_str());
+	if (idStr::FindText( _file->GetFullPath(), ".pk4/", false ) >= 0) {
+		byte *b = new byte[_file->Length()];
+		_file->Read( b, _file->Length() );
+		idFile *extrFile = fileSystem->OpenFileWrite( _path );
+		extrFile->Write( b, _file->Length() );
+		delete b;
+		delete _file;
+		delete extrFile;
+		_file = fileSystem->OpenFileRead( _path.c_str() );
+	}
 
     if (_file == NULL)
     {
4507_duzenko_roq_fix.patch (838 bytes)   
stgatilov

stgatilov

07.05.2017 02:13

administrator   ~0008840

Ok, I reverted revision 6844.
Attached TortoiseSVN patch of it here (just in case circumstances change again in future).

Issue History

Date Modified Username Field Change
15.04.2017 08:25 stgatilov New Issue
15.04.2017 08:25 stgatilov Status new => assigned
15.04.2017 08:25 stgatilov Assigned To => stgatilov
15.04.2017 08:26 stgatilov Relationship added related to 0004504
15.04.2017 08:27 stgatilov Note Added: 0008794
15.04.2017 08:46 stgatilov Tag Attached: x64
01.05.2017 19:24 duzenko Note Added: 0008822
02.05.2017 01:32 nbohr1more Note Added: 0008823
02.05.2017 01:32 nbohr1more Note Edited: 0008823 View Revisions
02.05.2017 01:33 nbohr1more Status assigned => feedback
02.05.2017 17:19 stgatilov Note Added: 0008826
02.05.2017 17:19 stgatilov Status feedback => assigned
06.05.2017 17:22 stgatilov Note Added: 0008837
06.05.2017 17:57 duzenko Note Added: 0008838
06.05.2017 17:59 duzenko Note Edited: 0008838 View Revisions
07.05.2017 02:12 stgatilov File Added: 4507_duzenko_roq_fix.patch
07.05.2017 02:13 stgatilov Note Added: 0008840
07.05.2017 02:17 stgatilov Relationship added related to 0004529
07.05.2017 02:26 stgatilov Status assigned => resolved
07.05.2017 02:26 stgatilov Fixed in Version => TDM 2.06
07.05.2017 02:26 stgatilov Resolution open => fixed
14.06.2018 07:16 nbohr1more Relationship added related to 0004835
17.07.2018 16:49 stgatilov Relationship deleted related to 0004835