ext/ogg/gstoggparse.c: Fix very inefficient usage of linked lists (#335365).
Original commit message from CVS: * ext/ogg/gstoggparse.c: (gst_ogg_parse_find_stream), (gst_ogg_parse_chain): Fix very inefficient usage of linked lists (#335365).
This commit is contained in:
parent
8f194ed848
commit
81d110160b
@ -1,3 +1,9 @@
|
|||||||
|
2006-03-21 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* ext/ogg/gstoggparse.c: (gst_ogg_parse_find_stream),
|
||||||
|
(gst_ogg_parse_chain):
|
||||||
|
Fix very inefficient usage of linked lists (#335365).
|
||||||
|
|
||||||
2006-03-21 Edward Hervey <edward@fluendo.com>
|
2006-03-21 Edward Hervey <edward@fluendo.com>
|
||||||
|
|
||||||
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
|
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
|
||||||
|
@ -164,10 +164,10 @@ gst_ogg_parse_new_stream (GstOggParse * parser, guint32 serialno)
|
|||||||
static GstOggStream *
|
static GstOggStream *
|
||||||
gst_ogg_parse_find_stream (GstOggParse * parser, guint32 serialno)
|
gst_ogg_parse_find_stream (GstOggParse * parser, guint32 serialno)
|
||||||
{
|
{
|
||||||
gint i;
|
GSList *l;
|
||||||
|
|
||||||
for (i = 0; i < g_slist_length (parser->oggstreams); i++) {
|
for (l = parser->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (parser->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
|
|
||||||
if (stream->serialno == serialno)
|
if (stream->serialno == serialno)
|
||||||
return stream;
|
return stream;
|
||||||
@ -504,13 +504,14 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GValue array = { 0 };
|
GValue array = { 0 };
|
||||||
gint i, count = 0;
|
gint count = 0;
|
||||||
gboolean found_pending_headers = FALSE;
|
gboolean found_pending_headers = FALSE;
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
g_value_init (&array, GST_TYPE_ARRAY);
|
g_value_init (&array, GST_TYPE_ARRAY);
|
||||||
|
|
||||||
for (i = 0; i < g_slist_length (ogg->oggstreams); i++) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (ogg->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
|
|
||||||
if (g_slist_length (stream->headers) == 0) {
|
if (g_slist_length (stream->headers) == 0) {
|
||||||
GST_LOG_OBJECT (ogg, "No primary header found for stream %u",
|
GST_LOG_OBJECT (ogg, "No primary header found for stream %u",
|
||||||
@ -523,8 +524,8 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < g_slist_length (ogg->oggstreams); i++) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (ogg->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
||||||
@ -550,16 +551,16 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
"(one per page)", count);
|
"(one per page)", count);
|
||||||
|
|
||||||
/* Now, we do the same thing, but push buffers... */
|
/* Now, we do the same thing, but push buffers... */
|
||||||
for (i = 0; i < g_slist_length (ogg->oggstreams); i++) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (ogg->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
|
|
||||||
result = gst_pad_push (ogg->srcpad,
|
result = gst_pad_push (ogg->srcpad,
|
||||||
GST_BUFFER (stream->headers->data));
|
GST_BUFFER (stream->headers->data));
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
for (i = 0; i < g_slist_length (ogg->oggstreams); i++) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (ogg->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
for (j = 1; j < g_slist_length (stream->headers); j++) {
|
||||||
@ -573,24 +574,27 @@ gst_ogg_parse_chain (GstPad * pad, GstBuffer * buffer)
|
|||||||
ogg->in_headers = 0;
|
ogg->in_headers = 0;
|
||||||
|
|
||||||
/* And finally the pending data pages */
|
/* And finally the pending data pages */
|
||||||
for (i = 0; i < g_slist_length (ogg->oggstreams); i++) {
|
for (l = ogg->oggstreams; l != NULL; l = l->next) {
|
||||||
GstOggStream *stream = g_slist_nth_data (ogg->oggstreams, i);
|
GstOggStream *stream = (GstOggStream *) l->data;
|
||||||
int j;
|
GSList *k;
|
||||||
|
|
||||||
if (g_slist_length (stream->unknown_pages) > 0) {
|
if (stream->unknown_pages == NULL)
|
||||||
if (found_pending_headers) {
|
|
||||||
GST_WARNING_OBJECT (ogg, "Incorrectly muxed headers found at "
|
|
||||||
"approximate offset %lld", ogg->offset);
|
|
||||||
}
|
|
||||||
found_pending_headers = TRUE;
|
|
||||||
} else
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (found_pending_headers) {
|
||||||
|
GST_WARNING_OBJECT (ogg, "Incorrectly muxed headers found at "
|
||||||
|
"approximate offset %lld", ogg->offset);
|
||||||
|
}
|
||||||
|
found_pending_headers = TRUE;
|
||||||
|
|
||||||
GST_LOG_OBJECT (ogg, "Pushing %d pending pages after headers",
|
GST_LOG_OBJECT (ogg, "Pushing %d pending pages after headers",
|
||||||
g_slist_length (stream->unknown_pages) + 1);
|
g_slist_length (stream->unknown_pages) + 1);
|
||||||
for (j = 0; j < g_slist_length (stream->unknown_pages); j++) {
|
|
||||||
result = gst_pad_push (ogg->srcpad,
|
for (k = stream->unknown_pages; k != NULL; k = k->next) {
|
||||||
GST_BUFFER (g_slist_nth_data (stream->unknown_pages, j)));
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
buf = GST_BUFFER (k->data);
|
||||||
|
result = gst_pad_push (ogg->srcpad, buf);
|
||||||
if (result != GST_FLOW_OK)
|
if (result != GST_FLOW_OK)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user