jpegdec: Remember if we saw SOI and handle stray data on EOS
This commit is contained in:
parent
7703a11073
commit
c6c4906770
@ -443,6 +443,10 @@ gst_jpeg_dec_parse (GstVideoDecoder * bdec, GstVideoCodecFrame * frame,
|
|||||||
if (at_eos) {
|
if (at_eos) {
|
||||||
GST_DEBUG ("Flushing all data out");
|
GST_DEBUG ("Flushing all data out");
|
||||||
toadd = size;
|
toadd = size;
|
||||||
|
|
||||||
|
/* If we have leftover data, throw it away */
|
||||||
|
if (!dec->saw_header)
|
||||||
|
goto drop_frame;
|
||||||
goto have_full_frame;
|
goto have_full_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,6 +464,7 @@ gst_jpeg_dec_parse (GstVideoDecoder * bdec, GstVideoCodecFrame * frame,
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
gst_adapter_flush (adapter, ret);
|
gst_adapter_flush (adapter, ret);
|
||||||
size -= ret;
|
size -= ret;
|
||||||
|
dec->saw_header = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -497,6 +502,7 @@ gst_jpeg_dec_parse (GstVideoDecoder * bdec, GstVideoCodecFrame * frame,
|
|||||||
if (value == 0xd9) {
|
if (value == 0xd9) {
|
||||||
GST_DEBUG ("0x%08x: EOI marker", offset + 2);
|
GST_DEBUG ("0x%08x: EOI marker", offset + 2);
|
||||||
/* clear parse state */
|
/* clear parse state */
|
||||||
|
dec->saw_header = FALSE;
|
||||||
dec->parse_resync = FALSE;
|
dec->parse_resync = FALSE;
|
||||||
dec->parse_offset = 0;
|
dec->parse_offset = 0;
|
||||||
toadd = offset + 4;
|
toadd = offset + 4;
|
||||||
@ -589,6 +595,9 @@ have_full_frame:
|
|||||||
if (toadd)
|
if (toadd)
|
||||||
gst_video_decoder_add_to_frame (bdec, toadd);
|
gst_video_decoder_add_to_frame (bdec, toadd);
|
||||||
return gst_video_decoder_have_frame (bdec);
|
return gst_video_decoder_have_frame (bdec);
|
||||||
|
|
||||||
|
drop_frame:
|
||||||
|
return GST_VIDEO_DECODER_FLOW_DROPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1407,6 +1416,7 @@ gst_jpeg_dec_reset (GstVideoDecoder * bdec, gboolean hard)
|
|||||||
dec->parse_offset = 0;
|
dec->parse_offset = 0;
|
||||||
dec->parse_entropy_len = 0;
|
dec->parse_entropy_len = 0;
|
||||||
dec->parse_resync = FALSE;
|
dec->parse_resync = FALSE;
|
||||||
|
dec->saw_header = FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user