Problem with push NV21 data into appsrc

Ugly Face xuchangxue365812 at 126.com
Thu Jan 9 07:38:27 PST 2014


I try to push nv21 data into appsrc with code:
static void gst_native_push_data(JNIEnv * env, jobject thiz, jbyteArray
fdata)
{
	GstCaps	   *caps;
	jint data_len = 18432;
	jint frame_rate = 15;
	GstBuffer *buffer;

	jbyte *temp;

	buffer = gst_buffer_new_and_alloc(data_len);
	CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
	caps = gst_caps_new_simple ("video/x-raw-yuv",
					"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('N', 'V', '2', '1'),
					"framerate", GST_TYPE_FRACTION, 15, 1,
					"width", G_TYPE_INT, 128,
					"height", G_TYPE_INT, 96,
					NULL);
	//gst_buffer_set_caps(buffer, caps);
	GST_BUFFER_TIMESTAMP (buffer) = (GstClockTime) gst_util_uint64_scale
(data->frame_num, GST_SECOND, frame_rate);
	GST_BUFFER_DURATION (buffer) =  (GstClockTime) gst_util_uint64_scale (1,
GST_SECOND, frame_rate);
	data->frame_num = data->frame_num + 1;
	temp = (*env)->GetByteArrayElements(env,fdata, NULL);
	if (temp != NULL)
	{
	    memcpy(GST_BUFFER_DATA(buffer), temp, data_len);
		gst_app_src_push_buffer(data->appsrc, buffer);
	    (*env)->ReleaseByteArrayElements(env,fdata, temp, JNI_ABORT);
	}

	//(*env)->GetByteArrayRegion(env, fdata, 0, data_len,
GST_BUFFER_DATA(buffer));
	//gst_app_src_push_buffer(data->appsrc, buffer);
	gst_buffer_unref(buffer);
}

which end up with warning:

01-09 23:20:45.602: W/GStreamer+videorate(26388): 0:00:06.434875489
0x52169a30 gstvideorate.c:830:gst_video_rate_event:<videorate> Got segment
but doesn't have GST_FORMAT_TIME value

01-09 23:20:45.735: W/GLib(26388): Unexpected item 0x590b2c68 dequeued from
queue queue (refcounting problem?)

01-09 23:20:45.797: W/GStreamer+basesrc(26388): 0:00:06.632507325 0x521be150
gstbasesrc.c:2633:gst_base_src_loop:<appsrc> error: Internal data flow
error.

01-09 23:20:45.797: W/GStreamer+basesrc(26388): 0:00:06.632873536 0x521be150
gstbasesrc.c:2633:gst_base_src_loop:<appsrc> error: streaming task paused,
reason error (-5)

my pipeline is:
                                                                       
appsrc ->
									queue !
									videorate !
									ffmpegcolorspace !
									x264enc byte-stream=true bitrate=300 speed-preset=superfast !
									rtph264pay !
									rtpbin.send_rtp_sink_0 rtpbin.send_rtp_src_0 !
									udpsink port=5000 host=$HOST ts-offset=0 name=vrtpsink
rtpbin.send_rtcp_src_0 !
									udpsink port=5001 host=$HOST sync=false async=false name=vrtcpsink
udpsrc port=5005 									name=vrtpsrc ! rtpbin.recv_rtcp_sink_0

I do not kown how to fix it. Any suggestion will be appreciated.

Gorge




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Problem-with-push-NV21-data-into-appsrc-tp4664572.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list