libstagefright: fix indefinate loop in QueryCodec

portFormat.nIndex is being incremented which is not
trustworthy since the nIndex value could be overriden
by the OMX Component,  which causes an indefinate loop
which inturn causes a memory leak and crashes the system.

OMX Component on encore and p970 exhibits this behaviour
(OMX.TI.720P.Decoder). This patch prevents stagefright
freezes when QueryCodec is called during Gallery Thumbnail
generation for videos and Adobe Flash playback.

Change-Id: I825c99ddecacbb927e22ac7d1a53facb26d95ff2
libstagefright: Fix a video lag bug after audio reached EOS.

http://git.insignal.co.kr/samsung/exynos/android/platform/frameworks/av/commit/?h=exynos-jb&id=da4104e5f934633b4ba7fda06bc9ef3ba0f85a31

Change-Id: I14931cad92df48e1233c5a8a704bb18585b1795a
Merge branch 'cm-10.1' of https://github.com/CyanogenMod/android_frameworks_av into jb42