GNOME Bugzilla – Bug 753490
audioecho: reallocate buffer on changing max_delay
Last modified: 2015-08-16 13:38:34 UTC
self->buffer size is depend on the max_delay property. Buffer is not reallocated on changing max_delay property. Reallocate buffer if max_delay property is increased.
Created attachment 309040 [details] [review] audioecho: buffer reallocated on changing max_delay property please review this patch
Comment on attachment 309040 [details] [review] audioecho: buffer reallocated on changing max_delay property Thanks, makes sense. Minor style issue: I think you should just free the buffer unconditionally here so that it always gets re-allocated with the new size. The value of max_delay might also change in PROP_DELAY, so I think we should probably free the buffer there as well.
Created attachment 309239 [details] [review] audioecho: patch to free buffer unconditionally Thanks for the review. I kept it conditionally to avoid possible reallocations if max_delay is less than the old value. Also in PROP_DELAY case, max_delay value in else block will change only if element is in NULL state or READY state. In this case the buffer is already NULL so no need to do anything. To minimize the memory usage your suggestion to free the buffer unconditionally is right :-) I will attach another patch as per your review comments. I will keep the older patch as it is; in case you want to go with the conditional approach to avoid reallocation. Please review it.
commit 0671ea85aff793df6cb7fd16ad26fad24501dc69 Author: Prashant Gotarne <ps.gotarne@samsung.com> Date: Fri Aug 14 09:36:09 2015 +0530 audioecho: make sure buffer gets reallocated if max_delay changes https://bugzilla.gnome.org/show_bug.cgi?id=753490