18 May '13 - 16:06 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Multithread  (Read 896 times)
kio2008
Posts: 44


« on: 24 May '12 - 21:15 »
Reply with quoteQuote

Hi everyone.
I have an windows application multithread.
Inside general form I set :

Bass.BASS_Init(0, Nothing, Nothing, Me.Handle)

Then i create object array where any object start a thread
Any thread download internet streaming with this instruction

stream = Bass.BASS_StreamCreateURL(Url, 0, BASSFlag.BASS_MUSIC_DECODE, Nothing, Nothing)

occasionally a thread can go down, so in general form i can start another thread with same Url, but it don't go .
I get this error

BASSError.BASS_ERROR_FILEFORM

I repeat, this another thread is a new thread, old thread is dead

Instead if i start another same windows application and then i start a new thread with same url it go well

Why ?

Bass store something ?
« Last Edit: 25 May '12 - 16:17 by kio2008 » Logged
gnag
Posts: 160


« Reply #1 on: 24 May '12 - 21:22 »
Reply with quoteQuote

Why are threads going "down" ?

Also I haven't seen the use of BASS_MUSIC_DECODE, usually  BASSFlag.BASS_STREAM_DECODE is used for your purposes.

Try to use the Flag I suggested and try to call BASS_StreamFree with the old Handle ("Dead Thread") as Parameter, maybe some ressources are still being used.
Logged
kio2008
Posts: 44


« Reply #2 on: 24 May '12 - 21:58 »
Reply with quoteQuote

I try your suggest . I use flag BASSFlag.BASS_STREAM_DECODE  and inside thread, inside threar abort exception i use BASS_StreamFree .
Now i try and then i will say you

thank you
Logged
kio2008
Posts: 44


« Reply #3 on: 25 May '12 - 10:25 »
Reply with quoteQuote

Sorry, but your suggest don't go. The problem there is again
I destroy thread manually too, but it don't go
It's strange.

« Last Edit: 25 May '12 - 11:12 by kio2008 » Logged
gnag
Posts: 160


« Reply #4 on: 25 May '12 - 17:10 »
Reply with quoteQuote

Ok, could you upload a sample Visual Studio Project with your function to let us reproduce the Problem ?
Logged
kio2008
Posts: 44


« Reply #5 on: 25 May '12 - 21:02 »
Reply with quoteQuote

Ok, I attach file code to this reply

* Form1.rar (1.89 KB - downloaded 6 times.)
Logged
gnag
Posts: 160


« Reply #6 on: 25 May '12 - 22:38 »
Reply with quoteQuote

After creating a VS 2010 Project, copying over your Form-Code, adding missing References (Bass.NET) and needed DLLs (bass.dll,bassenc.dll,basswma.dll) and lame.exe + lame_enc.dll I was able to run your project.

It recorded 20 Seconds of all Radio Stations and stopped after it, I did not see any Threads going down like you described.

Something I remember is when I listen to online radio Stations for some hours using VLC Media Player, my connection drops sometimes and I am forced the restart the playback in VLC to get it working again, I guess that is what is making troubles.
Logged
kio2008
Posts: 44


« Reply #7 on: 26 May '12 - 08:28 »
Reply with quoteQuote

Yes, when I record to online radio Stations for some hours, some connection go down and my program automatically try to restart connection but i get this error
sometime

BASSError.BASS_ERROR_FILEFORM

and sometime this  BASSError.BASS_ERROR_UNKNOWN

Sometime it restart well, but i note that if i start a second instance program it record well while in first instance program it go down .
How can i improve this problem ?

I think that Bass store something
Logged
gnag
Posts: 160


« Reply #8 on: 26 May '12 - 11:34 »
Reply with quoteQuote

I tested it again, if the Connection is down, it tries to restart Downloading as fast as possible, that means it runs at 100% CPU Usage trying to restart. You should fix this, its not a good behaviour to retry in fullspeed, its just a waste of CPU.

I could not reproduce your Problem, I removed your 20 Seconds Limit by making the following changes (commenting out the l.stop):

If cLength >= length Then
If l.IsActive Then
'l.Stop()
End If

After that I let it record for some minutes, disconnected my Internet then I got 100% CPU until I reconnected it,then it just started recording again without any Problems !
Logged
kio2008
Posts: 44


« Reply #9 on: 28 May '12 - 11:05 »
Reply with quoteQuote

I want say you this note :
If i load 20 internet radio, when i start from 1 to 20, on radio 18 i get "Server timeout", while if i stop all and i start only radio 18 it go well.
Also, when i stop all and i run "netstat -n" i see again some connection in this state time_wait.
Logged
gnag
Posts: 160


« Reply #10 on: 28 May '12 - 12:17 »
Reply with quoteQuote

Ok, can you post a Version with your 20 Stations so I can try this out ?
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines