<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -30,6 +30,7 @@
 
 #include &quot;config.h&quot;
 
+#include &lt;sys/time.h&gt;
 #include &lt;string.h&gt;
 #include &lt;netdb.h&gt;
 #include &lt;netinet/in.h&gt;
@@ -373,14 +374,24 @@ rbspotifysrc_create (GstPushSrc *psrc, GstBuffer **outbuf)
 	}
 
 	audio_fifo_t *af = &amp;g_audio_fifo;	
+	struct timeval now;
+	struct timespec timeout;
 
 //	if (af-&gt;nsamples == 0 &amp;&amp; src-&gt;curoffset &lt; src-&gt;size)
 //	{
-		fprintf(stderr, &quot;samples: %d  curoffset: %lld  size: %lld\n&quot;, af-&gt;nsamples,
-			(unsigned long long)src-&gt;curoffset, (unsigned long long)src-&gt;size);
-		pthread_mutex_lock(&amp;af-&gt;cond_mutex);
-		pthread_cond_wait(&amp;af-&gt;cond, &amp;af-&gt;cond_mutex);
-		pthread_mutex_unlock(&amp;af-&gt;cond_mutex);
+	fprintf(stderr, &quot;samples: %d  curoffset: %lld  size: %lld\n&quot;, af-&gt;nsamples,
+		(unsigned long long)src-&gt;curoffset, (unsigned long long)src-&gt;size);
+	pthread_mutex_lock(&amp;af-&gt;cond_mutex);
+	gettimeofday(&amp;now, NULL);
+	timeout.tv_sec = now.tv_sec + 5;
+	timeout.tv_nsec = now.tv_usec * 1000;
+
+	pthread_cond_timedwait(&amp;af-&gt;cond, &amp;af-&gt;cond_mutex, &amp;timeout);
+	pthread_mutex_unlock(&amp;af-&gt;cond_mutex);
+
+	if (af-&gt;nsamples == 0) {
+		return GST_FLOW_UNEXPECTED;
+	}
 //	}
 
 	src-&gt;caps = gst_caps_new_simple (&quot;audio/x-raw-int&quot;,</diff>
      <filename>plugins/rbspotify/rb-spotify-src.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c5fa69a251a7f83b7119badf1b691dec477e0f8b</id>
    </parent>
  </parents>
  <author>
    <name>Ivan Kelly</name>
    <email>ivan@bleurgh.com</email>
  </author>
  <url>http://github.com/ivankelly/Rhythmbox-Spotify-Plugin/commit/7c0e392d5109025752ea7f17b050be747f9a366a</url>
  <id>7c0e392d5109025752ea7f17b050be747f9a366a</id>
  <committed-date>2009-05-18T13:58:12-07:00</committed-date>
  <authored-date>2009-05-18T13:58:12-07:00</authored-date>
  <message>Song now can end :0</message>
  <tree>15d905c99351ed4c0fb51387e96315605c4fee49</tree>
  <committer>
    <name>Ivan Kelly</name>
    <email>ivan@bleurgh.com</email>
  </committer>
</commit>
