From 6b1ccb86853d73b80280c21e1294eeeeb634e243 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Thu, 11 Oct 2012 15:48:56 +0530 Subject: [PATCH] bluez: Handle EOF in avdtpsrc correctly --- sys/bluez/gstavdtpsrc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/bluez/gstavdtpsrc.c b/sys/bluez/gstavdtpsrc.c index 955af289f9..3e224e23b9 100644 --- a/sys/bluez/gstavdtpsrc.c +++ b/sys/bluez/gstavdtpsrc.c @@ -312,6 +312,12 @@ gst_avdtp_src_create (GstBaseSrc * bsrc, guint64 offset, if (ret < 0) goto read_error; + else if (ret == 0) { + GST_ERROR_OBJECT (avdtpsrc, "Got EOF on the transport fd"); + GST_ELEMENT_ERROR ((avdtpsrc), RESOURCE, FAILED, ("Disconnected" + " from remote device"), (NULL)); + goto eof; + } GST_LOG_OBJECT (avdtpsrc, "Read %d bytes", ret); @@ -325,11 +331,12 @@ gst_avdtp_src_create (GstBaseSrc * bsrc, guint64 offset, return GST_FLOW_OK; read_error: - gst_buffer_unref (buf); - GST_ERROR_OBJECT (avdtpsrc, "Error while reading audio data: %s", strerror (errno)); +eof: + gst_buffer_unref (buf); + return GST_FLOW_ERROR; }