Rewrote finding keyframes and seeking. The problem was that
in many situations, FindKeyframe() was unable to reliably predict what frame Seek() would be able to seek to. * Refactored a new base class StreamBase from the old StreamCookie, renamed StreamCookie to just Stream. * In FindKeyframe(), Stream will create a "ghost" StreamBase instance. That one will be used to actually seek in the stream without modifying the AVFormatContext of the real Stream. From that we can tell what position we can /really/ seek to. For AVIs mostly, it is important to still use av_index_search_timestamp(), since for many AVIs I tested, reading the next packet after seeking did not produce a timestamp, however the index entry contained just the correct one. If the next packet does contain a PTS, it will still override the index timestamp, though. * Contrary to my previous belief, there was still a locking problem with how MediaPlayer used the BMediaTracks. The video decoding thread and the playback manager both used FindKeyframe() without holding the same lock. We support this now by using one BLocker per Stream. (The source BDataIO is still protected by another single lock.) With the new ghost stream stuff, the locking problem became much more of a problem, previously the FindKeyframe() had a much rarer race condition which would only trip when the decoding thread would cause new index entries to be inserted into the index. * Use the same ByteIOContext buffer size that avformat would be using if it initialized the ByteIOContext through other API. * Don't leak the probe buffer in case of error. * Don't leak the ByteIOContext buffer in the end. * Do not discard other stream packets anymore, this makes the ASF demuxer happy and ASF files can now be seeked as well as with ffplay itself. With these changes, all my MPEG test streams work. Some could be seeked before, but would show bad artifacts. Some streams would completely loose video after seeking once. My MPEG2 test stream works much better now, although audio is slightly out of sync, unfortunately. All my test AVIs work as good as before, MP4 and MKV still work perfectly. The single test ASF I got is now perfectly seekable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38807 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
954d70d8c0
commit
af0f809b75
File diff suppressed because it is too large
Load Diff
@ -46,10 +46,10 @@ public:
|
||||
media_header* mediaHeader);
|
||||
|
||||
private:
|
||||
class StreamCookie;
|
||||
class Stream;
|
||||
|
||||
StreamCookie** fStreams;
|
||||
BLocker fStreamLock;
|
||||
Stream** fStreams;
|
||||
BLocker fSourceLock;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user