Your quoted code doesn't seem to account for this patch: https://android.googlesource.com/platform/frameworks/av/+/463a6f807e187828442949d1924e143cf07778c6%5E%21/#F0
Your NorthBit-Metaphor.pdf says it's for CVE-2015-3864, but that's the CVE which was for the integer underflow caused by the faulty patch above. (https://blog.exodusintel.com/2015/08/13/stagefright-mission-accomplished/) Are you sure it's not supposed to say it's for CVE-2015-3824, the confusingly-similar CVE number that refers to the original bug before the faulty patch?