bytes_per_frame, samples_per_frame, bits_per_sample

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

 



Hi Thomas,

Bug report always catches our attention more, so don't worry :) And
actually, this bug has been fixed locally few days ago, just got other
things to do lately so the follow ups (creating ticket, testing the
fix, etc) got delayed.

Anyway, just created ticket #1114 along with the fix. Thanks for such
detail report and also the proposed fix.

BR,
nanang


On Tue, Aug 24, 2010 at 3:32 PM, Thomas Giesel <skoe at directbox.com> wrote:
> All,
>
> There was no answer to my previous post, but I want to let you know that following
> change in stream.c fixed the issue.
>
> old:
> ? ?/*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;
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 8 / 1000;
> new:
> ? ?stream->port.info.bytes_per_frame = stream->port.info.samples_per_frame *
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? stream->port.info.bits_per_sample / 8;
>
> With the old implementation when I connected the stream to a resample_port
> there was a crash because the
> bytes_per_frame/samples_per_frame/bits_per_frame didn't match.
>
> Thomas
>
> -------- directBOX Reply ---------------
> From: skoe@xxxxxxxxxxxxx
> To ?: pjsip at lists.pjsip.org
> Date: 11.08.2010 14:39:18
>
> 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
>
>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>



[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