Commit 5b77cf77 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Paul Saman

Prevent change of audio channels number when mp4a is used and the mixers put 2...

Prevent change of audio channels number when mp4a is used and the mixers put 2 channels out. This is a hack and should be solved in a better way.
parent 9ee6e411
......@@ -38,7 +38,7 @@
#include <vlc_filter.h>
#include <vlc_osd.h>
#define MASTER_SYNC_MAX_DRIFT 100000
#define MASTER_SYNC_MAX_DRIFT (mtime_t)100000
/*****************************************************************************
* Module descriptor
......@@ -473,7 +473,7 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC;
}
p_sys->i_master_drift = 0;
p_sys->i_master_drift = (mtime_t)0;
sout_CfgParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
p_stream->p_cfg );
......@@ -1428,7 +1428,8 @@ static int transcode_audio_new( sout_stream_t *p_stream,
break;
}
if( fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels )
if( ( id->p_decoder->fmt_in.i_codec == VLC_FOURCC('m','p','4','a') ) &&
( fmt_last.audio.i_channels != id->p_encoder->fmt_in.audio.i_channels ) )
{
#if 1
module_Unneed( id->p_encoder, id->p_encoder->p_module );
......@@ -1538,13 +1539,13 @@ static int transcode_audio_process( sout_stream_t *p_stream,
1, NULL );
if( p_sys->b_master_sync )
{
mtime_t i_dts = date_Get( &id->interpolated_pts ) + 1;
if ( p_audio_buf->start_date - i_dts > MASTER_SYNC_MAX_DRIFT
|| p_audio_buf->start_date - i_dts < -MASTER_SYNC_MAX_DRIFT )
mtime_t i_dts = date_Get( &id->interpolated_pts ) + (mtime_t)1;
if ( (p_audio_buf->start_date - i_dts > MASTER_SYNC_MAX_DRIFT) ||
(p_audio_buf->start_date - i_dts < -MASTER_SYNC_MAX_DRIFT) )
{
msg_Dbg( p_stream, "drift is too high, resetting master sync" );
date_Set( &id->interpolated_pts, p_audio_buf->start_date );
i_dts = p_audio_buf->start_date + 1;
i_dts = p_audio_buf->start_date + (mtime_t)1;
}
p_sys->i_master_drift = p_audio_buf->start_date - i_dts;
date_Increment( &id->interpolated_pts, p_audio_buf->i_nb_samples );
......@@ -2119,17 +2120,17 @@ static int transcode_video_process( sout_stream_t *p_stream,
while( (p_pic = id->p_decoder->pf_decode_video( id->p_decoder, &in )) )
{
subpicture_t *p_subpic = 0;
subpicture_t *p_subpic = NULL;
stats_UpdateInteger( p_stream->p_parent->p_parent, STATS_DECODED_VIDEO,
1, NULL );
if( p_stream->p_sout->i_out_pace_nocontrol && p_sys->b_hurry_up )
{
mtime_t current_date = mdate();
if( current_date + 50000 > p_pic->date )
if( (current_date + (mtime_t)50000) > p_pic->date )
{
msg_Dbg( p_stream, "late picture skipped ("I64Fd")",
current_date + 50000 - p_pic->date );
(current_date + (mtime_t)50000) - p_pic->date );
p_pic->pf_release( p_pic );
continue;
}
......@@ -2142,8 +2143,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
mtime_t i_pts;
i_pts = date_Get( &id->interpolated_pts ) + 1;
if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT
|| p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT )
if( (p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT) ||
(p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT) )
{
msg_Dbg( p_stream, "drift is too high, resetting master sync" );
date_Set( &id->interpolated_pts, p_pic->date );
......@@ -2155,7 +2156,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
/* Set the pts of the frame being encoded */
p_pic->date = i_pts;
if( i_video_drift < i_master_drift - 50000 )
if( i_video_drift < (i_master_drift - (mtime_t)50000) )
{
#if 0
msg_Dbg( p_stream, "dropping frame (%i)",
......@@ -2164,7 +2165,7 @@ static int transcode_video_process( sout_stream_t *p_stream,
p_pic->pf_release( p_pic );
continue;
}
else if( i_video_drift > i_master_drift + 50000 )
else if( i_video_drift > (i_master_drift + (mtime_t)50000) )
{
#if 0
msg_Dbg( p_stream, "adding frame (%i)",
......@@ -2206,11 +2207,20 @@ static int transcode_video_process( sout_stream_t *p_stream,
{
id->pp_filter[id->i_filter]->p_owner =
malloc( sizeof(filter_owner_sys_t) );
for( i = 0; i < PICTURE_RING_SIZE; i++ )
id->pp_filter[id->i_filter]->p_owner->pp_pics[i] = 0;
id->pp_filter[id->i_filter]->p_owner->p_sys = p_sys;
id->i_filter++;
if( id->pp_filter[id->i_filter]->p_owner )
{
for( i = 0; i < PICTURE_RING_SIZE; i++ )
id->pp_filter[id->i_filter]->p_owner->pp_pics[i] = 0;
id->pp_filter[id->i_filter]->p_owner->p_sys = p_sys;
id->i_filter++;
}
else
{
msg_Dbg( p_stream, "no video filter found" );
vlc_object_detach( id->pp_filter[id->i_filter] );
vlc_object_destroy( id->pp_filter[id->i_filter] );
}
}
else
{
......@@ -2389,8 +2399,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
if( p_sys->b_master_sync )
{
mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1;
if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT
|| p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT )
if( (p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT) ||
(p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT) )
{
msg_Dbg( p_stream, "drift is too high, resetting master sync" );
date_Set( &id->interpolated_pts, p_pic->date );
......@@ -2402,8 +2412,8 @@ static int transcode_video_process( sout_stream_t *p_stream,
if( p_sys->b_master_sync && i_duplicate > 1 )
{
mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1;
if ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT
|| p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT )
if( (p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT) ||
(p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT) )
{
msg_Dbg( p_stream, "drift is too high, resetting master sync" );
date_Set( &id->interpolated_pts, p_pic->date );
......
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