[vlc-commits] packetizer: flac: hint min frame size

Francois Cartegnie git at videolan.org
Fri Jan 10 15:31:36 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan 10 14:35:42 2014 +0100| [c54e1de618d0eebd2ade54da12f0f8571a47f488] | committer: Francois Cartegnie

packetizer: flac: hint min frame size

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c54e1de618d0eebd2ade54da12f0f8571a47f488
---

 modules/packetizer/flac.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
index 3fe9bf4..a91afbf 100644
--- a/modules/packetizer/flac.c
+++ b/modules/packetizer/flac.c
@@ -56,6 +56,7 @@ vlc_module_end()
  * decoder_sys_t : FLAC decoder descriptor
  *****************************************************************************/
 #define MAX_FLAC_HEADER_SIZE 16
+#define MIN_FLAC_FRAME_SIZE ((48+(8 + 4 + 1*4)+16)/8)
 struct decoder_sys_t
 {
     /*
@@ -141,6 +142,8 @@ static void ProcessHeader(decoder_t *p_dec)
                 __MAX( __MIN( p_sys->stream_info.max_blocksize, 65535 ), 16 );
 
     p_sys->stream_info.min_framesize = bs_read(&bs, 24);
+    p_sys->stream_info.min_framesize =
+            __MAX( p_sys->stream_info.min_framesize, MIN_FLAC_FRAME_SIZE );
     p_sys->stream_info.max_framesize = bs_read(&bs, 24);
 
     p_sys->stream_info.sample_rate = bs_read(&bs, 20);
@@ -584,8 +587,8 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
             p_dec->fmt_out.audio.i_rate = p_sys->i_rate;
         }
         p_sys->i_state = STATE_NEXT_SYNC;
-        p_sys->i_frame_size = p_sys->b_stream_info && p_sys->stream_info.min_framesize > 0 ?
-                                                        p_sys->stream_info.min_framesize : 1;
+        p_sys->i_frame_size = ( p_sys->b_stream_info ) ? p_sys->stream_info.min_framesize :
+                                                         MIN_FLAC_FRAME_SIZE;
 
         /* We have to read until next frame sync code to compute current frame size
          * from that boundary.



More information about the vlc-commits mailing list