libstagefright: handle error when B-frame is sent to MPEG4Writer

Without this patch, writing B-frame to MediaMuxer will be blocked and
cannot return a result. This may cause an endless progress bar shown in
gallery when triming or muting some videos.

Change-Id: Ide69ddee04d2419e977b0243557a4eff224631c0
CRs-Fixed: 521005