theoradec: Keep timestamp from incoming buffer if it is valid

Fixes bug #601627.
This commit is contained in:
Olivier Crête 2009-11-11 19:32:01 -05:00 committed by Sebastian Dröge
parent 1da5a3f7d3
commit 05aa195981

View file

@ -1333,15 +1333,15 @@ theora_dec_decode_buffer (GstTheoraDec * dec, GstBuffer * buf)
GST_LOG_OBJECT (dec, "decode buffer of size %ld", packet.bytes); GST_LOG_OBJECT (dec, "decode buffer of size %ld", packet.bytes);
if (dec->have_header) { if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
dec->last_timestamp = GST_BUFFER_TIMESTAMP (buf);
} else if (dec->have_header) {
if (packet.granulepos != -1) { if (packet.granulepos != -1) {
dec->granulepos = packet.granulepos; dec->granulepos = packet.granulepos;
dec->last_timestamp = _theora_granule_start_time (dec, packet.granulepos); dec->last_timestamp = _theora_granule_start_time (dec, packet.granulepos);
} else if (dec->last_timestamp != -1) { } else if (dec->last_timestamp != -1) {
dec->last_timestamp = _theora_granule_start_time (dec, dec->granulepos); dec->last_timestamp = _theora_granule_start_time (dec, dec->granulepos);
} }
if (dec->last_timestamp == -1 && GST_BUFFER_TIMESTAMP_IS_VALID (buf))
dec->last_timestamp = GST_BUFFER_TIMESTAMP (buf);
} else { } else {
dec->last_timestamp = -1; dec->last_timestamp = -1;
} }