Merge change 20657

* changes:
  Fix possible NPE when mutating a DrawableContainer
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index ede475f..ca35a40 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -74,6 +74,15 @@
         mRS.nAllocationSubData2D(mID, xoff, yoff, w, h, d);
     }
 
+    public void readData(int[] d) {
+        mRS.nAllocationRead(mID, d);
+    }
+
+    public void readData(float[] d) {
+        mRS.nAllocationRead(mID, d);
+    }
+
+
     public class Adapter1D extends BaseObj {
         Adapter1D(int id, RenderScript rs) {
             super(rs);
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 9840bbb..0035142 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -100,6 +100,8 @@
     native void nAllocationSubData1D(int id, int off, int count, float[] d);
     native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, int[] d);
     native void nAllocationSubData2D(int id, int xoff, int yoff, int w, int h, float[] d);
+    native void nAllocationRead(int id, int[] d);
+    native void nAllocationRead(int id, float[] d);
 
     native void nTriangleMeshDestroy(int id);
     native void nTriangleMeshBegin(int vertex, int index);
@@ -187,6 +189,10 @@
     native void nSimpleMeshBindVertex(int id, int alloc, int slot);
     native void nSimpleMeshBindIndex(int id, int alloc);
 
+    native void nAnimationDestroy(int id);
+    native void nAnimationBegin(int attribCount, int keyframeCount);
+    native void nAnimationAdd(float time, float[] attribs);
+    native int  nAnimationCreate();
 
     private int     mDev;
     private int     mContext;
diff --git a/graphics/jni/Android.mk b/graphics/jni/Android.mk
index a19134d..a6abd8c 100644
--- a/graphics/jni/Android.mk
+++ b/graphics/jni/Android.mk
@@ -1,4 +1,3 @@
-ifeq ($(BUILD_RENDERSCRIPT),true)
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
@@ -33,7 +32,7 @@
 LOCAL_MODULE:= librs_jni
 LOCAL_ADDITIONAL_DEPENDENCIES += $(rs_generated_source)
 LOCAL_MODULE_TAGS := optional
+LOCAL_REQUIRED_MODULES := libRS
 
 include $(BUILD_SHARED_LIBRARY)
 
-endif
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 2c3a6cb..285fdc0 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -389,6 +389,27 @@
     _env->ReleaseFloatArrayElements(data, ptr, JNI_ABORT);
 }
 
+static void
+nAllocationRead_i(JNIEnv *_env, jobject _this, jint alloc, jintArray data)
+{
+    RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+    jint len = _env->GetArrayLength(data);
+    LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
+    jint *ptr = _env->GetIntArrayElements(data, NULL);
+    rsAllocationData((RsAllocation)alloc, ptr);
+    _env->ReleaseIntArrayElements(data, ptr, JNI_COMMIT);
+}
+
+static void
+nAllocationRead_f(JNIEnv *_env, jobject _this, jint alloc, jfloatArray data)
+{
+    RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
+    jint len = _env->GetArrayLength(data);
+    LOG_API("nAllocationRead_i, con(%p), alloc(%p), len(%i)", con, (RsAllocation)alloc, len);
+    jfloat *ptr = _env->GetFloatArrayElements(data, NULL);
+    rsAllocationData((RsAllocation)alloc, ptr);
+    _env->ReleaseFloatArrayElements(data, ptr, JNI_COMMIT);
+}
 
 
 // -----------------------------------
@@ -1197,6 +1218,8 @@
 {"nAllocationSubData1D",           "(III[F)V",                             (void*)nAllocationSubData1D_f },
 {"nAllocationSubData2D",           "(IIIII[I)V",                           (void*)nAllocationSubData2D_i },
 {"nAllocationSubData2D",           "(IIIII[F)V",                           (void*)nAllocationSubData2D_f },
+{"nAllocationRead",                "(I[I)V",                               (void*)nAllocationRead_i },
+{"nAllocationRead",                "(I[F)V",                               (void*)nAllocationRead_f },
 
 {"nTriangleMeshDestroy",           "(I)V",                                 (void*)nTriangleMeshDestroy },
 {"nTriangleMeshBegin",             "(II)V",                                (void*)nTriangleMeshBegin },
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index 857b2bd..7e5ff61 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -31,6 +31,7 @@
 class IOMXObserver;
 class IOMXRenderer;
 class ISurface;
+class Surface;
 
 class IOMX : public IInterface {
 public:
@@ -87,6 +88,16 @@
             OMX_COLOR_FORMATTYPE colorFormat,
             size_t encodedWidth, size_t encodedHeight,
             size_t displayWidth, size_t displayHeight) = 0;
+
+    // Note: This method is _not_ virtual, it exists as a wrapper around
+    // the virtual "createRenderer" method above facilitating extraction
+    // of the ISurface from a regular Surface.
+    sp<IOMXRenderer> createRenderer(
+            const sp<Surface> &surface,
+            const char *componentName,
+            OMX_COLOR_FORMATTYPE colorFormat,
+            size_t encodedWidth, size_t encodedHeight,
+            size_t displayWidth, size_t displayHeight);
 };
 
 struct omx_message {
diff --git a/include/ui/Surface.h b/include/ui/Surface.h
index 5665c1f..d5dad31 100644
--- a/include/ui/Surface.h
+++ b/include/ui/Surface.h
@@ -35,8 +35,8 @@
 // ---------------------------------------------------------------------------
 
 class BufferMapper;
+class IOMX;
 class Rect;
-class MediaPlayerImpl;
 class Surface;
 class SurfaceComposerClient;
 struct per_client_cblk_t;
@@ -181,7 +181,7 @@
     // mediaplayer needs access to ISurface for display
     friend class MediaPlayer;
     friend class Test;
-    friend class MediaPlayerImpl;
+    friend class IOMX;
     const sp<ISurface>& getISurface() const { return mSurface; }
 
     status_t getBufferLocked(int index);
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 3234f39..7075842 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -1,4 +1,3 @@
-ifeq ($(BUILD_RENDERSCRIPT),true)
 
 LOCAL_PATH:=$(call my-dir)
 
@@ -15,17 +14,8 @@
 LOCAL_MODULE_CLASS := EXECUTABLES
 intermediates := $(local-intermediates-dir)
 
-GEN := $(addprefix $(intermediates)/, \
-            lex.yy.c \
-        )
-$(GEN):	PRIVATE_CUSTOM_TOOL = flex -o $@ $<
-
-$(intermediates)/lex.yy.c : $(LOCAL_PATH)/spec.lex
-	$(transform-generated-source)
-
-$(LOCAL_PATH)/rsg_generator.c : $(intermediates)/lex.yy.c
-
 LOCAL_SRC_FILES:= \
+    spec.l \
     rsg_generator.c
 
 include $(BUILD_HOST_EXECUTABLE)
@@ -116,4 +106,3 @@
             java \
     	))
 
-endif
\ No newline at end of file
diff --git a/libs/rs/java/Fountain/res/raw/fountain.c b/libs/rs/java/Fountain/res/raw/fountain.c
index bf83aab..5ed9ed51 100644
--- a/libs/rs/java/Fountain/res/raw/fountain.c
+++ b/libs/rs/java/Fountain/res/raw/fountain.c
@@ -7,8 +7,7 @@
 
 
 int main(int launchID) {
-    int count, touch, x, y, rate, maxLife, lifeShift;
-    int life;
+    int count, touch, x, y, rate;
     int ct, ct2;
     int newPart;
     int drawCount;
@@ -25,15 +24,7 @@
     y = loadI32(0, 4);
 
     rate = 4;
-    maxLife = (count / rate) - 1;
-    lifeShift = 0;
-    {
-        life = maxLife;
-        while (life > 255) {
-            life = life >> 1;
-            lifeShift ++;
-        }
-    }
+    int maxLife = (count / rate) - 1;
 
     if (touch) {
         newPart = loadI32(2, 0);
@@ -57,19 +48,20 @@
     }
 
     drawCount = 0;
+    float height = getHeight();
     for (ct=0; ct < count; ct++) {
         srcIdx = ct * 5 + 1;
 
         dx = loadF(2, srcIdx);
         dy = loadF(2, srcIdx + 1);
-        life = loadI32(2, srcIdx + 2);
+        int life = loadI32(2, srcIdx + 2);
         posx = loadF(2, srcIdx + 3);
         posy = loadF(2, srcIdx + 4);
 
         if (life) {
-            if (posy < 480.f) {
+            if (posy < height) {
                 dstIdx = drawCount * 9;
-                c = 0xffafcf | ((life >> lifeShift) << 24);
+                c = 0xcfcfcfcf;
 
                 storeI32(1, dstIdx, c);
                 storeF(1, dstIdx + 1, posx);
@@ -91,7 +83,7 @@
 
             posx = posx + dx;
             posy = posy + dy;
-            dy = dy + 0.1f;
+            dy = dy + 0.05f;
             life --;
 
             //storeI32(2, srcIdx, dx);
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
index c2d1c65..ad4f949 100644
--- a/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
+++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainRS.java
@@ -39,6 +39,7 @@
 
 
 public class FountainRS {
+    public static final int PART_COUNT = 4000;
 
     public FountainRS() {
     }
@@ -75,10 +76,8 @@
     int mParams[] = new int[10];
 
     private void initRS() {
-        int partCount = 1024;
-
         mIntAlloc = Allocation.createSized(mRS, Element.USER_I32, 10);
-        mVertAlloc = Allocation.createSized(mRS, Element.USER_I32, partCount * 5 + 1);
+        mVertAlloc = Allocation.createSized(mRS, Element.USER_I32, PART_COUNT * 5 + 1);
 
         ProgramStore.Builder bs = new ProgramStore.Builder(mRS, null, null);
         bs.setBlendFunc(ProgramStore.BlendSrcFunc.SRC_ALPHA, ProgramStore.BlendDstFunc.ONE);
@@ -93,10 +92,12 @@
         mPF.setName("PgmFragParts");
 
         mParams[0] = 0;
-        mParams[1] = partCount;
+        mParams[1] = PART_COUNT;
         mParams[2] = 0;
         mParams[3] = 0;
         mParams[4] = 0;
+        mParams[5] = 0;
+        mParams[6] = 0;
         mIntAlloc.data(mParams);
 
         Element.Builder eb = new Element.Builder(mRS);
@@ -109,7 +110,7 @@
         Element primElement = eb.create();
 
         SimpleMesh.Builder smb = new SimpleMesh.Builder(mRS);
-        int vtxSlot = smb.addVertexType(primElement, partCount * 3);
+        int vtxSlot = smb.addVertexType(primElement, PART_COUNT * 3);
         smb.setPrimitive(Primitive.TRIANGLE);
         mSM = smb.create();
         mSM.setName("PartMesh");
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index b644833..7dbf412 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -155,6 +155,10 @@
 	param const void *data
 	}
 
+AllocationRead {
+	param RsAllocation va
+	param void * data
+	}
 
 Adapter1DCreate {
 	ret RsAdapter1D
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 5ec73d7..ad9c739 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -120,6 +120,11 @@
     memcpy(mPtr, data, mType->getSizeBytes());
 }
 
+void Allocation::read(void *data)
+{
+    memcpy(data, mPtr, mType->getSizeBytes());
+}
+
 void Allocation::subData(uint32_t xoff, uint32_t count, const void *data)
 {
     uint32_t eSize = mType->getElementSizeBytes();
@@ -523,6 +528,12 @@
     rsc->allocationCheck(a);
 }
 
+void rsi_AllocationRead(Context *rsc, RsAllocation va, void *data)
+{
+    Allocation *a = static_cast<Allocation *>(va);
+    a->read(data);
+}
+
 
 }
 }
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index eb1da69..00af9ed 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -60,6 +60,8 @@
     void subData(uint32_t xoff, uint32_t yoff, uint32_t zoff,
                  uint32_t w, uint32_t h, uint32_t d, const void *data);
 
+    void read(void *data);
+
     void enableGLVertexBuffers() const;
     void setupGLIndexBuffers() const;
 
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 799c443..54c555f 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -115,6 +115,9 @@
         mFloatDefines.add(String8(name), value);
     }
 
+    uint32_t getWidth() const {return mWidth;}
+    uint32_t getHeight() const {return mHeight;}
+
 protected:
     Device *mDev;
 
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index b46e1cf..4ee112d 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -547,32 +547,6 @@
     rsi_TriangleMeshRenderRange(rsc, mesh, start, count);
 }
 
-// Assumes (GL_FIXED) x,y,z (GL_UNSIGNED_BYTE)r,g,b,a
-static void SC_drawTriangleArray(int ialloc, uint32_t count)
-{
-    GET_TLS();
-    RsAllocation alloc = (RsAllocation)ialloc;
-
-    const Allocation *a = (const Allocation *)alloc;
-    const uint32_t *ptr = (const uint32_t *)a->getPtr();
-
-    rsc->setupCheck();
-
-    glBindBuffer(GL_ARRAY_BUFFER, 0);
-    //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, tm->mBufferObjects[1]);
-
-    glEnableClientState(GL_VERTEX_ARRAY);
-    glDisableClientState(GL_NORMAL_ARRAY);
-    glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-    glEnableClientState(GL_COLOR_ARRAY);
-
-    glVertexPointer(2, GL_FIXED, 12, ptr + 1);
-    //glTexCoordPointer(2, GL_FIXED, 24, ptr + 1);
-    glColorPointer(4, GL_UNSIGNED_BYTE, 12, ptr);
-
-    glDrawArrays(GL_TRIANGLES, 0, count * 3);
-}
-
 static void SC_drawLine(float x1, float y1, float z1,
                         float x2, float y2, float z2)
 {
@@ -601,13 +575,13 @@
                                  float u4, float v4)
 {
     GET_TLS();
-    
+
     //LOGE("Quad");
     //LOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
     //LOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
     //LOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
     //LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
-    
+
     float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
     const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
 
@@ -795,7 +769,17 @@
     LOGE("%s %i", s, i);
 }
 
+static uint32_t SC_getWidth()
+{
+    GET_TLS();
+    return rsc->getWidth();
+}
 
+static uint32_t SC_getHeight()
+{
+    GET_TLS();
+    return rsc->getHeight();
+}
 
 //////////////////////////////////////////////////////////////////////////////
 // Class implementation
@@ -981,8 +965,6 @@
         "void", "(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4)" },
     { "drawQuadTexCoords", (void *)&SC_drawQuadTexCoords,
         "void", "(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4)" },
-    { "drawTriangleArray", (void *)&SC_drawTriangleArray,
-        "void", "(int ialloc, int count)" },
     { "drawTriangleMesh", (void *)&SC_drawTriangleMesh,
         "void", "(int mesh)" },
     { "drawTriangleMeshRange", (void *)&SC_drawTriangleMeshRange,
@@ -1018,6 +1000,12 @@
     { "uploadToBufferObject", (void *)&SC_uploadToBufferObject,
         "void", "(int)" },
 
+    { "getWidth", (void *)&SC_getWidth,
+        "int", "()" },
+    { "getHeight", (void *)&SC_getHeight,
+        "int", "()" },
+
+
 
     { "debugF", (void *)&SC_debugF,
         "void", "(void *, float)" },
diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c
index a4d659d..7cf6bb6 100644
--- a/libs/rs/rsg_generator.c
+++ b/libs/rs/rsg_generator.c
@@ -1,6 +1,6 @@
 
-
-#include "lex.yy.c"
+#include "spec.h"
+#include <stdio.h>
 
 void printFileHeader(FILE *f)
 {
@@ -45,7 +45,7 @@
             fprintf(f, "double");
         break;
     case 4:
-        fprintf(f, "%s", vt->typename);
+        fprintf(f, "%s", vt->typeName);
         break;
     }
 
@@ -157,7 +157,7 @@
             needFlush += vt->ptrLevel;
             fprintf(f, "    cmd->%s = %s;\n", vt->name, vt->name);
         }
-        if (api->ret.typename[0]) {
+        if (api->ret.typeName[0]) {
             needFlush = 1;
         }
 
@@ -167,7 +167,7 @@
         }
         fprintf(f, "(RS_CMD_ID_%s, size);\n", api->name);
 
-        if (api->ret.typename[0]) {
+        if (api->ret.typeName[0]) {
             fprintf(f, "    return reinterpret_cast<");
             printVarType(f, &api->ret);
             fprintf(f, ">(io->mToCoreRet);\n");
@@ -199,7 +199,7 @@
         //fprintf(f, "    LOGE(\"play command %s\\n\");\n", api->name);
         fprintf(f, "    const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name);
         fprintf(f, "    ");
-        if (api->ret.typename[0]) {
+        if (api->ret.typeName[0]) {
             fprintf(f, "gIO->mToCoreRet = (intptr_t)");
         }
         fprintf(f, "rsi_%s(con", api->name);
diff --git a/libs/rs/spec.h b/libs/rs/spec.h
new file mode 100644
index 0000000..b474dca
--- /dev/null
+++ b/libs/rs/spec.h
@@ -0,0 +1,38 @@
+#ifndef SPEC_H
+#define SPEC_H
+
+#if __cplusplus
+extern "C" {
+#endif
+
+extern int num_lines;
+
+typedef struct {
+  int isConst;
+  int type;
+  int bits;
+  int ptrLevel;
+  char name[256];
+  char typeName[256];
+} VarType;
+
+extern VarType *currType;
+
+typedef struct {
+  char name[256];
+  int sync;
+  int paramCount;
+  VarType ret;
+  VarType params[16];
+} ApiEntry;
+
+extern ApiEntry apis[128];
+extern int apiCount;
+
+extern int typeNextState;
+
+#if __cplusplus
+} // extern "C"
+#endif
+
+#endif // SPEC_H
diff --git a/libs/rs/spec.lex b/libs/rs/spec.l
similarity index 87%
rename from libs/rs/spec.lex
rename to libs/rs/spec.l
index 0f8e9ab..62fcb63 100644
--- a/libs/rs/spec.lex
+++ b/libs/rs/spec.l
@@ -9,33 +9,19 @@
 DIGIT    [0-9]
 ID       [a-zA-Z_][a-zA-Z0-9_]*
 
+    #include "spec.h"
 
    int num_lines = 0;
 
-   typedef struct {
-      int isConst;
-      int type;
-      int bits;
-      int ptrLevel;
-      char name[256];
-      char typename[256];
-   } VarType;
-
    VarType *currType = 0;
 
-   typedef struct {
-      char name[256];
-      int sync;
-      int paramCount;
-      VarType ret;
-      VarType params[16];
-   } ApiEntry;
-
    ApiEntry apis[128];
    int apiCount = 0;
 
    int typeNextState;
 
+   extern "C" int yylex();
+
 %%
 
 "/*"         BEGIN(comment);
@@ -141,7 +127,7 @@
 <var_type>{ID} {
     currType->type = 4;
     currType->bits = 32;
-    memcpy(currType->typename, yytext, yyleng);
+    memcpy(currType->typeName, yytext, yyleng);
     BEGIN(typeNextState);
     }
 
diff --git a/media/libmedia/IOMX.cpp b/media/libmedia/IOMX.cpp
index b0f466b..d1dbc5c 100644
--- a/media/libmedia/IOMX.cpp
+++ b/media/libmedia/IOMX.cpp
@@ -6,6 +6,7 @@
 #include <binder/Parcel.h>
 #include <media/IOMX.h>
 #include <ui/ISurface.h>
+#include <ui/Surface.h>
 
 namespace android {
 
@@ -29,6 +30,18 @@
     RENDERER_RENDER,
 };
 
+sp<IOMXRenderer> IOMX::createRenderer(
+        const sp<Surface> &surface,
+        const char *componentName,
+        OMX_COLOR_FORMATTYPE colorFormat,
+        size_t encodedWidth, size_t encodedHeight,
+        size_t displayWidth, size_t displayHeight) {
+    return createRenderer(
+            surface->getISurface(),
+            componentName, colorFormat, encodedWidth, encodedHeight,
+            displayWidth, displayHeight);
+}
+
 static void *readVoidStar(const Parcel *parcel) {
     // FIX if sizeof(void *) != sizeof(int32)
     return (void *)parcel->readInt32();
diff --git a/media/libstagefright/MediaPlayerImpl.cpp b/media/libstagefright/MediaPlayerImpl.cpp
index 341f002..f2e62f5 100644
--- a/media/libstagefright/MediaPlayerImpl.cpp
+++ b/media/libstagefright/MediaPlayerImpl.cpp
@@ -646,15 +646,21 @@
     success = success && meta->findInt32(kKeyHeight, &decodedHeight);
     assert(success);
 
-    const sp<ISurface> &isurface =
-        mSurface.get() != NULL ? mSurface->getISurface() : mISurface;
-
-    mVideoRenderer =
-        mClient.interface()->createRenderer(
-                isurface, component,
-                (OMX_COLOR_FORMATTYPE)format,
-                decodedWidth, decodedHeight,
-                mVideoWidth, mVideoHeight);
+    if (mSurface.get() != NULL) {
+        mVideoRenderer =
+            mClient.interface()->createRenderer(
+                    mSurface, component,
+                    (OMX_COLOR_FORMATTYPE)format,
+                    decodedWidth, decodedHeight,
+                    mVideoWidth, mVideoHeight);
+    } else {
+        mVideoRenderer =
+            mClient.interface()->createRenderer(
+                    mISurface, component,
+                    (OMX_COLOR_FORMATTYPE)format,
+                    decodedWidth, decodedHeight,
+                    mVideoWidth, mVideoHeight);
+    }
 }
 
 void MediaPlayerImpl::depopulateISurface() {