summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>2012-02-17 18:27:20 -0300
committerReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>2012-02-20 16:41:39 -0300
commitbf08a3abdd6a699a497425599079cb6965fae3f5 (patch)
tree7e47eb0ea3be803a996b2ae0b0dc6d101007319e
parent399da90e26806197316eb8c6e881beb48e83df14 (diff)
Drop some useless goto's
-rwxr-xr-xsink/audioflingersink/gstaudioflingersink.c82
1 files changed, 28 insertions, 54 deletions
diff --git a/sink/audioflingersink/gstaudioflingersink.c b/sink/audioflingersink/gstaudioflingersink.c
index 0046a69..125ae69 100755
--- a/sink/audioflingersink/gstaudioflingersink.c
+++ b/sink/audioflingersink/gstaudioflingersink.c
@@ -243,17 +243,12 @@ gst_android_audioringbuffer_open_device (GstRingBuffer * buf)
result = gst_audioflinger_sink_open (sink);
GST_INFO_OBJECT (sink, "open device result %d", result);
- if (!result)
- goto could_not_open;
+ if (result)
+ return TRUE;
- return result;
-
-could_not_open:
- {
- GST_DEBUG_OBJECT (sink, "could not open device");
- LOGE ("could not open device");
- return FALSE;
- }
+ GST_DEBUG_OBJECT (sink, "could not open device");
+ LOGE ("could not open device");
+ return FALSE;
}
static gboolean
@@ -268,17 +263,12 @@ gst_android_audioringbuffer_close_device (GstRingBuffer * buf)
result = gst_audioflinger_sink_close (sink);
- if (!result)
- goto could_not_close;
+ if (result)
+ return TRUE;
- return result;
-
-could_not_close:
- {
- GST_DEBUG_OBJECT (sink, "could not close device");
- LOGE ("could not close device");
- return FALSE;
- }
+ GST_DEBUG_OBJECT (sink, "could not close device");
+ LOGE ("could not close device");
+ return FALSE;
}
static gboolean
@@ -294,18 +284,12 @@ gst_android_audioringbuffer_acquire (GstRingBuffer * buf,
result = gst_audioflinger_sink_prepare (sink, spec);
- if (!result)
- goto could_not_prepare;
+ if (result)
+ return TRUE;
- return TRUE;
-
- /* ERRORS */
-could_not_prepare:
- {
- GST_DEBUG_OBJECT (sink, "could not prepare device");
- LOGE ("could not close device");
- return FALSE;
- }
+ GST_DEBUG_OBJECT (sink, "could not prepare device");
+ LOGE ("could not close device");
+ return FALSE;
}
static gboolean
@@ -327,19 +311,14 @@ gst_android_audioringbuffer_release (GstRingBuffer * buf)
result = gst_audioflinger_sink_unprepare (sink);
- if (!result)
- goto could_not_unprepare;
-
- GST_DEBUG_OBJECT (sink, "unprepared");
-
- return result;
-
-could_not_unprepare:
- {
- GST_DEBUG_OBJECT (sink, "could not unprepare device");
- LOGE ("could not unprepare device");
- return FALSE;
+ if (result) {
+ GST_DEBUG_OBJECT (sink, "unprepared");
+ return TRUE;
}
+
+ GST_DEBUG_OBJECT (sink, "could not unprepare device");
+ LOGE ("could not unprepare device");
+ return FALSE;
}
static gboolean
@@ -1082,8 +1061,12 @@ gst_audioflinger_sink_prepare (GstAudioFlingerSink * audioflinger,
* the gst-launch usage
*/
if (audioflinger_device_set (audioflinger->audioflinger_device,
- 3, spec->channels, spec->rate, spec->segsize) == -1)
- goto failed_creation;
+ 3, spec->channels, spec->rate, spec->segsize) == -1) {
+ GST_ELEMENT_ERROR (audioflinger, RESOURCE, SETTINGS, (NULL),
+ ("Failed to create AudioFlinger for format %d", spec->format));
+ LOGE ("Failed to create AudioFlinger for format %d", spec->format);
+ return FALSE;
+ }
audioflinger->m_init = TRUE;
spec->bytes_per_sample = (spec->width / 8) * spec->channels;
@@ -1114,15 +1097,6 @@ gst_audioflinger_sink_prepare (GstAudioFlingerSink * audioflinger,
#endif
return TRUE;
-
- /* ERRORS */
-failed_creation:
- {
- GST_ELEMENT_ERROR (audioflinger, RESOURCE, SETTINGS, (NULL),
- ("Failed to create AudioFlinger for format %d", spec->format));
- LOGE ("Failed to create AudioFlinger for format %d", spec->format);
- return FALSE;
- }
}
static gboolean