android4.0 
ICS :模拟器
播放视频文件,只有audio出来,黑屏。
有log 如下:E/AwesomePlayer(   37): mVideoSource->read() return err = 0
I/AwesomePlayer(   37): XXX mSeekTimeUs = 17215000 us, timeUs = 15749000 us
I/AwesomePlayer(   37): after SEEK_VIDEO_ONLY we're late by 1.88 secs
W/GraphicBufferAllocator(   34): alloc(320, 214, 842094169, 00002930, ...) failed -22 (Invalid argument)
E/SurfaceFlinger(   34): GraphicBufferAlloc::createGraphicBuffer(w=320, h=214) failed (Invalid argument), handle=0x0
E/SurfaceTexture(   34): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
W/SoftwareRenderer(   37): Surface::dequeueBuffer returned error -22

解决方案 »

  1.   

    nobody have the same problem.
      

  2.   

    gralloc.xxx.so中分配内存未支持HAL_PIXEL_FORMAT_YV12
    格式,导致内存分配失败android4.0中的graphicbuffer管理机制更新了
      

  3.   


    你好!谢谢你的答复。
    请问下,你指的graphicbuffer管理机制更新了,是需要重新获取source code,编译吗?
    谢谢!
      

  4.   

    不需要,重写gralloc.xxx.so就OK了
    因为codec(android4.0自带的codec)解码完后是HAL_PIXEL_FORMAT_YV12,所以才会有这问题,
    我把里面的codec库全换了,所以无此问题,不过我也更新gralloc库,已经支持HAL_PIXEL_FORMAT_YV12
    格式了,不过最后没有测试sw codec,
      

  5.   

    "codec(android4.0自带的codec)解码完后是HAL_PIXEL_FORMAT_YV12", 请问对于这个format,清楚吗?我看google default的avc omx ,也是OMX_COLOR_FormatYUV420Planar video yuv输出啊? 另外gralloc.xxx.so是个什么lib?重写? 谢谢!
      

  6.   

    gralloc.xxx.so是在android framework层实现的,代码在
    \hardware\libhardware\modules\grallocHAL_PIXEL_FORMAT_YV12你可以网上搜索一下,与
    HAL_PIXEL_FORMAT_YCbCr_422_SP可当同一情况处理分配内存
      

  7.   

    先结贴。
    谢谢yyhzpk。
    明白了你说的“android4.0的graphicbuffer管理机制更新,分配内存未支持HAL_PIXEL_FORMAT_YV12”, 现在花时间深入研究下。
      

  8.   

    把SoftwareRender.cpp中switch语句的case都注销掉只剩default就OK了,gralloc.xxx.so不支持那几中格式。
      

  9.   

    我也是遇到这个情况,三星定义420sp的format值为0x100,gralloc提示不支持。不知道要怎么解决呢?
      

  10.   

    问下9楼 把softwarerender的其他格式弄掉后,硬解能正常播放呢?
      

  11.   

    硬解出来的format是什么呢? 如果如9楼所说,注释掉其他的,还是走softrender,应该还是可以正常播放的。
      

  12.   

    求教:重写,把codec 更换具体 是如何做的?
      

  13.   

    我在4.0.3上面使用WebView load html5 播放视频文件的时候。。报06-11 08:42:46.123: ERROR/libEGL(2514): call to OpenGL ES API with no current context (logged once per thread)
    06-11 08:42:46.133: ERROR/libEGL(2514): call to OpenGL ES API with no current context (logged once per thread)
    06-11 08:42:46.142: ERROR/libEGL(2514): call to OpenGL ES API with no current context (logged once per thread)
    06-11 08:42:46.156: ERROR/libEGL(2514): call to OpenGL ES API with no current context (logged once per thread)
    06-11 08:42:46.156: ERROR/libEGL(2514): call to OpenGL ES API with no current context (logged once per thread)
    06-11 08:42:46.573: ERROR/WVMExtractor(38): Failed to open libwvm.so
    06-11 08:42:47.913: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0
    06-11 08:42:47.923: ERROR/SurfaceTexture(2514): [unnamed-2514-0] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
    06-11 08:42:54.682: ERROR/SurfaceTexture(2514): [unnamed-2514-0] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
    06-11 08:42:54.793: ERROR/Html5WebView(2514): mCustomView = null
    06-11 08:42:55.422: ERROR/WVMExtractor(38): Failed to open libwvm.so
    06-11 08:42:56.783: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0
    06-11 08:42:56.783: ERROR/SurfaceTexture(36): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
    06-11 08:42:56.863: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0
    06-11 08:42:56.863: ERROR/SurfaceTexture(36): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
    06-11 08:42:57.012: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0
    06-11 08:42:57.012: ERROR/SurfaceTexture(36): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
    06-11 08:42:57.113: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0
    06-11 08:42:57.113: ERROR/SurfaceTexture(36): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
    06-11 08:42:57.323: ERROR/SurfaceFlinger(36): GraphicBufferAlloc::createGraphicBuffer(w=176, h=132) failed (Invalid argument), handle=0x0