GValue * value, GParamSpec * pspec);
static void gst_pulsesrc_finalize (GObject * object);
+static gboolean gst_pulsesrc_set_corked (GstPulseSrc * psrc, gboolean corked,
+ gboolean wait);
static gboolean gst_pulsesrc_open (GstAudioSrc * asrc);
static gboolean gst_pulsesrc_close (GstAudioSrc * asrc);
pulsesrc->context = NULL;
pulsesrc->stream = NULL;
+ pulsesrc->stream_connected = FALSE;
pulsesrc->source_output_idx = PA_INVALID_INDEX;
pulsesrc->read_buffer = NULL;
pa_sample_spec_init (&pulsesrc->sample_spec);
pulsesrc->operation_success = FALSE;
- pulsesrc->paused = FALSE;
+ pulsesrc->paused = TRUE;
pulsesrc->in_read = FALSE;
pulsesrc->mixer = NULL;
pa_stream_disconnect (pulsesrc->stream);
pa_stream_unref (pulsesrc->stream);
pulsesrc->stream = NULL;
+ pulsesrc->stream_connected = FALSE;
pulsesrc->source_output_idx = PA_INVALID_INDEX;
g_object_notify (G_OBJECT (pulsesrc), "source-output-index");
}
/* Wait until the stream is ready */
pa_threaded_mainloop_wait (pulsesrc->mainloop);
}
+ pulsesrc->stream_connected = TRUE;
/* store the source output index so it can be accessed via a property */
pulsesrc->source_output_idx = pa_stream_get_index (pulsesrc->stream);
}
spec->segtotal = actual->maxlength / spec->segsize;
+ if (!pulsesrc->paused) {
+ GST_DEBUG_OBJECT (pulsesrc, "uncorking because we are playing");
+ gst_pulsesrc_set_corked (pulsesrc, FALSE, FALSE);
+ }
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
return TRUE;
{
GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (userdata);
- pulsesrc->operation_success = !!success;
+ pulsesrc->operation_success = ! !success;
pa_threaded_mainloop_signal (pulsesrc->mainloop, 0);
}
gboolean res = FALSE;
GST_DEBUG_OBJECT (psrc, "setting corked state to %d", corked);
+ if (!psrc->stream_connected)
+ return TRUE;
+
if (psrc->corked != corked) {
if (!(o = pa_stream_cork (psrc->stream, corked,
gst_pulsesrc_success_cb, psrc)))