Opened 15 years ago
Closed 15 years ago
#7935 closed patch (fixed)
[PATCH] Improve MPEG-TS seeking performance by 60X
Reported by: | Owned by: | markk | |
---|---|---|---|
Priority: | minor | Milestone: | 0.23 |
Component: | MythTV - Video Playback | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
I've recently discovered that slow seeking for MPEG-TS using av_seek_frame is caused by inefficient handling of EOF in libs/libmythtv/RingBuffer.cpp. The attached patch addresses the following issues:
- Inside safe_read() we need to break after a read() if it's an "oldfile" (>30 minutes). There is no reason to delay (60000 usec) and retry for this case. The calling code will retry anyways if ret > 0 and if ret == 0 then it really is the EOF.
- When an lseek is performed we need to adjust the totfree buffer amount before entering a 50000 usec delay. Every time an lseek is performed the buffer gets reset so we should update totfree before checking to see if the buffer it full and we need to wiat.
One other issue I believe is that 30 minutes is too long to determine if a file is an "oldfile". I'd like to see that reduced to a more reasonable value and if possible add a better check to determine it the file is open for writing.
Without this patch applied an av_seek_frame takes ~0.9 secs and with the patch it takes ~0.015. This will also improve performance for other containers as well.
Attachments (2)
Change History (4)
Changed 15 years ago by
Attachment: | t7935_improve_mpegts_seeking_v1.diff added |
---|
comment:1 Changed 15 years ago by
Owner: | changed from Janne Grunau to markk |
---|---|
Status: | new → accepted |
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
(In [23288]) Improved AVFormatDecoder seeking with patches from Taylor Ralph.
I've been testing for a few days and the improvement in navigating files without a markup (i.e. MythVideo?) is substantial.
I'd delayed due to an issue seen with certain test matroska files but I've now realised that this is a separate, existing seek problem with these files that manifests itself slightly differently following these changes.
initial revision (trunk 23210)