mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 13:38:48 +00:00
gst/elements/gstfilesink.c: Patch from Sebastien Cote to fix leakage of events. (bug #141414)
Original commit message from CVS: * gst/elements/gstfilesink.c: (gst_filesink_handle_event): Patch from Sebastien Cote to fix leakage of events. (bug #141414)
This commit is contained in:
parent
38bc5be22e
commit
72a12f0e86
3 changed files with 39 additions and 12 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2004-04-29 David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
|
* gst/elements/gstfilesink.c: (gst_filesink_handle_event):
|
||||||
|
Patch from Sebastien Cote to fix leakage of events. (bug #141414)
|
||||||
|
|
||||||
2004-04-29 Thomas Vander Stichele <thomas at apestaart dot org>
|
2004-04-29 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
|
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
|
||||||
|
|
|
@ -332,22 +332,30 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
filesink = GST_FILESINK (gst_pad_get_parent (pad));
|
filesink = GST_FILESINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
/* FIXME: should the event be unreferenced ? */
|
|
||||||
if (!(GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN)))
|
if (!(GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))) {
|
||||||
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
g_return_val_if_fail (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_BYTES,
|
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||||
FALSE);
|
gst_event_unref (event);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||||
if (fflush (filesink->file))
|
if (fflush (filesink->file)) {
|
||||||
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||||
GST_ERROR_SYSTEM);
|
GST_ERROR_SYSTEM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||||
case GST_SEEK_METHOD_SET:
|
case GST_SEEK_METHOD_SET:
|
||||||
|
@ -363,6 +371,7 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
g_warning ("unknown seek method!");
|
g_warning ("unknown seek method!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gst_event_unref (event);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
{
|
{
|
||||||
|
@ -376,12 +385,14 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
if (fflush (filesink->file)) {
|
if (fflush (filesink->file)) {
|
||||||
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||||
GST_ERROR_SYSTEM);
|
GST_ERROR_SYSTEM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
gst_event_unref (event);
|
||||||
gst_filesink_close_file (filesink);
|
gst_filesink_close_file (filesink);
|
||||||
gst_element_set_eos (GST_ELEMENT (filesink));
|
gst_element_set_eos (GST_ELEMENT (filesink));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -332,22 +332,30 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
|
|
||||||
filesink = GST_FILESINK (gst_pad_get_parent (pad));
|
filesink = GST_FILESINK (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
/* FIXME: should the event be unreferenced ? */
|
|
||||||
if (!(GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN)))
|
if (!(GST_FLAG_IS_SET (filesink, GST_FILESINK_OPEN))) {
|
||||||
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
g_return_val_if_fail (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_BYTES,
|
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_BYTES) {
|
||||||
FALSE);
|
gst_event_unref (event);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH)
|
if (GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH) {
|
||||||
if (fflush (filesink->file))
|
if (fflush (filesink->file)) {
|
||||||
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||||
GST_ERROR_SYSTEM);
|
GST_ERROR_SYSTEM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (GST_EVENT_SEEK_METHOD (event)) {
|
switch (GST_EVENT_SEEK_METHOD (event)) {
|
||||||
case GST_SEEK_METHOD_SET:
|
case GST_SEEK_METHOD_SET:
|
||||||
|
@ -363,6 +371,7 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
g_warning ("unknown seek method!");
|
g_warning ("unknown seek method!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
gst_event_unref (event);
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
{
|
{
|
||||||
|
@ -376,12 +385,14 @@ gst_filesink_handle_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
case GST_EVENT_FLUSH:
|
case GST_EVENT_FLUSH:
|
||||||
if (fflush (filesink->file)) {
|
if (fflush (filesink->file)) {
|
||||||
|
gst_event_unref (event);
|
||||||
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
GST_ELEMENT_ERROR (filesink, RESOURCE, WRITE,
|
||||||
(_("Error while writing to file \"%s\"."), filesink->filename),
|
(_("Error while writing to file \"%s\"."), filesink->filename),
|
||||||
GST_ERROR_SYSTEM);
|
GST_ERROR_SYSTEM);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
gst_event_unref (event);
|
||||||
gst_filesink_close_file (filesink);
|
gst_filesink_close_file (filesink);
|
||||||
gst_element_set_eos (GST_ELEMENT (filesink));
|
gst_element_set_eos (GST_ELEMENT (filesink));
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue