p_dec->fmt_out.audio.i_channels = p_header->channels;
p_dec->fmt_out.audio.i_rate = 48000;
- if( p_header->channels>2 )
+ if( p_header->channels>2 && p_header->channels<9 )
{
static const uint32_t *pi_ch[6] = { pi_3channels_in, pi_4channels_in,
pi_5channels_in, pi_6channels_in,
*pp_block = NULL; /* To avoid being fed the same packet again */
- {
- block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket,
- p_block->i_nb_samples,
- (int)p_block->i_length );
+ if( !p_block )
+ return NULL;
- block_Release( p_block );
- return p_aout_buffer;
- }
+ block_t *p_aout_buffer = DecodePacket( p_dec, p_oggpacket,
+ p_block->i_nb_samples,
+ (int)p_block->i_length );
+
+ block_Release( p_block );
+ return p_aout_buffer;
}
/*****************************************************************************
if(spp>0)spp*=opus_packet_get_samples_per_frame(p_oggpacket->packet,48000);
if(spp<120||spp>120*48)return NULL;
+ /* Since the information isn't always available at the demux level
+ * use the packet's sample number */
+ if(!i_nb_samples)
+ i_nb_samples = spp;
+
block_t *p_aout_buffer=decoder_NewAudioBuffer( p_dec, spp );
if ( !p_aout_buffer )
{
}
if( spp > i_nb_samples )
{
+ p_aout_buffer->i_buffer = (i_nb_samples - i_end_trim) *
+ p_sys->header.channels * sizeof(float);
memmove(p_aout_buffer->p_buffer,
p_aout_buffer->p_buffer
+ (spp - i_nb_samples)*p_sys->header.channels*sizeof(float),
- (i_nb_samples - i_end_trim)*p_sys->header.channels*sizeof(float));
+ p_aout_buffer->i_buffer);
}
i_nb_samples -= i_end_trim;