libavcenc: Correct placement of sync synchronize

In entropy thread, after a call to __sync_synchronize(), store buffer is
receiving new entries. This is causing entropy threads to go out of sync,
resulting in erroneous bitstreams. The following change corrects this.

Bug: 130554568
Test: run cts -m CtsVideoTestCases -t
      android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Qual0720x480
      --skip-preconditions

Change-Id: I81a2343f0f80c1e899e60e92fb48bbd3da006eab
diff --git a/encoder/ih264e_process.c b/encoder/ih264e_process.c
index 644a5a2..7acd239 100644
--- a/encoder/ih264e_process.c
+++ b/encoder/ih264e_process.c
@@ -528,8 +528,6 @@
                     }
                 }
             }
-            /* Dont execute any further instructions until store synchronization took place */
-            DATA_SYNC();
         }
 
         /* Ending bitstream offset for header in bits */
@@ -617,6 +615,9 @@
         DEBUG("entropy status %x", ps_entropy->i4_error_code);
     }
 
+    /* Dont execute any further instructions until store synchronization took place */
+    DATA_SYNC();
+
     /* allow threads to dequeue entropy jobs */
     ps_codec->au4_entropy_thread_active[ctxt_sel] = 0;