From ea012d3dd7c323ee7efdffbb5d159328c6b3d6cc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 10 Oct 2011 11:33:51 +0200 Subject: [PATCH] pad: GST_FLOW_UNEXPECTED -> GST_FLOW_EOS --- docs/random/porting-to-0.11.txt | 2 ++ gst/gstbufferpool.c | 2 +- gst/gstpad.c | 6 +++--- gst/gstpad.h | 4 ++-- libs/gst/base/gstbaseparse.c | 20 +++++++++---------- libs/gst/base/gstbasesink.c | 20 +++++++++---------- libs/gst/base/gstbasesrc.c | 12 ++++++------ libs/gst/base/gstcollectpads.c | 2 +- plugins/elements/gstfakesink.c | 4 ++-- plugins/elements/gstfdsrc.c | 2 +- plugins/elements/gstfilesrc.c | 2 +- plugins/elements/gstidentity.c | 2 +- plugins/elements/gstmultiqueue.c | 18 ++++++++--------- plugins/elements/gstqueue.c | 32 ++++++++++++++---------------- plugins/elements/gstqueue2.c | 42 +++++++++++++++++++--------------------- plugins/elements/gsttee.c | 2 +- tests/check/elements/fakesink.c | 18 ++++++++--------- tests/check/elements/filesrc.c | 8 ++++---- tests/check/gst/gstpad.c | 6 +++--- 19 files changed, 100 insertions(+), 104 deletions(-) diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index 6cdddae..bfab504 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -122,6 +122,8 @@ The 0.11 porting guide gst_pad_get_negotiated_caps() -> get_pad_get_current_caps() + GST_FLOW_UNEXPECTED -> GST_FLOW_EOS + * GstPadTemplate gst_pad_template_get_caps() returns a new reference of the caps and the return value needs to be unreffed after usage. diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index 0412837..9185d58 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -811,7 +811,7 @@ default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer, /* check if we need to wait */ if (params && (params->flags & GST_BUFFER_POOL_FLAG_DONTWAIT)) { GST_LOG_OBJECT (pool, "no more buffers"); - result = GST_FLOW_UNEXPECTED; + result = GST_FLOW_EOS; break; } diff --git a/gst/gstpad.c b/gst/gstpad.c index 7bb8fc3..5b577e1 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -169,7 +169,7 @@ static GstFlowQuarks flow_quarks[] = { {GST_FLOW_OK, "ok", 0}, {GST_FLOW_NOT_LINKED, "not-linked", 0}, {GST_FLOW_WRONG_STATE, "wrong-state", 0}, - {GST_FLOW_UNEXPECTED, "unexpected", 0}, + {GST_FLOW_EOS, "eos", 0}, {GST_FLOW_NOT_NEGOTIATED, "not-negotiated", 0}, {GST_FLOW_ERROR, "error", 0}, {GST_FLOW_NOT_SUPPORTED, "not-supported", 0}, @@ -3984,7 +3984,7 @@ get_range_failed: GST_PAD_STREAM_UNLOCK (pad); *buffer = NULL; GST_CAT_LEVEL_LOG (GST_CAT_SCHEDULING, - (ret >= GST_FLOW_UNEXPECTED) ? GST_LEVEL_INFO : GST_LEVEL_WARNING, + (ret >= GST_FLOW_EOS) ? GST_LEVEL_INFO : GST_LEVEL_WARNING, pad, "getrange failed, flow: %s", gst_flow_get_name (ret)); return ret; } @@ -4133,7 +4133,7 @@ pull_range_failed: *buffer = NULL; GST_OBJECT_UNLOCK (pad); GST_CAT_LEVEL_LOG (GST_CAT_SCHEDULING, - (ret >= GST_FLOW_UNEXPECTED) ? GST_LEVEL_INFO : GST_LEVEL_WARNING, + (ret >= GST_FLOW_EOS) ? GST_LEVEL_INFO : GST_LEVEL_WARNING, pad, "pullrange failed, flow: %s", gst_flow_get_name (ret)); return ret; } diff --git a/gst/gstpad.h b/gst/gstpad.h index d9ed2c5..c2db0a1 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -114,7 +114,7 @@ typedef enum { * @GST_FLOW_OK: Data passing was ok. * @GST_FLOW_NOT_LINKED: Pad is not linked. * @GST_FLOW_WRONG_STATE: Pad is in wrong state. - * @GST_FLOW_UNEXPECTED: Did not expect anything, like after EOS. + * @GST_FLOW_EOS: Pad is EOS. * @GST_FLOW_NOT_NEGOTIATED: Pad is not negotiated. * @GST_FLOW_ERROR: Some (fatal) error occured. Element generating * this error should post an error message with more @@ -154,7 +154,7 @@ typedef enum { GST_FLOW_NOT_LINKED = -1, GST_FLOW_WRONG_STATE = -2, /* error cases */ - GST_FLOW_UNEXPECTED = -3, + GST_FLOW_EOS = -3, GST_FLOW_NOT_NEGOTIATED = -4, GST_FLOW_ERROR = -5, GST_FLOW_NOT_SUPPORTED = -6, diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index 1bbd135..df247ec 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -1924,7 +1924,7 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) GST_BUFFER_TIMESTAMP (buffer) > parse->segment.stop + parse->priv->lead_out_ts) { GST_LOG_OBJECT (parse, "Dropped frame, after segment"); - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; } else if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) && GST_BUFFER_DURATION_IS_VALID (buffer) && GST_CLOCK_TIME_IS_VALID (parse->segment.start) && @@ -1964,7 +1964,7 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) size, gst_flow_get_name (ret)); gst_buffer_unref (buffer); /* if we are not sufficiently in control, let upstream decide on EOS */ - if (ret == GST_FLOW_UNEXPECTED && + if (ret == GST_FLOW_EOS && (parse->priv->passthrough || (parse->priv->pad_mode == GST_ACTIVATE_PUSH && !parse->priv->upstream_seekable))) @@ -2492,7 +2492,7 @@ gst_base_parse_handle_previous_fragment (GstBaseParse * parse) if (!parse->priv->last_offset || parse->priv->last_ts <= parse->segment.start) { GST_DEBUG_OBJECT (parse, "past start of segment %" GST_TIME_FORMAT, GST_TIME_ARGS (parse->segment.start)); - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; goto exit; } @@ -2642,7 +2642,7 @@ gst_base_parse_scan_frame (GstBaseParse * parse, GstBaseParseClass * klass, goto done; if (gst_buffer_get_size (outbuf) < fsize) { gst_buffer_unref (outbuf); - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; } } @@ -2696,7 +2696,7 @@ gst_base_parse_loop (GstPad * pad) ret = gst_base_parse_handle_and_push_frame (parse, klass, &frame); /* eat expected eos signalling past segment in reverse playback */ - if (parse->segment.rate < 0.0 && ret == GST_FLOW_UNEXPECTED && + if (parse->segment.rate < 0.0 && ret == GST_FLOW_EOS && parse->segment.position >= parse->segment.stop) { GST_DEBUG_OBJECT (parse, "downstream has reached end of segment"); /* push what was accumulated during loop run */ @@ -2707,7 +2707,7 @@ gst_base_parse_loop (GstPad * pad) } done: - if (ret == GST_FLOW_UNEXPECTED) + if (ret == GST_FLOW_EOS) goto eos; else if (ret != GST_FLOW_OK) goto pause; @@ -2718,7 +2718,7 @@ done: /* ERRORS */ eos: { - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; GST_DEBUG_OBJECT (parse, "eos"); /* fall-through */ } @@ -2730,7 +2730,7 @@ pause: gst_flow_get_name (ret)); gst_pad_pause_task (parse->sinkpad); - if (ret == GST_FLOW_UNEXPECTED) { + if (ret == GST_FLOW_EOS) { /* handle end-of-stream/segment */ if (parse->segment.flags & GST_SEEK_FLAG_SEGMENT) { gint64 stop; @@ -2752,7 +2752,7 @@ pause: } push_eos = TRUE; } - } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED) { + } else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) { /* for fatal errors we post an error message, wrong-state is * not fatal because it happens due to flushes and only means * that we should stop now. */ @@ -3470,7 +3470,7 @@ gst_base_parse_locate_time (GstBaseParse * parse, GstClockTime * _time, GST_TIME_ARGS (time), newpos); ret = gst_base_parse_find_frame (parse, &newpos, &newtime, &dur); - if (ret == GST_FLOW_UNEXPECTED) { + if (ret == GST_FLOW_EOS) { /* heuristic HACK */ hpos = MAX (lpos, hpos - chunk); continue; diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index bcaa20a..1e5445a 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -2057,8 +2057,8 @@ gst_base_sink_wait_clock (GstBaseSink * sink, GstClockTime time, /* FIXME: Casting to GstClockEntry only works because the types * are the same */ if (G_LIKELY (sink->priv->cached_clock_id != NULL - && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink->priv-> - cached_clock_id) == clock)) { + && GST_CLOCK_ENTRY_CLOCK ((GstClockEntry *) sink-> + priv->cached_clock_id) == clock)) { if (!gst_clock_single_shot_id_reinit (clock, sink->priv->cached_clock_id, time)) { gst_clock_id_unref (sink->priv->cached_clock_id); @@ -3238,11 +3238,10 @@ flushing: } was_eos: { - GST_DEBUG_OBJECT (basesink, - "we are EOS, dropping object, return UNEXPECTED"); + GST_DEBUG_OBJECT (basesink, "we are EOS, dropping object, return EOS"); GST_BASE_SINK_PREROLL_UNLOCK (basesink); gst_mini_object_unref (obj); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -3587,10 +3586,9 @@ flushing: } was_eos: { - GST_DEBUG_OBJECT (basesink, - "we are EOS, dropping object, return UNEXPECTED"); + GST_DEBUG_OBJECT (basesink, "we are EOS, dropping object, return EOS"); gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj)); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } out_of_segment: { @@ -3629,7 +3627,7 @@ wrong_mode: gst_mini_object_unref (GST_MINI_OBJECT_CAST (obj)); /* we don't post an error message this will signal to the peer * pushing that EOS is reached. */ - result = GST_FLOW_UNEXPECTED; + result = GST_FLOW_EOS; goto done; } } @@ -4024,7 +4022,7 @@ paused: GST_LOG_OBJECT (basesink, "pausing task, reason %s", gst_flow_get_name (result)); gst_pad_pause_task (pad); - if (result == GST_FLOW_UNEXPECTED) { + if (result == GST_FLOW_EOS) { /* perform EOS logic */ if (basesink->segment.flags & GST_SEEK_FLAG_SEGMENT) { gst_element_post_message (GST_ELEMENT_CAST (basesink), @@ -4033,7 +4031,7 @@ paused: } else { gst_base_sink_event (pad, gst_event_new_eos ()); } - } else if (result == GST_FLOW_NOT_LINKED || result <= GST_FLOW_UNEXPECTED) { + } else if (result == GST_FLOW_NOT_LINKED || result <= GST_FLOW_EOS) { /* for fatal errors we post an error message, post the error * first so the app knows about the error first. * wrong-state is not a fatal error because it happens due to diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 84fe263..f6a64e2 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2327,12 +2327,12 @@ unexpected_length: { GST_DEBUG_OBJECT (src, "unexpected length %u (offset=%" G_GUINT64_FORMAT ", size=%" G_GINT64_FORMAT ")", length, offset, src->segment.duration); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } reached_num_buffers: { GST_DEBUG_OBJECT (src, "sent all buffers"); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } flushing: { @@ -2344,7 +2344,7 @@ flushing: eos: { GST_DEBUG_OBJECT (src, "we are EOS"); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -2558,7 +2558,7 @@ gst_base_src_loop (GstPad * pad) if (G_UNLIKELY (eos)) { GST_INFO_OBJECT (src, "pausing after end of segment"); - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; goto pause; } @@ -2581,7 +2581,7 @@ pause: GST_DEBUG_OBJECT (src, "pausing task, reason %s", reason); src->running = FALSE; gst_pad_pause_task (pad); - if (ret == GST_FLOW_UNEXPECTED) { + if (ret == GST_FLOW_EOS) { gboolean flag_segment; GstFormat format; gint64 position; @@ -2603,7 +2603,7 @@ pause: gst_event_set_seqnum (event, src->priv->seqnum); gst_pad_push_event (pad, event); } - } else if (ret == GST_FLOW_NOT_LINKED || ret <= GST_FLOW_UNEXPECTED) { + } else if (ret == GST_FLOW_NOT_LINKED || ret <= GST_FLOW_EOS) { event = gst_event_new_eos (); gst_event_set_seqnum (event, src->priv->seqnum); /* for fatal errors we post an error message, post the error diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c index fccb52c..d8fb3c7 100644 --- a/libs/gst/base/gstcollectpads.c +++ b/libs/gst/base/gstcollectpads.c @@ -1395,7 +1395,7 @@ unexpected: /* we should not post an error for this, just inform upstream that * we don't expect anything anymore */ GST_DEBUG ("pad %s:%s is eos", GST_DEBUG_PAD_NAME (pad)); - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; goto unlock_done; } clipped: diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index f4e6a5c..5efa812 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -460,7 +460,7 @@ gst_fake_sink_preroll (GstBaseSink * bsink, GstBuffer * buffer) eos: { GST_DEBUG_OBJECT (sink, "we are EOS"); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -548,7 +548,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) eos: { GST_DEBUG_OBJECT (sink, "we are EOS"); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index 8e12d52..5fd1b72 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -496,7 +496,7 @@ eos: { GST_DEBUG_OBJECT (psrc, "Read 0 bytes. EOS."); gst_buffer_unref (buf); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } read_error: { diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index 803530f..86900b0 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -395,7 +395,7 @@ eos: { GST_DEBUG ("non-regular file hits EOS"); gst_buffer_unmap (buf, data, 0); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 460660f..bce85b8 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -659,7 +659,7 @@ gst_identity_transform_ip (GstBaseTransform * trans, GstBuffer * buf) identity->clock_id = NULL; } if (cret == GST_CLOCK_UNSCHEDULED) - ret = GST_FLOW_UNEXPECTED; + ret = GST_FLOW_EOS; } GST_OBJECT_UNLOCK (identity); } diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 85083eb..1e4c06d 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1072,7 +1072,7 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq, switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - result = GST_FLOW_UNEXPECTED; + result = GST_FLOW_EOS; break; case GST_EVENT_SEGMENT: apply_segment (mq, sq, event, &sq->src_segment); @@ -1300,7 +1300,7 @@ gst_multi_queue_loop (GstPad * pad) object = NULL; if (result != GST_FLOW_OK && result != GST_FLOW_NOT_LINKED - && result != GST_FLOW_UNEXPECTED) + && result != GST_FLOW_EOS) goto out_flushing; GST_LOG_OBJECT (mq, "AFTER PUSHING sq->srcresult: %s", @@ -1325,7 +1325,7 @@ out_flushing: * but might be stuck in one of our other full queues; * so empty this one and trigger dynamic queue growth. At * this point the srcresult is not OK, NOT_LINKED - * or UNEXPECTED, i.e. a real failure */ + * or EOS, i.e. a real failure */ gst_data_queue_flush (sq->queue); single_queue_underrun_cb (sq->queue, sq); gst_data_queue_set_flushing (sq->queue, TRUE); @@ -1391,9 +1391,9 @@ flushing: } was_eos: { - GST_DEBUG_OBJECT (mq, "we are EOS, dropping buffer, return UNEXPECTED"); + GST_DEBUG_OBJECT (mq, "we are EOS, dropping buffer, return EOS"); gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -1664,10 +1664,10 @@ compute_high_id (GstMultiQueue * mq) if (sq->nextid < lowest) lowest = sq->nextid; - } else if (sq->srcresult != GST_FLOW_UNEXPECTED) { + } else if (sq->srcresult != GST_FLOW_EOS) { /* If we don't have a global highid, or the global highid is lower than * this single queue's last outputted id, store the queue's one, - * unless the singlequeue is at EOS (srcresult = UNEXPECTED) */ + * unless the singlequeue is at EOS (srcresult = EOS) */ if ((highid == G_MAXUINT32) || (sq->oldid > highid)) highid = sq->oldid; } @@ -1709,10 +1709,10 @@ compute_high_time (GstMultiQueue * mq) if (lowest == GST_CLOCK_TIME_NONE || sq->next_time < lowest) lowest = sq->next_time; - } else if (sq->srcresult != GST_FLOW_UNEXPECTED) { + } else if (sq->srcresult != GST_FLOW_EOS) { /* If we don't have a global highid, or the global highid is lower than * this single queue's last outputted id, store the queue's one, - * unless the singlequeue is at EOS (srcresult = UNEXPECTED) */ + * unless the singlequeue is at EOS (srcresult = EOS) */ if (highest == GST_CLOCK_TIME_NONE || sq->last_time > highest) highest = sq->last_time; } diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 19ccf8f..bdacc36 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -690,7 +690,7 @@ gst_queue_locked_enqueue_event (GstQueue * queue, gpointer item) apply_segment (queue, event, &queue->src_segment, FALSE); queue->newseg_applied_to_src = TRUE; } - /* a new segment allows us to accept more buffers if we got UNEXPECTED + /* a new segment allows us to accept more buffers if we got EOS * from downstream */ queue->unexpected = FALSE; break; @@ -1033,17 +1033,16 @@ out_eos: gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } out_unexpected: { - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "exit because we received UNEXPECTED"); + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS"); GST_QUEUE_MUTEX_UNLOCK (queue); gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -1113,17 +1112,16 @@ next: /* need to check for srcresult here as well */ GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - if (result == GST_FLOW_UNEXPECTED) { - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "got UNEXPECTED from downstream"); + if (result == GST_FLOW_EOS) { + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "got EOS from downstream"); /* stop pushing buffers, we dequeue all items until we see an item that we * can push again, which is EOS or SEGMENT. If there is nothing in the * queue we can push, we set a flag to make the sinkpad refuse more - * buffers with an UNEXPECTED return value. */ + * buffers with an EOS return value. */ while ((data = gst_queue_locked_dequeue (queue, &is_buffer))) { if (is_buffer) { GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "dropping UNEXPECTED buffer %p", data); + "dropping EOS buffer %p", data); gst_buffer_unref (GST_BUFFER_CAST (data)); } else { GstEvent *event = GST_EVENT_CAST (data); @@ -1132,12 +1130,12 @@ next: if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) { /* we found a pushable item in the queue, push it out */ GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "pushing pushable event %s after UNEXPECTED", + "pushing pushable event %s after EOS", GST_EVENT_TYPE_NAME (event)); goto next; } GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "dropping UNEXPECTED event %p", event); + "dropping EOS event %p", event); gst_event_unref (event); } } @@ -1160,11 +1158,11 @@ next: gst_pad_push_event (queue->srcpad, event); GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - /* if we're EOS, return UNEXPECTED so that the task pauses. */ + /* if we're EOS, return EOS so that the task pauses. */ if (type == GST_EVENT_EOS) { GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "pushed EOS event %p, return UNEXPECTED", event); - result = GST_FLOW_UNEXPECTED; + "pushed EOS event %p, return EOS", event); + result = GST_FLOW_EOS; } } return result; @@ -1238,8 +1236,8 @@ out_flushing: GST_QUEUE_SIGNAL_DEL (queue); GST_QUEUE_MUTEX_UNLOCK (queue); /* let app know about us giving up if upstream is not expected to do so */ - /* UNEXPECTED is already taken care of elsewhere */ - if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED)) { + /* EOS is already taken care of elsewhere */ + if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS)) { GST_ELEMENT_ERROR (queue, STREAM, FAILED, (_("Internal data flow error.")), ("streaming task paused, reason %s (%d)", diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index c89c6cd..f89bd49 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -1122,7 +1122,7 @@ could_not_read: eos: { GST_DEBUG ("non-regular file hits EOS"); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -1265,7 +1265,7 @@ hit_eos: { GST_DEBUG_OBJECT (queue, "EOS hit and we don't have any requested data"); gst_buffer_unref (buf); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } out_flushing: { @@ -1306,7 +1306,7 @@ gst_queue2_read_item_from_file (GstQueue2 * queue) case GST_FLOW_OK: item = GST_MINI_OBJECT_CAST (buffer); break; - case GST_FLOW_UNEXPECTED: + case GST_FLOW_EOS: item = GST_MINI_OBJECT_CAST (gst_event_new_eos ()); break; default: @@ -1751,7 +1751,7 @@ out_flushing: { GST_DEBUG_OBJECT (queue, "we are flushing"); gst_buffer_unmap (buffer, odata, osize); - /* FIXME - GST_FLOW_UNEXPECTED ? */ + /* FIXME - GST_FLOW_EOS ? */ return FALSE; } seek_failed: @@ -1831,7 +1831,7 @@ gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item, gboolean isbuffer) queue->starting_segment = event; item = NULL; } - /* a new segment allows us to accept more buffers if we got UNEXPECTED + /* a new segment allows us to accept more buffers if we got EOS * from downstream */ queue->unexpected = FALSE; break; @@ -2165,16 +2165,15 @@ out_eos: GST_QUEUE2_MUTEX_UNLOCK (queue); gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } out_unexpected: { - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "exit because we received UNEXPECTED"); + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "exit because we received EOS"); GST_QUEUE2_MUTEX_UNLOCK (queue); gst_buffer_unref (buffer); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } @@ -2216,18 +2215,17 @@ next: /* need to check for srcresult here as well */ GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing); - if (result == GST_FLOW_UNEXPECTED) { - GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "got UNEXPECTED from downstream"); + if (result == GST_FLOW_EOS) { + GST_CAT_LOG_OBJECT (queue_dataflow, queue, "got EOS from downstream"); /* stop pushing buffers, we dequeue all items until we see an item that we * can push again, which is EOS or SEGMENT. If there is nothing in the * queue we can push, we set a flag to make the sinkpad refuse more - * buffers with an UNEXPECTED return value until we receive something + * buffers with an EOS return value until we receive something * pushable again or we get flushed. */ while ((data = gst_queue2_locked_dequeue (queue, &is_buffer))) { if (is_buffer) { GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "dropping UNEXPECTED buffer %p", data); + "dropping EOS buffer %p", data); gst_buffer_unref (GST_BUFFER_CAST (data)); } else if (GST_IS_EVENT (data)) { GstEvent *event = GST_EVENT_CAST (data); @@ -2236,12 +2234,12 @@ next: if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) { /* we found a pushable item in the queue, push it out */ GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "pushing pushable event %s after UNEXPECTED", + "pushing pushable event %s after EOS", GST_EVENT_TYPE_NAME (event)); goto next; } GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "dropping UNEXPECTED event %p", event); + "dropping EOS event %p", event); gst_event_unref (event); } } @@ -2258,11 +2256,11 @@ next: gst_pad_push_event (queue->srcpad, event); - /* if we're EOS, return UNEXPECTED so that the task pauses. */ + /* if we're EOS, return EOS so that the task pauses. */ if (type == GST_EVENT_EOS) { GST_CAT_LOG_OBJECT (queue_dataflow, queue, - "pushed EOS event %p, return UNEXPECTED", event); - result = GST_FLOW_UNEXPECTED; + "pushed EOS event %p, return EOS", event); + result = GST_FLOW_EOS; } GST_QUEUE2_MUTEX_LOCK_CHECK (queue, queue->srcresult, out_flushing); @@ -2337,8 +2335,8 @@ out_flushing: GST_CAT_LOG_OBJECT (queue_dataflow, queue, "pause task, reason: %s", gst_flow_get_name (queue->srcresult)); /* let app know about us giving up if upstream is not expected to do so */ - /* UNEXPECTED is already taken care of elsewhere */ - if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_UNEXPECTED)) { + /* EOS is already taken care of elsewhere */ + if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS)) { GST_ELEMENT_ERROR (queue, STREAM, FAILED, (_("Internal data flow error.")), ("streaming task paused, reason %s (%d)", @@ -2700,7 +2698,7 @@ out_unexpected: GST_DEBUG_OBJECT (queue, "read beyond end of file"); GST_QUEUE2_MUTEX_UNLOCK (queue); gst_object_unref (queue); - return GST_FLOW_UNEXPECTED; + return GST_FLOW_EOS; } } diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index 90678c6..d758943 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -924,7 +924,7 @@ gst_tee_src_get_range (GstPad * pad, guint64 offset, guint length, if (ret == GST_FLOW_OK) ret = gst_tee_handle_data (tee, gst_buffer_ref (*buf), FALSE); - else if (ret == GST_FLOW_UNEXPECTED) + else if (ret == GST_FLOW_EOS) gst_tee_pull_eos (tee); gst_object_unref (tee); diff --git a/tests/check/elements/fakesink.c b/tests/check/elements/fakesink.c index ab61e10..a3ed673 100644 --- a/tests/check/elements/fakesink.c +++ b/tests/check/elements/fakesink.c @@ -453,9 +453,9 @@ GST_START_TEST (test_eos) GST_DEBUG ("sending buffer"); - /* buffer after EOS is not UNEXPECTED */ + /* buffer after EOS is not EOS */ fret = gst_pad_chain (sinkpad, buffer); - fail_unless (fret == GST_FLOW_UNEXPECTED); + fail_unless (fret == GST_FLOW_EOS); } /* flush, EOS state is flushed again. */ @@ -556,7 +556,7 @@ GST_START_TEST (test_eos2) fail_if (eret == FALSE); } - /* send buffer that should return UNEXPECTED */ + /* send buffer that should return EOS */ { GstBuffer *buffer; GstFlowReturn fret; @@ -567,12 +567,12 @@ GST_START_TEST (test_eos2) GST_DEBUG ("sending buffer"); - /* this buffer will generate UNEXPECTED */ + /* this buffer will generate EOS */ fret = gst_pad_chain (sinkpad, buffer); - fail_unless (fret == GST_FLOW_UNEXPECTED); + fail_unless (fret == GST_FLOW_EOS); } - /* send buffer that should return UNEXPECTED */ + /* send buffer that should return EOS */ { GstBuffer *buffer; GstFlowReturn fret; @@ -584,7 +584,7 @@ GST_START_TEST (test_eos2) GST_DEBUG ("sending buffer"); fret = gst_pad_chain (sinkpad, buffer); - fail_unless (fret == GST_FLOW_UNEXPECTED); + fail_unless (fret == GST_FLOW_EOS); } gst_element_set_state (pipeline, GST_STATE_NULL); @@ -815,7 +815,7 @@ GST_START_TEST (test_position) fail_if (eret == FALSE); } - /* send buffer that should return UNEXPECTED */ + /* send buffer that should return EOS */ buffer = gst_buffer_new (); GST_BUFFER_TIMESTAMP (buffer) = 3 * GST_SECOND; GST_BUFFER_DURATION (buffer) = 1 * GST_SECOND; @@ -831,7 +831,7 @@ GST_START_TEST (test_position) /* preroll buffer is rendered, we expect no more buffer after this one */ fret = chain_async_return (data); - fail_unless (fret == GST_FLOW_UNEXPECTED); + fail_unless (fret == GST_FLOW_EOS); /* do position query, this should succeed with the stream time of the buffer * against the clock. Since the buffer is synced against the clock, the time diff --git a/tests/check/elements/filesrc.c b/tests/check/elements/filesrc.c index eddee15..746bcb3 100644 --- a/tests/check/elements/filesrc.c +++ b/tests/check/elements/filesrc.c @@ -270,19 +270,19 @@ GST_START_TEST (test_pull) /* read 0 bytes at end should EOS */ ret = gst_pad_get_range (pad, stop, 0, &buffer1); - fail_unless (ret == GST_FLOW_UNEXPECTED); + fail_unless (ret == GST_FLOW_EOS); /* read 10 bytes before end should EOS */ ret = gst_pad_get_range (pad, stop, 10, &buffer1); - fail_unless (ret == GST_FLOW_UNEXPECTED); + fail_unless (ret == GST_FLOW_EOS); /* read 0 bytes after end should EOS */ ret = gst_pad_get_range (pad, stop + 10, 0, &buffer1); - fail_unless (ret == GST_FLOW_UNEXPECTED); + fail_unless (ret == GST_FLOW_EOS); /* read 10 bytes after end should EOS too */ ret = gst_pad_get_range (pad, stop + 10, 10, &buffer1); - fail_unless (ret == GST_FLOW_UNEXPECTED); + fail_unless (ret == GST_FLOW_EOS); fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null"); diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c index 4a763e1..5b9e1bf 100644 --- a/tests/check/gst/gstpad.c +++ b/tests/check/gst/gstpad.c @@ -524,10 +524,10 @@ GST_START_TEST (test_flowreturn) GQuark quark; /* test some of the macros */ - ret = GST_FLOW_UNEXPECTED; - fail_if (strcmp (gst_flow_get_name (ret), "unexpected")); + ret = GST_FLOW_EOS; + fail_if (strcmp (gst_flow_get_name (ret), "eos")); quark = gst_flow_to_quark (ret); - fail_if (strcmp (g_quark_to_string (quark), "unexpected")); + fail_if (strcmp (g_quark_to_string (quark), "eos")); ret = GST_FLOW_RESEND; fail_if (strcmp (gst_flow_get_name (ret), "resend")); -- 2.7.4