19 May '13 - 09: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: RTP Multicast in C#  (Read 975 times)
ken
Posts: 630


« on: 25 Jun '12 - 15:31 »
Reply with quoteQuote

Hi,

I found this great article, with RTP multicast streamer and player in C#  http://www.codeproject.com/Tips/394890/Play-Record-Repeat-Sound-and-Send-Receive-as-Multi

I tried to use the "data" part and use BASS as sound engine instead of WMM API.

The player works pretty good with just using "Bass.BASS_StreamPutData" on a "Bass.BASS_StreamCreatePush" channel.  But the "streamer" I try to use "Bass.BASS_ChannelGetData" in a while loop, but it seams that I get the data to quick.

Hope any one else would play with this code and come up with something good.

/Ken
« Last Edit: 25 Jun '12 - 15:41 by ken » Logged
gnag
Posts: 160


« Reply #1 on: 25 Jun '12 - 21:43 »
Reply with quoteQuote

Don't use Bass.BASS_ChannelGetData in a loop, this will just cause 100 % CPU (1 Core on Multicore), make your Programs Thread Block, make it slow and waste CPU time.

Just imagine you have a leak in a Tank and to stop the leaking fluid you don't put a Bucket underneath it to catch the Drops, you currently try to move the Backet as fast as possible under the Leak to catch any fluid which flows out of it ...

You should use Callbacks instead of calling Bass.BASS_ChannelGetData in a loop, a Recording Callback for example gets called whenever new data "arrived" from the recording channel (Microphone Input for example). Take a look at the Docs to see how to use (Recording) Callbacks and post back if you have troubles applying it.
Logged
ken
Posts: 630


« Reply #2 on: 26 Jun '12 - 09:43 »
Reply with quoteQuote

Don't use Bass.BASS_ChannelGetData in a loop, this will just cause 100 % CPU (1 Core on Multicore), make your Programs Thread Block, make it slow and waste CPU time.

Just imagine you have a leak in a Tank and to stop the leaking fluid you don't put a Bucket underneath it to catch the Drops, you currently try to move the Backet as fast as possible under the Leak to catch any fluid which flows out of it ...

You should use Callbacks instead of calling Bass.BASS_ChannelGetData in a loop, a Recording Callback for example gets called whenever new data "arrived" from the recording channel (Microphone Input for example). Take a look at the Docs to see how to use (Recording) Callbacks and post back if you have troubles applying it.

Thanks a million, using Recording Callback works great!

/Ken
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines