fix some bugs of EC

add IDR check, and fix the issue by Dong about reference picture management when IDR is lost.
review request in:
https://rbcommons.com/s/OpenH264/r/384/