mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-26 07:56:38 +00:00
gst/avi/gstavidemux.c: Fix combined flow return. Fixes #412608.
Original commit message from CVS: * gst/avi/gstavidemux.c: (gst_avi_demux_combine_flows), (gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data), (gst_avi_demux_loop), (gst_avi_demux_chain): Fix combined flow return. Fixes #412608.
This commit is contained in:
parent
dcdaf922c4
commit
83676ebd17
2 changed files with 49 additions and 53 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-02-28 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/avi/gstavidemux.c: (gst_avi_demux_combine_flows),
|
||||||
|
(gst_avi_demux_process_next_entry), (gst_avi_demux_stream_data),
|
||||||
|
(gst_avi_demux_loop), (gst_avi_demux_chain):
|
||||||
|
Fix combined flow return. Fixes #412608.
|
||||||
|
|
||||||
2007-02-28 Wim Taymans <wim@fluendo.com>
|
2007-02-28 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* gst/videofilter/Makefile.am:
|
* gst/videofilter/Makefile.am:
|
||||||
|
|
|
@ -3231,29 +3231,33 @@ gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf)
|
||||||
* Returns the aggregated GstFlowReturn.
|
* Returns the aggregated GstFlowReturn.
|
||||||
*/
|
*/
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_avi_demux_aggregated_flow (GstAviDemux * avi)
|
gst_avi_demux_combine_flows (GstAviDemux * avi, avi_stream_context * stream,
|
||||||
|
GstFlowReturn ret)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
|
||||||
|
|
||||||
|
/* store the value */
|
||||||
|
stream->last_flow = ret;
|
||||||
|
|
||||||
|
/* any other error that is not-linked can be returned right
|
||||||
|
* away */
|
||||||
|
if (ret != GST_FLOW_NOT_LINKED)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
/* only return NOT_LINKED if all other pads returned NOT_LINKED */
|
||||||
for (i = 0; i < avi->num_streams; i++) {
|
for (i = 0; i < avi->num_streams; i++) {
|
||||||
res = avi->stream[i].last_flow;
|
avi_stream_context *ostream = &avi->stream[i];
|
||||||
|
|
||||||
GST_LOG_OBJECT (avi, "stream %d , flow : %s", i, gst_flow_get_name (res));
|
ret = ostream->last_flow;
|
||||||
|
/* some other return value (must be SUCCESS but we can return
|
||||||
/* at least one flow is success, return that value */
|
* other values as well) */
|
||||||
if (GST_FLOW_IS_SUCCESS (res))
|
if (ret != GST_FLOW_NOT_LINKED)
|
||||||
break;
|
goto done;
|
||||||
|
|
||||||
/* any other error that is not-linked can be returned right away */
|
|
||||||
if (res != GST_FLOW_NOT_LINKED)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
/* if we get here, all other pads were unlinked and we return
|
||||||
GST_DEBUG_OBJECT (avi, "Returning aggregated value of %s",
|
* NOT_LINKED then */
|
||||||
gst_flow_get_name (res));
|
done:
|
||||||
|
return ret;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3343,7 +3347,11 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
|
||||||
stream->discont = FALSE;
|
stream->discont = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = stream->last_flow = gst_pad_push (stream->pad, buf);
|
res = gst_pad_push (stream->pad, buf);
|
||||||
|
|
||||||
|
/* combine flows */
|
||||||
|
res = gst_avi_demux_combine_flows (avi, stream, res);
|
||||||
|
|
||||||
/* mark as processed, we increment the frame and byte counters then
|
/* mark as processed, we increment the frame and byte counters then
|
||||||
* leave the while loop and return the GstFlowReturn */
|
* leave the while loop and return the GstFlowReturn */
|
||||||
processed = TRUE;
|
processed = TRUE;
|
||||||
|
@ -3357,6 +3365,7 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
GST_DEBUG_OBJECT (avi, "returning %s", gst_flow_get_name (res));
|
GST_DEBUG_OBJECT (avi, "returning %s", gst_flow_get_name (res));
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -3365,7 +3374,7 @@ eos:
|
||||||
GST_LOG_OBJECT (avi, "Handled last index entry, setting EOS (%d > %d)",
|
GST_LOG_OBJECT (avi, "Handled last index entry, setting EOS (%d > %d)",
|
||||||
avi->current_entry, avi->index_size);
|
avi->current_entry, avi->index_size);
|
||||||
/* we mark the first stream as EOS */
|
/* we mark the first stream as EOS */
|
||||||
res = avi->stream[0].last_flow = GST_FLOW_UNEXPECTED;
|
res = GST_FLOW_UNEXPECTED;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
eos_stop:
|
eos_stop:
|
||||||
|
@ -3373,7 +3382,7 @@ eos_stop:
|
||||||
GST_LOG_OBJECT (avi, "Found keyframe after segment,"
|
GST_LOG_OBJECT (avi, "Found keyframe after segment,"
|
||||||
" setting EOS (%" GST_TIME_FORMAT " > %" GST_TIME_FORMAT ")",
|
" setting EOS (%" GST_TIME_FORMAT " > %" GST_TIME_FORMAT ")",
|
||||||
GST_TIME_ARGS (entry->ts), GST_TIME_ARGS (avi->segment.stop));
|
GST_TIME_ARGS (entry->ts), GST_TIME_ARGS (avi->segment.stop));
|
||||||
res = stream->last_flow = GST_FLOW_UNEXPECTED;
|
res = GST_FLOW_UNEXPECTED;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
pull_failed:
|
pull_failed:
|
||||||
|
@ -3381,7 +3390,6 @@ pull_failed:
|
||||||
GST_DEBUG_OBJECT (avi,
|
GST_DEBUG_OBJECT (avi,
|
||||||
"pull range failed: pos=%" G_GUINT64_FORMAT " size=%d",
|
"pull range failed: pos=%" G_GUINT64_FORMAT " size=%d",
|
||||||
entry->offset + avi->index_offset, entry->size);
|
entry->offset + avi->index_offset, entry->size);
|
||||||
stream->last_flow = res;
|
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
short_buffer:
|
short_buffer:
|
||||||
|
@ -3390,7 +3398,7 @@ short_buffer:
|
||||||
", only got %d/%d bytes (truncated file?)", entry->offset +
|
", only got %d/%d bytes (truncated file?)", entry->offset +
|
||||||
avi->index_offset, GST_BUFFER_SIZE (buf), entry->size);
|
avi->index_offset, GST_BUFFER_SIZE (buf), entry->size);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
res = stream->last_flow = GST_FLOW_UNEXPECTED;
|
res = GST_FLOW_UNEXPECTED;
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3532,7 +3540,10 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
||||||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
||||||
stream->discont = FALSE;
|
stream->discont = FALSE;
|
||||||
}
|
}
|
||||||
res = stream->last_flow = gst_pad_push (stream->pad, buf);
|
res = gst_pad_push (stream->pad, buf);
|
||||||
|
|
||||||
|
/* combine flows */
|
||||||
|
res = gst_avi_demux_combine_flows (avi, stream, res);
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
GST_DEBUG ("Push failed; %s", gst_flow_get_name (res));
|
GST_DEBUG ("Push failed; %s", gst_flow_get_name (res));
|
||||||
return res;
|
return res;
|
||||||
|
@ -3584,7 +3595,7 @@ push_tag_lists (GstAviDemux * avi)
|
||||||
static void
|
static void
|
||||||
gst_avi_demux_loop (GstPad * pad)
|
gst_avi_demux_loop (GstPad * pad)
|
||||||
{
|
{
|
||||||
GstFlowReturn res = GST_FLOW_OK, agg_res = GST_FLOW_OK;
|
GstFlowReturn res;
|
||||||
GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad));
|
GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
switch (avi->state) {
|
switch (avi->state) {
|
||||||
|
@ -3613,32 +3624,10 @@ gst_avi_demux_loop (GstPad * pad)
|
||||||
/* process each index entry in turn */
|
/* process each index entry in turn */
|
||||||
res = gst_avi_demux_stream_data (avi);
|
res = gst_avi_demux_stream_data (avi);
|
||||||
|
|
||||||
#if 0
|
/* pause when error */
|
||||||
/* if a pad is in e.g. WRONG_STATE, we want to pause to unlock the STREAM_LOCK */
|
|
||||||
if ((res == GST_FLOW_WRONG_STATE) || ((res != GST_FLOW_OK)
|
|
||||||
&& ((agg_res =
|
|
||||||
gst_avi_demux_aggregated_flow (avi)) != GST_FLOW_OK))) {
|
|
||||||
GST_WARNING ("stream_movi flow: %s / %s", gst_flow_get_name (res),
|
|
||||||
gst_flow_get_name (agg_res));
|
|
||||||
res = agg_res;
|
|
||||||
goto pause;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* if a pad is in WRONG_STATE like after a flushing seek, we want to pause to
|
|
||||||
* unlock the STREAM_LOCK
|
|
||||||
*/
|
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
GST_INFO ("stream_movi flow: %s", gst_flow_get_name (res));
|
GST_INFO ("stream_movi flow: %s", gst_flow_get_name (res));
|
||||||
/* if we do that then we can't play streams, that are partialy linked */
|
|
||||||
if (res == GST_FLOW_WRONG_STATE)
|
|
||||||
goto pause;
|
goto pause;
|
||||||
if ((agg_res = gst_avi_demux_aggregated_flow (avi)) != GST_FLOW_OK) {
|
|
||||||
GST_INFO ("stream_movi aggregated flow: %s",
|
|
||||||
gst_flow_get_name (agg_res));
|
|
||||||
res = agg_res;
|
|
||||||
goto pause;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -3695,7 +3684,7 @@ pause:
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_avi_demux_chain (GstPad * pad, GstBuffer * buf)
|
gst_avi_demux_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res;
|
||||||
GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad));
|
GstAviDemux *avi = GST_AVI_DEMUX (GST_PAD_PARENT (pad));
|
||||||
|
|
||||||
GST_DEBUG ("Store %d bytes in adapter", GST_BUFFER_SIZE (buf));
|
GST_DEBUG ("Store %d bytes in adapter", GST_BUFFER_SIZE (buf));
|
||||||
|
@ -3725,15 +3714,15 @@ gst_avi_demux_chain (GstPad * pad, GstBuffer * buf)
|
||||||
res = gst_avi_demux_stream_data (avi);
|
res = gst_avi_demux_stream_data (avi);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
GST_ELEMENT_ERROR (avi, STREAM, FAILED, (NULL),
|
||||||
|
("Illegal internal state"));
|
||||||
|
res = GST_FLOW_ERROR;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (avi, "state: %d res:%s", avi->state,
|
GST_DEBUG_OBJECT (avi, "state: %d res:%s", avi->state,
|
||||||
gst_flow_get_name (res));
|
gst_flow_get_name (res));
|
||||||
|
|
||||||
/* Get Aggregated flow return as the final flow result. */
|
|
||||||
res = gst_avi_demux_aggregated_flow (avi);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue