bytes_per_frame, samples_per_frame, bits_per_sample

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm a bit confused about the relationship of the port info attributes
bytes_per_frame, samples_per_frame and bits_per_sample.

I assumed that 
bytes_per_frame = samples_per_frame * bits_per_sample / 8

But at the moment I'm tracking down an issue and stumbled about these
lines in pjmedia_stream_create():
    
    /* Set additional info and callbacks. */
    stream->port.info.bits_per_sample = 16;
    stream->port.info.samples_per_frame = info->fmt.clock_rate * 
                                          stream->codec_param.info.channel_cnt *
                                          stream->codec_param.info.frm_ptime *
                                          stream->codec_param.setting.frm_per_pkt /
                                          1000;
    stream->port.info.bytes_per_frame = stream->codec_param.info.max_bps * 
                                        stream->codec_param.info.frm_ptime *
                                        stream->codec_param.setting.frm_per_pkt /
                                        8 / 1000;

with PCMU I get: 
clock_rate = 8000, channel_cnt = 1, frm_ptime = 10, frm_per_pkt = 2, max_bps = 64000
=> samples_per_frame = 160
=> bytes_per_frame = 160

This violates the assumption above. Is this sane? 
Shouldn't be the port.info independent from the bitrate of the codec?

Regards,
Thomas




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux