Propagate av1_lookahead_push failure up call chain

Propagate av1_lookahead_push() failure up the call chain.

First, av1_receive_raw_frame() needs to call aom_internal_error() to
save an error code in cpi->common.error if the av1_lookahead_push() call
fails.

Then, encoder_encode() needs to check cpi->common.error instead of
&ppi->error if the av1_receive_raw_frame() call fails because ppi is not
passed to the av1_receive_raw_frame() call.

Change-Id: I6f9ea238f9df55a32aaa86e0c8dc3e6d67a34816
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 5f67fd4..b05f45f 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -2914,7 +2914,7 @@
       // key frame flag when we actually encode this frame.
       if (av1_receive_raw_frame(cpi, flags | ctx->next_frame_flags, &sd,
                                 src_time_stamp, src_end_time_stamp)) {
-        res = update_error_state(ctx, &ppi->error);
+        res = update_error_state(ctx, cpi->common.error);
       }
       ctx->next_frame_flags = 0;
     }
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 82e7452..43aa678 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -3940,8 +3940,11 @@
 #endif  //  CONFIG_DENOISE
 
   if (av1_lookahead_push(cpi->ppi->lookahead, sd, time_stamp, end_time,
-                         use_highbitdepth, frame_flags))
+                         use_highbitdepth, frame_flags)) {
+    aom_internal_error(cm->error, AOM_CODEC_ERROR,
+                       "av1_lookahead_push() failed");
     res = -1;
+  }
 #if CONFIG_INTERNAL_STATS
   aom_usec_timer_mark(&timer);
   cpi->ppi->total_time_receive_data += aom_usec_timer_elapsed(&timer);