do more check in _set_caps of vaapisink when _buffer_alloc is not called accepted/2.0/20130418.160353 submit/2.0/20130418.115800 submit/2.0/20130418.115824
authorZhao Halley <halley.zhao@intel.com>
Thu, 18 Apr 2013 11:49:42 +0000 (19:49 +0800)
committerZhao Halley <halley.zhao@intel.com>
Thu, 18 Apr 2013 11:56:06 +0000 (19:56 +0800)
    in webkit video ogg stream, _buffer_alloc isn't called,
    do more check in _set_caps to initialized image/surface pool
    for uploading raw yuv frame to vaSurface

gst/vaapi/gstvaapisink.c

index 672a221..6a02f5f 100755 (executable)
@@ -722,8 +722,14 @@ gst_vaapisink_set_caps(GstBaseSink *base_sink, GstCaps *caps)
     sink->video_width  = video_width;
     sink->video_height = video_height;
 
-    if (gst_structure_has_name(structure, "video/x-raw-yuv"))
+    if (gst_structure_has_name(structure, "video/x-raw-yuv")) {
         sink->use_video_raw = TRUE;
+        // in case _buffer_alloc is not called before
+        if (!gst_vaapi_uploader_ensure_display(sink->uploader, sink->display))
+            return GST_FLOW_NOT_SUPPORTED;
+        if (!gst_vaapi_uploader_ensure_caps(sink->uploader, caps, NULL))
+            return GST_FLOW_NOT_SUPPORTED;
+    }
 
     gst_video_parse_caps_pixel_aspect_ratio(caps, &video_par_n, &video_par_d);
     sink->video_par_n  = video_par_n;