[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38631] trunk/blender/intern/audaspace/ OpenAL: Cherry pick merge: /branches/soc-2011-pepper/intern/audaspace/ OpenAL:r38630

Joerg Mueller nexyon at gmail.com
Sat Jul 23 18:08:38 CEST 2011


Revision: 38631
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38631
Author:   nexyon
Date:     2011-07-23 16:08:37 +0000 (Sat, 23 Jul 2011)
Log Message:
-----------
Cherry pick merge: /branches/soc-2011-pepper/intern/audaspace/OpenAL:r38630
Original log: Corrected the OpenAL device's threading code. This is a bugfix for #27913, thanks to Juha M?\195?\164ki-Kanto for helping to resolve this.

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38630

Modified Paths:
--------------
    trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
    trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.h

Property Changed:
----------------
    trunk/blender/intern/audaspace/OpenAL/


Property changes on: trunk/blender/intern/audaspace/OpenAL
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/soc-2011-pepper/intern/audaspace/OpenAL:38630

Modified: trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
===================================================================
--- trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2011-07-23 15:59:10 UTC (rev 38630)
+++ trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp	2011-07-23 16:08:37 UTC (rev 38631)
@@ -105,12 +105,15 @@
 	return NULL;
 }
 
-void AUD_OpenALDevice::start()
+void AUD_OpenALDevice::start(bool join)
 {
 	lock();
 
 	if(!m_playing)
 	{
+		if(join)
+			pthread_join(m_thread, NULL);
+
 		pthread_attr_t attr;
 		pthread_attr_init(&attr);
 		pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -271,8 +274,8 @@
 		// stop thread
 		if(m_playingSounds->empty() || (cerr != ALC_NO_ERROR))
 		{
+			m_playing = false;
 			unlock();
-			m_playing = false;
 			pthread_exit(NULL);
 		}
 
@@ -366,6 +369,8 @@
 	pthread_mutex_init(&m_mutex, &attr);
 
 	pthread_mutexattr_destroy(&attr);
+
+	start(false);
 }
 
 AUD_OpenALDevice::~AUD_OpenALDevice()
@@ -414,13 +419,8 @@
 	alcProcessContext(m_context);
 
 	// wait for the thread to stop
-	if(m_playing)
-	{
-		unlock();
-		pthread_join(m_thread, NULL);
-	}
-	else
-		unlock();
+	unlock();
+	pthread_join(m_thread, NULL);
 
 	delete m_playingSounds;
 	delete m_pausedSounds;

Modified: trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.h
===================================================================
--- trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.h	2011-07-23 15:59:10 UTC (rev 38630)
+++ trunk/blender/intern/audaspace/OpenAL/AUD_OpenALDevice.h	2011-07-23 16:08:37 UTC (rev 38631)
@@ -106,7 +106,7 @@
 	/**
 	 * Starts the streaming thread.
 	 */
-	void start();
+	void start(bool join = true);
 
 	/**
 	 * Checks if a handle is valid.




More information about the Bf-blender-cvs mailing list