Commit c05cbdf5 authored by Christophe Massiot's avatar Christophe Massiot

* modules/access_output/udp.c: When using --udp-group, do not send two PCRs

  at once. This requires the export of the PCR block_flag.
parent 074d01d6
......@@ -60,8 +60,14 @@ typedef struct block_sys_t block_sys_t;
#define BLOCK_FLAG_HEADER 0x0020
/** This is the last block of the frame */
#define BLOCK_FLAG_END_OF_FRAME 0x0040
/** No keyframes present */
/** This is not a key frame for bitrate shaping */
#define BLOCK_FLAG_NO_KEYFRAME 0x0080
/** This is the last block of the GOP */
#define BLOCK_FLAG_END_OF_GOP 0x0100
/** This block contains a clock reference */
#define BLOCK_FLAG_CLOCK 0x0200
/** This block is scrambled */
#define BLOCK_FLAG_SCRAMBLED 0x0400
#define BLOCK_FLAG_PRIVATE_MASK 0xffff0000
#define BLOCK_FLAG_PRIVATE_SHIFT 16
......
......@@ -382,6 +382,8 @@ static int Write( sout_access_out_t *p_access, block_t *p_buffer )
p_sys->p_buffer->i_buffer += i_write;
p_buffer->p_buffer += i_write;
p_buffer->i_buffer -= i_write;
if ( p_buffer->i_flags & BLOCK_FLAG_CLOCK )
p_sys->p_buffer->i_flags |= BLOCK_FLAG_CLOCK;
if( p_sys->p_buffer->i_buffer == p_sys->i_mtu || i_packets > 1 )
{
......@@ -491,7 +493,7 @@ static void ThreadWrite( vlc_object_t *p_this )
i_dropped_packets++;
continue;
}
else if( i_date - i_date_last < 0 )
else if( i_date - i_date_last < -15000 )
{
if( !i_dropped_packets )
msg_Dbg( p_thread, "mmh, packets in the past ("I64Fd")"
......@@ -519,7 +521,7 @@ static void ThreadWrite( vlc_object_t *p_this )
}
i_to_send--;
if ( !i_to_send )
if ( !i_to_send || (p_pk->i_flags & BLOCK_FLAG_CLOCK) )
{
mwait( i_date );
i_to_send = p_thread->i_group;
......@@ -532,7 +534,7 @@ static void ThreadWrite( vlc_object_t *p_this )
i_dropped_packets = 0;
}
#if 0
#if 1
i_sent = mdate();
if ( i_sent > i_date + 20000 )
{
......
......@@ -176,8 +176,6 @@ static const char *ppsz_sout_options[] = {
NULL
};
#define SOUT_BUFFER_FLAGS_PRIVATE_PCR ( 1 << BLOCK_FLAG_PRIVATE_SHIFT )
#define SOUT_BUFFER_FLAGS_PRIVATE_CSA ( 2 << BLOCK_FLAG_PRIVATE_SHIFT )
typedef struct
{
int i_depth;
......@@ -1258,7 +1256,7 @@ static int Mux( sout_mux_t *p_mux )
if( p_sys->csa != NULL &&
(p_input->p_fmt->i_cat != AUDIO_ES || p_sys->b_crypt_audio) )
{
p_ts->i_flags |= SOUT_BUFFER_FLAGS_PRIVATE_CSA;
p_ts->i_flags |= BLOCK_FLAG_SCRAMBLED;
}
i_packet_pos++;
......@@ -1376,12 +1374,12 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
p_ts->i_dts = i_new_dts;
p_ts->i_length = i_pcr_length / i_packet_count;
if( p_ts->i_flags & SOUT_BUFFER_FLAGS_PRIVATE_PCR )
if( p_ts->i_flags & BLOCK_FLAG_CLOCK )
{
/* msg_Dbg( p_mux, "pcr=%lld ms", p_ts->i_dts / 1000 ); */
TSSetPCR( p_ts, p_ts->i_dts - p_sys->i_dts_delay );
}
if( p_ts->i_flags & SOUT_BUFFER_FLAGS_PRIVATE_CSA )
if( p_ts->i_flags & BLOCK_FLAG_SCRAMBLED )
{
csa_Encrypt( p_sys->csa, p_ts->p_buffer, 0 );
}
......@@ -1437,7 +1435,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
{
int i_stuffing = i_payload_max - i_payload;
p_ts->i_flags |= SOUT_BUFFER_FLAGS_PRIVATE_PCR;
p_ts->i_flags |= BLOCK_FLAG_CLOCK;
p_ts->p_buffer[4] = 7 + i_stuffing;
p_ts->p_buffer[5] = 0x10; /* flags */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment