vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Thu Feb 1 18:56:25 2018 +0100| [eae265ed8dc5240f1ccfc292c33ce70e918b863c] | committer: Francois Cartegnie
demux: caf: handle Opus (fix #19544) Apple's undocumented framing. There's no external framing to figure limits. The opus decoder will never read the full packet, containing up to CLOCK_FREQ/20 of samples/frames. We must enforce sending single frames. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eae265ed8dc5240f1ccfc292c33ce70e918b863c --- modules/demux/caf.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/demux/caf.c b/modules/demux/caf.c index 6477452adc..8273efcca2 100644 --- a/modules/demux/caf.c +++ b/modules/demux/caf.c @@ -83,6 +83,7 @@ struct demux_sys_t { es_format_t fmt; es_out_id_t *es; + unsigned i_max_frames; uint64_t i_data_offset; uint64_t i_data_size; @@ -512,6 +513,12 @@ static int ReadDescChunk( demux_t *p_demux ) p_sys->fmt.audio.i_blockalign = i_bytes_per_packet; p_sys->fmt.i_bitrate = i_bits_per_channel * p_sys->fmt.audio.i_rate * i_channels_per_frame; + if( p_sys->fmt.i_codec == VLC_CODEC_OPUS ) + { + p_sys->i_max_frames = 1; + } + else p_sys->i_max_frames = UINT_MAX; + return VLC_SUCCESS; } @@ -951,12 +958,21 @@ static int Demux( demux_t *p_demux ) } else /* use packet table */ { + uint64_t i_max_frames; + if( p_sys->packet_table.i_num_packets > p_sys->position.i_frames ) + i_max_frames = p_sys->packet_table.i_num_packets - p_sys->position.i_frames; + else + i_max_frames = 1; /* will be rejected on FrameSpanAddDescription below */ + + if( i_max_frames > p_sys->i_max_frames ) + i_max_frames = p_sys->i_max_frames; + do { if( FrameSpanAddDescription( p_demux, p_sys->position.i_desc_bytes + advance.i_desc_bytes, &advance )) break; } - while (( i_req_samples > advance.i_samples ) && ( p_sys->position.i_frames + advance.i_frames ) < p_sys->packet_table.i_num_packets ); + while ( i_req_samples > advance.i_samples && advance.i_frames < i_max_frames ); } if( !advance.i_frames ) _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits