High availability for dvb streaming

Feature requests for VLC.
aln
Blank Cone
Blank Cone
Posts: 13
Joined: 05 Jan 2005 17:58

High availability for dvb streaming

Postby aln » 17 Oct 2005 18:36

Hi,

I have a system that is multicasting from dvb-t and dvb-s inputs non-stop, and it happens that once in a while, there are errors in the input (specially on bad weather). VLC then stops streaming (more often, audio is lost) and cannot recover by itself, requiring a manual (well, I've managed to semi-automate it) restart.

My idea was to add some monitoring functions that would restart streaming in the event of a problem. Even more, it could stream from an alternate source (i.e. a file) if signal quality falls below a given level.

I'd be willing to code such a feature, better if someone points me in the right direction. So far, I've got to the code that reads from DVB inputs, but I guess it would be more elegant to "intercept" at the TS processing level.

Any ideas?
Last edited by aln on 18 Oct 2005 18:10, edited 1 time in total.

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Postby The DJ » 18 Oct 2005 14:20

No should do this at the DVB level. It's the DVD module in VLC that stops feeding data to the core most likely. We welcome such additions.
Don't use PMs for support questions.

MariaMaggio
Blank Cone
Blank Cone
Posts: 39
Joined: 06 Jun 2005 16:39

Postby MariaMaggio » 19 Oct 2005 16:43

Hello aln,
please can you explailn me how to stream a DVB video in a multicast enviroment.
Using Vlc I succeed to stream file in multicast but not Dvb video.
I compiled vlc with --enable-dvb and --enable-v4l options and J followed http://www.videolan.org/doc/streaming-h ... /ch09.html guide.

This is the problem using

vlc -vvv --color --ttl 12 --ts-es-id-pid --programs=8508,8505 dvb --dvb-frequency=11739000 --dvb-srate=27500000 --dvb-voltage=13 --sout-standard-access=udp --sout-standard-mux=ts --sout
'#duplicate{dst=std{url=10.0.0.8},select="program=8508",dst=std{url=10.0.0.9},select="program=8505"}'

The output is

VLC media player 0.8.2 Janus
vlc: unknown option or missing mandatory argument `--dvb-frequency=11739000'
Try `vlc --help' for more information

Can you help me?

dfraga
Blank Cone
Blank Cone
Posts: 10
Joined: 27 Jun 2007 23:12

Re: High availability for dvb streaming

Postby dfraga » 06 Dec 2007 21:51

Is there a solution for this? It's very annoying when DVB signal is lost and VLC stops streaming... When DVB signal comes back, VLC will keep stalled :(

aln
Blank Cone
Blank Cone
Posts: 13
Joined: 05 Jan 2005 17:58

Re: High availability for dvb streaming

Postby aln » 12 Dec 2007 16:02

In fact, I'm working now on a solution. I'm modifying the DVB access module so that it will monitor the average bitrate from the DVB input, and if it falls below a certain threshold, it will repeat the last block read and try to retune the frontend every few minutes (but not continuosly, as it might happen that the signal has gone for good)...

I will post here the patch if I manage to get it working ...

dfraga
Blank Cone
Blank Cone
Posts: 10
Joined: 27 Jun 2007 23:12

Re: High availability for dvb streaming

Postby dfraga » 05 Dec 2008 08:30

In fact, I'm working now on a solution. I'm modifying the DVB access module so that it will monitor the average bitrate from the DVB input, and if it falls below a certain threshold, it will repeat the last block read and try to retune the frontend every few minutes (but not continuosly, as it might happen that the signal has gone for good)...

I will post here the patch if I manage to get it working ...
Hi aln. Did you create the patch? I'm using version 0.9.6 and it seems to have the same problem.

Thanks.

aln
Blank Cone
Blank Cone
Posts: 13
Joined: 05 Jan 2005 17:58

Re: High availability for dvb streaming

Postby aln » 05 Dec 2008 09:06

Yes, I'm attaching here the patch. It's against 0.8.6a, but I think the source files have not changed significantly, so porting to 0.9.6 should be easy. That's one of the items in my TODO list...

In the testing I've done, the patch has been quite effective. A good improvement I'm after would be to display at least a blue screen when there is no input signal, but that would require faking a DVB stream with the same PIDS, which should be done at the demux level. In the present version, it just keeps repeating the last block received, and that's not very good for the demux module, but it somehow works.

Code: Select all

diff -ru -x '*in' -x '*config*' -x '*m4' -x '*sh' -x compile vlc-0.8.6a-orig/modules/access/dvb/access.c vlc-0.8.6a/modules/access/dvb/access.c --- vlc-0.8.6a-orig/modules/access/dvb/access.c 2007-01-03 19:27:58.000000000 +0100 +++ vlc-0.8.6a/modules/access/dvb/access.c 2007-12-13 16:13:34.000000000 +0100 @@ -272,6 +272,8 @@ #define DVB_READ_ONCE 20 #define DVB_READ_ONCE_START 2 +#define DVB_BR_CHECK_INTERVAL 15E6 +#define DVB_MIN_BITRATE 9E6 #define TS_PACKET_SIZE 188 static void FilterUnset( access_t *, int i_max ); @@ -362,6 +364,10 @@ else p_sys->i_read_once = DVB_READ_ONCE_START; + p_sys->i_br_interval_start = mdate(); + p_sys->p_saved_block = block_New( p_access, + DVB_READ_ONCE * TS_PACKET_SIZE ); + #ifdef ENABLE_HTTPD E_(HTTPOpen)( p_access ); #endif @@ -387,6 +393,7 @@ E_(HTTPClose)( p_access ); #endif + block_Release( p_sys->p_saved_block ); free( p_sys ); } @@ -474,10 +481,11 @@ E_(FrontendSet)( p_access ); } + p_block = block_New( p_access, + p_sys->i_read_once * TS_PACKET_SIZE ); + if ( ufds[0].revents ) { - p_block = block_New( p_access, - p_sys->i_read_once * TS_PACKET_SIZE ); if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer, p_sys->i_read_once * TS_PACKET_SIZE ) ) <= 0 ) { @@ -485,8 +493,40 @@ block_Release( p_block ); continue; } + else + { + + if ( mdate() - p_sys->i_br_interval_start > DVB_BR_CHECK_INTERVAL ) + { + if ( p_sys->i_bitrate < DVB_MIN_BITRATE ) + { + msg_Warn( p_access, "low bitrate in adapter %d, tuning again", + var_GetInteger( p_access, "dvb-adapter" ) ); + E_(FrontendSet)( p_access ); + } + + memcpy( p_sys->p_saved_block->p_buffer, p_block->p_buffer, + p_sys->i_read_once * TS_PACKET_SIZE ); + + msg_Dbg( p_access, "adapter %d bitrate: %ld Mb/s", + var_GetInteger ( p_access, "dvb-adapter"), p_sys->i_bitrate / ( 1024*1024 ) ); + p_sys->i_br_interval_start = mdate(); + p_sys->i_bitcount = 0; + } + else + { + p_sys->i_bitcount += p_block->i_buffer * 8; + p_sys->i_bitrate = p_sys->i_bitcount * 1E6 / + ( mdate() - p_sys->i_br_interval_start ); + } + } break; } + else + { + memcpy( p_block->p_buffer, p_sys->p_saved_block->p_buffer, + p_sys->i_read_once * TS_PACKET_SIZE ); + } } if( p_sys->i_read_once < DVB_READ_ONCE ) diff -ru -x '*in' -x '*config*' -x '*m4' -x '*sh' -x compile vlc-0.8.6a-orig/modules/access/dvb/dvb.h vlc-0.8.6a/modules/access/dvb/dvb.h --- vlc-0.8.6a-orig/modules/access/dvb/dvb.h 2007-01-03 19:27:58.000000000 +0100 +++ vlc-0.8.6a/modules/access/dvb/dvb.h 2007-12-13 13:32:54.000000000 +0100 @@ -143,6 +143,12 @@ demux_handle_t p_demux_handles[MAX_DEMUX]; frontend_t *p_frontend; vlc_bool_t b_budget_mode; + mtime_t i_br_interval_start; + long int i_bitcount, i_bitrate; + short int i_count; + block_t *p_saved_block; + + /* CA management */ int i_ca_handle;

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: High availability for dvb streaming

Postby Jean-Baptiste Kempf » 05 Dec 2008 11:14

Yes, I'm attaching here the patch. It's against 0.8.6a, but I think the source files have not changed significantly, so porting to 0.9.6 should be easy. That's one of the items in my TODO list...

In the testing I've done, the patch has been quite effective. A good improvement I'm after would be to display at least a blue screen when there is no input signal, but that would require faking a DVB stream with the same PIDS, which should be done at the demux level. In the present version, it just keeps repeating the last block received, and that's not very good for the demux module, but it somehow works.

Code: Select all

diff -ru -x '*in' -x '*config*' -x '*m4' -x '*sh' -x compile vlc-0.8.6a-orig/modules/access/dvb/access.c vlc-0.8.6a/modules/access/dvb/access.c --- vlc-0.8.6a-orig/modules/access/dvb/access.c 2007-01-03 19:27:58.000000000 +0100 +++ vlc-0.8.6a/modules/access/dvb/access.c 2007-12-13 16:13:34.000000000 +0100 @@ -272,6 +272,8 @@ #define DVB_READ_ONCE 20 #define DVB_READ_ONCE_START 2 +#define DVB_BR_CHECK_INTERVAL 15E6 +#define DVB_MIN_BITRATE 9E6 #define TS_PACKET_SIZE 188 static void FilterUnset( access_t *, int i_max ); @@ -362,6 +364,10 @@ else p_sys->i_read_once = DVB_READ_ONCE_START; + p_sys->i_br_interval_start = mdate(); + p_sys->p_saved_block = block_New( p_access, + DVB_READ_ONCE * TS_PACKET_SIZE ); + #ifdef ENABLE_HTTPD E_(HTTPOpen)( p_access ); #endif @@ -387,6 +393,7 @@ E_(HTTPClose)( p_access ); #endif + block_Release( p_sys->p_saved_block ); free( p_sys ); } @@ -474,10 +481,11 @@ E_(FrontendSet)( p_access ); } + p_block = block_New( p_access, + p_sys->i_read_once * TS_PACKET_SIZE ); + if ( ufds[0].revents ) { - p_block = block_New( p_access, - p_sys->i_read_once * TS_PACKET_SIZE ); if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer, p_sys->i_read_once * TS_PACKET_SIZE ) ) <= 0 ) { @@ -485,8 +493,40 @@ block_Release( p_block ); continue; } + else + { + + if ( mdate() - p_sys->i_br_interval_start > DVB_BR_CHECK_INTERVAL ) + { + if ( p_sys->i_bitrate < DVB_MIN_BITRATE ) + { + msg_Warn( p_access, "low bitrate in adapter %d, tuning again", + var_GetInteger( p_access, "dvb-adapter" ) ); + E_(FrontendSet)( p_access ); + } + + memcpy( p_sys->p_saved_block->p_buffer, p_block->p_buffer, + p_sys->i_read_once * TS_PACKET_SIZE ); + + msg_Dbg( p_access, "adapter %d bitrate: %ld Mb/s", + var_GetInteger ( p_access, "dvb-adapter"), p_sys->i_bitrate / ( 1024*1024 ) ); + p_sys->i_br_interval_start = mdate(); + p_sys->i_bitcount = 0; + } + else + { + p_sys->i_bitcount += p_block->i_buffer * 8; + p_sys->i_bitrate = p_sys->i_bitcount * 1E6 / + ( mdate() - p_sys->i_br_interval_start ); + } + } break; } + else + { + memcpy( p_block->p_buffer, p_sys->p_saved_block->p_buffer, + p_sys->i_read_once * TS_PACKET_SIZE ); + } } if( p_sys->i_read_once < DVB_READ_ONCE ) diff -ru -x '*in' -x '*config*' -x '*m4' -x '*sh' -x compile vlc-0.8.6a-orig/modules/access/dvb/dvb.h vlc-0.8.6a/modules/access/dvb/dvb.h --- vlc-0.8.6a-orig/modules/access/dvb/dvb.h 2007-01-03 19:27:58.000000000 +0100 +++ vlc-0.8.6a/modules/access/dvb/dvb.h 2007-12-13 13:32:54.000000000 +0100 @@ -143,6 +143,12 @@ demux_handle_t p_demux_handles[MAX_DEMUX]; frontend_t *p_frontend; vlc_bool_t b_budget_mode; + mtime_t i_br_interval_start; + long int i_bitcount, i_bitrate; + short int i_count; + block_t *p_saved_block; + + /* CA management */ int i_ca_handle;
What is that exactly doing? Is it near the new feature of 1.0 to add a dvb-signal level on the interface?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

dfraga
Blank Cone
Blank Cone
Posts: 10
Joined: 27 Jun 2007 23:12

Re: High availability for dvb streaming

Postby dfraga » 05 Dec 2008 14:15

Yes, I'm attaching here the patch. It's against 0.8.6a, but I think the source files have not changed significantly, so porting to 0.9.6 should be easy. That's one of the items in my TODO list...
Ok. I tried to patch against 0.9.6 and it gave me the following:

Code: Select all

patch: **** malformed patch at line 5: #define DVB_READ_ONCE 20
Maybe it's trivial do fix?


Return to “VLC media player Feature Requests”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 8 guests