Actually i am creating a media server kind of application which can consume 2-3 types of media data(Video/audio) from various media sources. And, say i have one particular video source of say RTSP streaming type, now i have to deliver this incoming media data to any number of clients at same time. These clients may request this data in other formats also(Format in which they are comfortable). So, in my application i have to get this media data from this native media source and convert it to requested media format and deliver to respective clients. Also consider scenario when i hav one type of media input and i am converting it to 2-3 different formats and delivering it to respective clients(I am ok with little bit of trans-coding delay), and all this i have to do parellely.
Currently what i thought that first i will convert incoming data to Raw format and then convert this raw data to other requested formats in parallel.
Now this case is just for one media input, similarly i may have hundreds of media inputs delivering this respective media to hundreds of client in their requested format.
Hope my scenario is clear :)
Now, as i saw few vidoes and blog post talking about ActionBlock and TransformBlock working together for solving kind of same problem as of mine, i thought of using the same.
May be like, i will get the media data from source, i will convert it to Raw data from the input format, now i will post this data to an ActionBlock, from there i will consume this raw data in other TransformBlock for converting this raw data to requested format.
But i am not sure that ActionBlock and TransformBlock can serve my need as it will be very long running(as clients will continue to consume media data as long as they want) and CPU intensive process what i am planning to put in TransformBlock. Also there will be hundreds of process of this kind for media conversion depending on numbers of media inputs and depending on requested media formats.
Any help will be highly appreciable. Please Reply if still you are not clear with my problem or need some additional information.
Thanks, Viresh Singh
It's fine to use TPL Dataflow for compute-intensive operations. It's useful when you have a pipeline, as it sounds like you do, where you may not be able to parallelize the processing of a particular stage, but where you can process stage 1 for block N while processing stage 2 on the output of stage 1's block N-1.