Changeset 3c5efb42c886ba3350b8920279ee635c56d342ae

Show
Ignore:
Timestamp:
18/10/04 15:57:03 (4 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1098107823 +0000
git-parent:

[8628d18b3610b2e94b90b5e345a530223d5fc682]

git-author:
Gildas Bazin <gbazin@videolan.org> 1098107823 +0000
Message:

* src/audio_output/input.c, mixer.c: don't try to resample when the audio output is drifting too much.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/audio_output/input.c

    rd4ccb69 r3c5efb4  
    410410    } 
    411411 
     412    /* If the audio drift is too big then it's not worth trying to resample 
     413     * the audio. */ 
     414    if ( start_date != 0 && 
     415         ( start_date < p_buffer->start_date - 3 * AOUT_PTS_TOLERANCE ) ) 
     416    { 
     417        msg_Warn( p_aout, "audio drift is too big ("I64Fd"), clearing out", 
     418                  start_date - p_buffer->start_date ); 
     419        vlc_mutex_lock( &p_aout->input_fifos_lock ); 
     420        aout_FifoSet( p_aout, &p_input->fifo, 0 ); 
     421        p_input->p_first_byte_to_mix = NULL; 
     422        vlc_mutex_unlock( &p_aout->input_fifos_lock ); 
     423        if ( p_input->i_resampling_type != AOUT_RESAMPLING_NONE ) 
     424            msg_Warn( p_aout, "timing screwed, stopping resampling" ); 
     425        p_input->i_resampling_type = AOUT_RESAMPLING_NONE; 
     426        if ( p_input->i_nb_resamplers != 0 ) 
     427        { 
     428            p_input->pp_resamplers[0]->input.i_rate = p_input->input.i_rate; 
     429            p_input->pp_resamplers[0]->b_continuity = VLC_FALSE; 
     430        } 
     431        start_date = 0; 
     432    } 
     433    else if ( start_date != 0 && 
     434              ( start_date > p_buffer->start_date + 3 * AOUT_PTS_TOLERANCE ) ) 
     435    { 
     436        msg_Warn( p_aout, "audio drift is too big ("I64Fd"), dropping buffer", 
     437                  start_date - p_buffer->start_date ); 
     438        aout_BufferFree( p_buffer ); 
     439        return 0; 
     440    } 
     441 
    412442    if ( start_date == 0 ) start_date = p_buffer->start_date; 
    413443 
  • src/audio_output/mixer.c

    r9b52a80 r3c5efb4  
    275275                i_nb_bytes /= p_aout->mixer.mixer.i_bytes_per_frame; 
    276276                i_nb_bytes *= p_aout->mixer.mixer.i_bytes_per_frame; 
    277  
    278                 if( i_nb_bytes < 0 ) break; /* FIXME: reset state properly */ 
     277                if( i_nb_bytes < 0 ) 
     278                { 
     279                    /* Is it really the best way to do it ? */ 
     280                    aout_FifoSet( p_aout, &p_aout->output.fifo, 0 ); 
     281                    aout_DateSet( &exact_start_date, 0 ); 
     282                    break; 
     283                } 
    279284 
    280285                p_input->p_first_byte_to_mix = p_buffer->p_buffer + i_nb_bytes;