Opened 14 years ago
Closed 14 years ago
Last modified 14 years ago
#7397 closed patch (fixed)
libav seeking near the start of video is broken
Reported by: | Owned by: | markk | |
---|---|---|---|
Priority: | minor | Milestone: | 0.23 |
Component: | MythTV - Video Playback | Version: | head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Using libav seeking to a position near the start when the video has a non-zero context start time causes future seeks to be broken. The following code in avformatdecoder.cpp is incorrect since the start_time is not zero for some videos and is required to correctly calculate the timestamp fed to av_seek_frame().
if (desiredFrame <= 1) { av_update_cur_dts(ic, st, 0); ic->start_time = 0; }
This code appears to have been added because it was assumed that seeking to the beginning caused it to return a DTS timestamp toward the end of the video. In actuality it sometimes returns a DTS value that is _earlier_ than the start time. This causes the lsb3full function called later to generate an adj_cur_dts value well beyond the end of the video. The fix should be to check if the cur_dts is earlier than the context start_time. If so, either one of the following changes should work:
- fix1 -> remove broken code and set the start_time to the current DTS time
OR
- fix2 -> remove broken code and set adj_cur_dts to zero if it's earlier than the start time
I've tested both methods wiht success and no apparent problems. I'm attaching both methods to the ticket.
Attachments (3)
Change History (9)
Changed 14 years ago by
Attachment: | mythtv_libav_seek_start_fix1.diff added |
---|
Changed 14 years ago by
Attachment: | mythtv_libav_seek_start_fix2.diff added |
---|
set adj_cur_dts to zero if dts is earlier than start_time
comment:1 Changed 14 years ago by
After more thought and testing the second fix which sets adj_cur_dts to zero is a much better solution since future calculations for seeking and possibly other functionality relies upon the ic->start_time value.
Changed 14 years ago by
Attachment: | t7397_mythtv_libav_seek_start_v3.diff added |
---|
final update (trunk 23210)
comment:2 Changed 14 years ago by
Owner: | changed from Janne Grunau to markk |
---|---|
Status: | new → accepted |
comment:3 Changed 14 years ago by
Milestone: | unknown → 0.23 |
---|
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
update the start time if dts earlier than start time