mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
vorbisparse: be smarter when queueing headers
Look at the first buffer byte to see if a buffer is a header instead of counting packets.
This commit is contained in:
parent
9def0d8c61
commit
e863e4ed1b
1 changed files with 22 additions and 8 deletions
|
@ -247,8 +247,6 @@ vorbis_parse_push_headers (GstVorbisParse * parse)
|
|||
|
||||
g_list_free (parse->streamheader);
|
||||
parse->streamheader = NULL;
|
||||
|
||||
parse->streamheader_sent = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -393,18 +391,34 @@ static GstFlowReturn
|
|||
vorbis_parse_parse_packet (GstVorbisParse * parse, GstBuffer * buf)
|
||||
{
|
||||
GstFlowReturn ret;
|
||||
guint8 *data;
|
||||
guint size;
|
||||
gboolean have_header;
|
||||
|
||||
data = GST_BUFFER_DATA (buf);
|
||||
size = GST_BUFFER_SIZE (buf);
|
||||
|
||||
parse->packetno++;
|
||||
|
||||
if (parse->packetno <= 3) {
|
||||
/* if 1 <= packetno <= 3, it's streamheader,
|
||||
* so put it on the streamheader list and return */
|
||||
parse->streamheader = g_list_append (parse->streamheader, buf);
|
||||
have_header = FALSE;
|
||||
if (size >= 1) {
|
||||
if (data[0] >= 0x01 && data[0] <= 0x05)
|
||||
have_header = TRUE;
|
||||
}
|
||||
|
||||
if (have_header) {
|
||||
if (!parse->streamheader_sent) {
|
||||
/* we need to collect the headers still */
|
||||
/* so put it on the streamheader list and return */
|
||||
parse->streamheader = g_list_append (parse->streamheader, buf);
|
||||
}
|
||||
ret = GST_FLOW_OK;
|
||||
} else {
|
||||
if (!parse->streamheader_sent)
|
||||
/* data packet, push the headers we collected before */
|
||||
if (!parse->streamheader_sent) {
|
||||
vorbis_parse_push_headers (parse);
|
||||
|
||||
parse->streamheader_sent = TRUE;
|
||||
}
|
||||
ret = vorbis_parse_queue_buffer (parse, buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue