]> git.sesse.net Git - vlc/commitdiff
flac: reset decoder on end of stream (fixes #9298)
authorTristan Matthews <tmatth@videolan.org>
Tue, 30 Sep 2014 01:05:23 +0000 (21:05 -0400)
committerTristan Matthews <tmatth@videolan.org>
Tue, 30 Sep 2014 01:05:23 +0000 (21:05 -0400)
modules/codec/flac.c

index f2e3cda3b5f63c21ed0b8a90cfd95d85c91202ae..32ae7fb066e30758f269985a331056c7ea23ca95 100644 (file)
@@ -526,10 +526,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
     /* If the decoder is in the "aborted" state,
      * FLAC__stream_decoder_process_single() won't return an error. */
-    if( FLAC__stream_decoder_get_state(p_dec->p_sys->p_flac)
-        == FLAC__STREAM_DECODER_ABORTED )
+    switch ( FLAC__stream_decoder_get_state(p_dec->p_sys->p_flac) )
     {
-        FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+        case FLAC__STREAM_DECODER_ABORTED:
+            FLAC__stream_decoder_flush( p_dec->p_sys->p_flac );
+            break;
+        case FLAC__STREAM_DECODER_END_OF_STREAM:
+            FLAC__stream_decoder_reset( p_dec->p_sys->p_flac );
+            break;
+        default:
+            break;
     }
 
     block_Release( p_sys->p_block );