njh / twolame

MPEG Audio Layer 2 (MP2) encoder
http://www.twolame.org/
GNU Lesser General Public License v2.1
59 stars 34 forks source link

Exact frame size #60

Closed eblanca closed 6 years ago

eblanca commented 7 years ago

When enabling padding for a bitstream, the code wrongly returns any frame size as padded. Now this is fixed.

njh commented 6 years ago

Is there a way that this can be tested?

eblanca commented 6 years ago

No, there isn't. Unless modifying the frontend code for printing out the size of any frame it creates (for a given talkactivity) and then using an external tool for comparison. The point is, actually this function is not used.

eblanca commented 6 years ago

Try applying this patch to the master branch (it is a debug statement, absolutely useless). It will print a warning whenever a mismatch is detected between the size of the frame twolame creates and the calculated size (just encode with "-d" to enable padding).

After this, apply the pull request and you will see the warnings disappear.

warning_patch.txt

njh commented 6 years ago

twolame_get_framelength() isn't called anywhere inside libtoolame or in the frontend, so it will be tricky to test for.

Really should add unit tests (using libcheck?) at some point to test for things like this.