mirror of
https://github.com/mpv-player/mpv
synced 2025-01-03 05:22:23 +00:00
sort timestamps instead of assuming conventional B-frame order. (fixes x264 B-pyramid)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16913 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d291ddf016
commit
316bb1d44c
@ -2779,21 +2779,29 @@ handle_realaudio (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer,
|
|||||||
* or P frame arrives these timecodes can be changed to I at 0ms, P at 40ms,
|
* or P frame arrives these timecodes can be changed to I at 0ms, P at 40ms,
|
||||||
* B at 80ms and B at 120ms.
|
* B at 80ms and B at 120ms.
|
||||||
*
|
*
|
||||||
|
* This works for simple H.264 B-frame pyramids, but not for arbitrary orders.
|
||||||
|
*
|
||||||
* \param demuxer The Matroska demuxer struct for this instance.
|
* \param demuxer The Matroska demuxer struct for this instance.
|
||||||
* \param track The track structure whose cache should be handled.
|
* \param track The track structure whose cache should be handled.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
flush_cached_dps (demuxer_t *demuxer, mkv_track_t *track)
|
flush_cached_dps (demuxer_t *demuxer, mkv_track_t *track)
|
||||||
{
|
{
|
||||||
float tmp_pts;
|
int i, ok;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (track->num_cached_dps == 0)
|
if (track->num_cached_dps == 0)
|
||||||
return;
|
return;
|
||||||
tmp_pts = track->cached_dps[0]->pts;
|
|
||||||
for (i = 1; i < track->num_cached_dps; i++)
|
do {
|
||||||
track->cached_dps[i - 1]->pts = track->cached_dps[i]->pts;
|
ok = 1;
|
||||||
track->cached_dps[track->num_cached_dps - 1]->pts = tmp_pts;
|
for (i = 1; i < track->num_cached_dps; i++)
|
||||||
|
if (track->cached_dps[i - 1]->pts > track->cached_dps[i]->pts) {
|
||||||
|
float tmp_pts = track->cached_dps[i - 1]->pts;
|
||||||
|
track->cached_dps[i - 1]->pts = track->cached_dps[i]->pts;
|
||||||
|
track->cached_dps[i]->pts = tmp_pts;
|
||||||
|
ok = 0;
|
||||||
|
}
|
||||||
|
} while (!ok);
|
||||||
|
|
||||||
for (i = 0; i < track->num_cached_dps; i++)
|
for (i = 0; i < track->num_cached_dps; i++)
|
||||||
ds_add_packet (demuxer->video, track->cached_dps[i]);
|
ds_add_packet (demuxer->video, track->cached_dps[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user