mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
wavenc: Post warning if file isnt finished properly
When the pipeline is shut down and the file isn't finished properly, wavenc should post a warning. Fixes #607440
This commit is contained in:
parent
ca41ddda75
commit
ef2b7bbcab
2 changed files with 22 additions and 0 deletions
|
@ -637,6 +637,9 @@ gst_wavenc_event (GstPad * pad, GstEvent * event)
|
|||
/* write header with correct length values */
|
||||
gst_wavenc_push_header (wavenc, wavenc->length);
|
||||
|
||||
/* we're done with this file */
|
||||
wavenc->finished_properly = TRUE;
|
||||
|
||||
/* and forward the EOS event */
|
||||
res = gst_pad_event_default (pad, event);
|
||||
break;
|
||||
|
@ -668,6 +671,9 @@ gst_wavenc_chain (GstPad * pad, GstBuffer * buf)
|
|||
* header when we get EOS and know the exact length */
|
||||
flow = gst_wavenc_push_header (wavenc, 0x7FFF0000);
|
||||
|
||||
/* starting a file, means we have to finish it properly */
|
||||
wavenc->finished_properly = FALSE;
|
||||
|
||||
if (flow != GST_FLOW_OK)
|
||||
return flow;
|
||||
|
||||
|
@ -705,6 +711,8 @@ gst_wavenc_change_state (GstElement * element, GstStateChange transition)
|
|||
wavenc->rate = 0;
|
||||
wavenc->length = 0;
|
||||
wavenc->sent_header = FALSE;
|
||||
/* its true because we haven't writen anything */
|
||||
wavenc->finished_properly = TRUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -714,6 +722,19 @@ gst_wavenc_change_state (GstElement * element, GstStateChange transition)
|
|||
if (ret != GST_STATE_CHANGE_SUCCESS)
|
||||
return ret;
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
if (!wavenc->finished_properly) {
|
||||
GST_ELEMENT_WARNING (wavenc, STREAM, MUX,
|
||||
("Wav stream not finished properly"),
|
||||
("Wav stream not finished properly, no EOS received "
|
||||
"before shutdown"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ struct _GstWavEnc {
|
|||
guint32 length;
|
||||
|
||||
gboolean sent_header;
|
||||
gboolean finished_properly;
|
||||
};
|
||||
|
||||
struct _GstWavEncClass {
|
||||
|
|
Loading…
Reference in a new issue