Add names to all threads

This commit is contained in:
Flamefire committed 2014-03-11 21:50:06 +01:00
1 parent 0a9c6e5cfe
commit 44dceaed60
5 files changed
+29 -10

No files matched your search

+1 -1
View File
@@ -73,7 +73,7 @@ namespace ServerLib
return; return;
_DiscoverRunning = true; _DiscoverRunning = true;
_DiscoverThread = new Thread(() => _Discover(Timeout)); _DiscoverThread = new Thread(() => _Discover(Timeout)) {Name = "Client discover"};
_OnDiscovered = OnDiscovered; _OnDiscovered = OnDiscovered;
_DiscoverThread.Start(); _DiscoverThread.Start();
} }
+1 -1
View File
@@ -326,7 +326,7 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _Notifications.Count; i++) for (int i = 0; i < _Notifications.Count; i++)
_WaitHandles[i] = _Notifications[i].Event; _WaitHandles[i] = _Notifications[i].Event;
_CaptureThread = new Thread(_DoCapture) {IsBackground = true}; _CaptureThread = new Thread(_DoCapture) {Name="DirectSoundCapture",IsBackground = true};
_Running = true; _Running = true;
_CaptureThread.Start(); _CaptureThread.Start();
+25 -6
View File
@@ -37,10 +37,10 @@ namespace Vocaluxe.Lib.Sound
public bool Init() public bool Init()
{ {
#if ARCH_X86 #if ARCH_X86
string path = ".\\x86\\gstreamer"; const string path = ".\\x86\\gstreamer";
#endif #endif
#if ARCH_X64 #if ARCH_X64
string path = ".\\x64\\gstreamer"; const string path = ".\\x64\\gstreamer";
#endif #endif
SetDllDirectory(path); SetDllDirectory(path);
Application.Init(); Application.Init();
@@ -213,9 +213,9 @@ namespace Vocaluxe.Lib.Sound
private class CGstreamerSharpAudioStream private class CGstreamerSharpAudioStream
{ {
private readonly Element _Element; private Element _Element;
private bool _Loop; private bool _Loop;
public volatile bool Closed; public volatile bool Closed = true;
public volatile bool Finished; public volatile bool Finished;
private bool _Fading; private bool _Fading;
@@ -240,7 +240,10 @@ namespace Vocaluxe.Lib.Sound
var audioSinkBin = new Bin("Audiosink"); var audioSinkBin = new Bin("Audiosink");
if (convert == null || audiosink == null) if (convert == null || audiosink == null)
{
CLog.LogError("Could not create pipeline"); CLog.LogError("Could not create pipeline");
return;
}
audioSinkBin.Add(convert); audioSinkBin.Add(convert);
audioSinkBin.Add(audiosink); audioSinkBin.Add(audiosink);
@@ -249,21 +252,35 @@ namespace Vocaluxe.Lib.Sound
GhostPad ghostpad = new GhostPad("sink", pad); GhostPad ghostpad = new GhostPad("sink", pad);
if (pad == null) if (pad == null)
{
CLog.LogError("Could not create pads"); CLog.LogError("Could not create pads");
return;
}
if (!ghostpad.SetActive(true)) if (!ghostpad.SetActive(true))
{
CLog.LogError("Could not link pads"); CLog.LogError("Could not link pads");
return;
}
if (!audioSinkBin.AddPad(ghostpad)) if (!audioSinkBin.AddPad(ghostpad))
{
CLog.LogError("Could not add pad"); CLog.LogError("Could not add pad");
return;
}
_Element = ElementFactory.Make("playbin", "playbin"); _Element = ElementFactory.Make("playbin", "playbin");
if (_Element == null) if (_Element == null)
{
CLog.LogError("Could not create playbin"); CLog.LogError("Could not create playbin");
return;
}
_Element["audio-sink"] = audioSinkBin; _Element["audio-sink"] = audioSinkBin;
_Element["flags"] = 1 << 1; _Element["flags"] = 1 << 1;
_Element["uri"] = new Uri(media).AbsoluteUri; _Element["uri"] = new Uri(media).AbsoluteUri;
_Element.SetState(State.Paused); _Element.SetState(State.Paused);
Closed = false; //Enable stream
// Passing CLOCK_TIME_NONE here causes the pipeline to block for a long time so with // Passing CLOCK_TIME_NONE here causes the pipeline to block for a long time so with
// prescan enabled the pipeline will wait 500ms for stream to initialize and then continue // prescan enabled the pipeline will wait 500ms for stream to initialize and then continue
// if it takes more than 500ms, duration queries will be performed asynchronously // if it takes more than 500ms, duration queries will be performed asynchronously
@@ -307,7 +324,7 @@ namespace Vocaluxe.Lib.Sound
{ {
Closed = true; Closed = true;
Finished = true; Finished = true;
var t = new Thread(_TerminateStream); var t = new Thread(_TerminateStream) {Name = "GSt Terminate"};
t.Start(); t.Start();
} }
} }
@@ -318,6 +335,7 @@ namespace Vocaluxe.Lib.Sound
{ {
_Element.SetState(State.Null); _Element.SetState(State.Null);
_Element.Dispose(); _Element.Dispose();
_Element = null;
} }
} }
@@ -388,7 +406,8 @@ namespace Vocaluxe.Lib.Sound
{ {
if (_Duration < 0 && !_QueryingDuration) if (_Duration < 0 && !_QueryingDuration)
{ {
var t = new Thread(_UpdateDuration); _QueryingDuration = true; // Set this to avoid race conditions
var t = new Thread(_UpdateDuration) {Name = "GSt Update Duration"};
t.Start(); t.Start();
} }
return _Duration > 0 ? _Duration : -1; return _Duration > 0 ? _Duration : -1;
+1 -1
View File
@@ -416,7 +416,7 @@ namespace Vocaluxe.Lib.Sound
public COpenAlStream() public COpenAlStream()
{ {
_Initialized = false; _Initialized = false;
_DecoderThread = new Thread(_Execute); _DecoderThread = new Thread(_Execute) {Name = "OpenAL Decode"};
} }
public void Free(Closeproc closeProc, int streamID, Object closeMutex) public void Free(Closeproc closeProc, int streamID, Object closeMutex)
+1 -1
View File
@@ -401,7 +401,7 @@ namespace Vocaluxe.Lib.Sound
public CPortAudioStream() public CPortAudioStream()
{ {
_SyncTimer = new CSyncTimer(0f, 1f, 0.02f); _SyncTimer = new CSyncTimer(0f, 1f, 0.02f);
_DecoderThread = new Thread(_Execute); _DecoderThread = new Thread(_Execute) {Name = "PortAudio Decode"};
} }
~CPortAudioStream() ~CPortAudioStream()