refactor code to eliminate potential div by 0
Merge pull request #1076 from lyao2/RCdiv

refactor code to eliminate potential div by 0, review at: https://rbcommons.com/s/OpenH264/r/595/