Hi<br><div><br><div class="gmail_quote">On Mon, Jan 24, 2011 at 3:00 PM, Gwenole Beauchesne <span dir="ltr">&lt;<a href="mailto:gbeauchesne@splitted-desktop.com" target="_blank">gbeauchesne@splitted-desktop.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br>
<br>
On Wed, 19 Jan 2011, Varun Dua wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am using FFMpeg and libva for getting hardware acceleration for my h.264 videos. With one H.264 stream everything is fine, but with two parallel H.264<br>
stream videos I am having a problem. I am creating two FFMpeg contexts (AVCodecContext, AVFormatContext etc) and two vaapi context but I am having<br>
problem with that. The errors that come are:<br>
<br>
VdpOutputSurfaceCreate(): status 25: A catch-all error, used when no other error code applies.<br>
<br>
vdpau_video: VdpPresentationQueueBlockUntilSurfaceIdle(): status 3: An invalid handle value was provided.<br>
</blockquote>
<br></div>
Please provide a self-contained testcase. It&#39;s hard to tell otherwise since the NVIDIA driver would return this kind of error when none other fits.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also is there any way before we can know whether these error will come or not, actual decoding the frame (i.e. before calling avcodec_decode_video2 or<br>
calling vaPutSurface)<br>
</blockquote>
<br></div>
VdpPresentationQueueBlockUntilSurfaceIdle() is used for vaPutSurface() implementation. If you use 0.7.x series, could you please also check whether prefixing your application with VDPAU_VIDEO_PUTSURFACE_FAST=0 makes a difference or not?<br>



<br>
Thanks,<br><font color="#888888">
Gwenole.<br>
</font></blockquote></div><br></div><div>Hi<div><br></div><div>No it doesn&#39;t make any difference. I am having another problem now, I am getting this error</div>
<div><br></div><div><div>vdpau_video: VdpDecoderCreate(): status 23: The system does not have enough resources to complete the requested operation at this time.</div><div>[h264 @ 0x852fb10]hardware accelerator failed to decode picture</div>


<div><br></div><div>and since I use vaPutsurface after that, my application crashes. Is there any way I can know that this error has occured in my application. I am creating 21 VASurfaces but that doesn&#39;t make a difference, reducing the number also creates that problem. But when I reboot and run the application again, there are no issues, but after runnning the application again 5 6 times the error again pops up.</div>


<div><br></div><div>Here is my code: </div><div><br></div><div><div><div>typedef struct _VAAPI_Context {</div><div>    Display                    *xdisplay;               /* X11 Display*/</div><div>    VAStatus                    vastatus;               /* to check the status of different libva functions */</div>


<div>    struct vaapi_context       *ffmpeg_va;              /* Vaapi Structure as required by FFMPEG */</div><div>    VASurfaceID                *va_surface_ids;    /* Surfaces are the render targets for vaapi*/</div><div>


    int                         va_num_surfaces;   /* number of surfaces required. Mplayer uses 21 so we are using that only*/</div><div>    int                         current_surface;        /* the current surface holding the decoded data - needed for direct rendering onto a XWindow or a Drawable </div>


<div>                                                             * context */</div><div>    int                         majorversion;           /* major version of the library. Not used as of now. */</div><div>    int                         minorversion;           /* major version of the library. Not used as of now. */</div>


<div>    Drawable*                   drbl;                   /* The drawable context required for direct rendering. Can be an XWindow */</div><div>    VAProfile                  profile;           /* The H264 profile supported by the implementation */</div>


<div>} _VAAPI_Context, FAR* P_VAAPI_Context;</div><div><br></div><div>typedef struct _FFMpegDecodeContext {</div><div><span style="white-space:pre-wrap">        </span>AVFormatContext <span style="white-space:pre-wrap">        </span>*pFormatCtx ;</div>


<div><span style="white-space:pre-wrap">        </span>AVCodecContext  <span style="white-space:pre-wrap">        </span>*pCodecCtx ;<span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">        </span>AVCodec         <span style="white-space:pre-wrap">        </span>*pCodec;<span style="white-space:pre-wrap">        </span></div><div>
<span style="white-space:pre-wrap">        </span>AVFrame         <span style="white-space:pre-wrap">        </span>*pFrame;<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>AVFrame         <span style="white-space:pre-wrap">        </span>*pFrameRGB;</div>


<div><span style="white-space:pre-wrap">        </span>uint8_t         <span style="white-space:pre-wrap">        </span>*pOUTBufferCTX;</div><div><span style="white-space:pre-wrap">        </span>BYTE <span style="white-space:pre-wrap">                        </span>ActualMagicBytes[6];</div>


<div><span style="white-space:pre-wrap">        </span>struct SwsContext<span style="white-space:pre-wrap">        </span>*img_convert_ctx;</div><div><span style="white-space:pre-wrap">        </span>int<span style="white-space:pre-wrap">        </span>            <span style="white-space:pre-wrap">        </span>iVideoStreamCTX;</div>


<div><span style="white-space:pre-wrap">        </span>BOOL <span style="white-space:pre-wrap">                        </span>HWAlloted;</div><div><span style="white-space:pre-wrap">        </span>int xLeft;</div>
<div><span style="white-space:pre-wrap">        </span>int yTop;</div><div><span style="white-space:pre-wrap">        </span>BOOL <span style="white-space:pre-wrap">        </span>   bDecodingStarted;</div>
<div>} FFMpegDecodeContext, *PFFMpegDecodeContext;</div><div><br></div><div><span style="white-space:pre-wrap">                </span></div><div>void Decode (pDecodeContext) {</div><div>...</div><div>...</div><div>...</div>
<div>    int len = avcodec_decode_video(pDecodeContext-&gt;pCodecCtx, pDecodeContext-&gt;pFrame, &amp;iFrameFinished, AVPacket.data, AVPacket.size);</div><div>    if(iFrameFinished)</div><div><span style="white-space:pre-wrap">                </span>{</div>


<div><span style="white-space:pre-wrap">                        </span>//Convert the image from its native format to RGB</div><div><span style="white-space:pre-wrap">                        </span>if(FALSE == pDecodeContext-&gt;HWAlloted) {</div>
<div><span style="white-space:pre-wrap">                                </span>sws_scale(pDecodeContext-&gt;img_convert,&amp;pDecodeContext-&gt;pFrame-&gt;data[0],&amp;pDecodeContext-&gt;pFrame-&gt;linesize[0],0,pDecodeContext-&gt;pCodecCtx-&gt;height,&amp;pDecodeContext-&gt;pFrameRGB-&gt;data[0],&amp;pDecodeContext-&gt;pFrameRGB-&gt;linesize[0]);</div>


<div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span>else {</div><div><span style="white-space:pre-wrap">                                </span>g_pVaAPI-&gt;vastatus = vaPutSurface(g_pVaAPI-&gt;ffmpeg_va-&gt;display, g_pVaAPI-&gt;va_surface_ids[g_pVaAPI-&gt;current_surface], *(g_pVaAPI-&gt;drbl),0,0,pDecodeContext-&gt;pCodecCtx-&gt;width,pDecodeContext-&gt;pCodecCtx-&gt;height,pDecodeContext-&gt;xLeft,pDecodeContext-&gt;yTop,pDecodeContext-&gt;pCodecCtx-&gt;width,pDecodeContext-&gt;pCodecCtx-&gt;height,NULL,0,0);<span style="white-space:pre-wrap">                                </span></div>


<div><span style="white-space:pre-wrap">                                </span>if(g_pVaAPI-&gt;vastatus != VA_STATUS_SUCCESS) {</div><div><span style="white-space:pre-wrap">                                        </span>TRACE((TC_LIB, TT_API1, &quot;Rendering failed: %s&quot;,vaErrorStr(g_pVaAPI-&gt;vastatus)));</div>


<div><span style="white-space:pre-wrap">                                        </span>return GRAPH_ERR_INTERNAL_ERROR; </div><div><span style="white-space:pre-wrap">                                </span>}</div><div><span style="white-space:pre-wrap">                        </span>}</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div>...</div><div>...</div><div>...</div><div>}</div></div></div><div><br></div><div><br></div><div>Regards</div><div>Varun</div></div></div>