Re: [RFC PATCH] cplay: Always write frag * fragment_size

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

 



Hi Vinod,

Thanks a lot for having a look at this. Please check my comments inline:

<snip>
> > -     size = config.fragment_size;
> > -     buffer = malloc(size * config.fragments);
> > +     size = config.fragments * config.fragment_size;
> > +     buffer = malloc(size);
>
> net result of this change is no change. Leaving alone the variable names
> from this discussion, we allocate memory for size of config.fragments * config.fragment_size

Yes, you are right on this. There is no change here. But notice that we change
the value of size to config.fragments * config.fragment_size;

Now, please take a look at the inner loop at:

https://github.com/alsa-project/tinycompress/blob/master/src/utils/cplay.c#L382

num_read = fread(buffer, 1, size, file);

So, now instead of reading config.fragment_size we read
config.fragments * config.fragment_size
thus we fully utilize the buffer.

I'm pretty sure this is the correct fix. See also crecord fix from Charles:

http://git.alsa-project.org/?p=tinycompress.git;a=commit;h=e8e36567438c
16a5121943205a0cd8c63924d0d8

thanks,
daniel.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux