android h264 hardware encoding

yoyosuper8 yoyosuper8 at yahoo.com
Thu Oct 24 22:47:49 CEST 2013


So I was confused about what udpsink provides. I need to be able to perform
h264 hardware encoding and then setup a rtsp server for clients to connect
to it. Now the rtsp server works when I perform software encoding, but not
when I try to do hardware encoding. This is all done in Android and not
ubuntu. So I can't do gst-launch() in android or anything as such.

This is the pipeline that I use to perform software encoding and stream it:
	gst_rtsp_media_factory_set_launch (factory,
	"( videotestsrc is-live=1 ! video/x-raw,width=640,height=480,framerate=30/1
! x264enc tune=zerolatency byte-stream=true bitrate=300 ! rtph264pay
name=pay0 pt=96 )");


This is the pipeline that I use to perform hardware encoding and stream it,
but no rtp packets are sent once the client connects to the rtsp server. The
client does properly connect to the rtsp server and get the OK 200, but
after that no rtp packets are sent from the server to the client:
	gst_rtsp_media_factory_set_launch (factory,
		"( videotestsrc is-live=true do-timestamp=true name=videosrc ! capsfilter
caps=\"video/x-raw,width=320,height=256,framerate=30/1\" !
amcvidenc-omxtiducati1videoh264e bitrate=1024 i-frame-interval=8 !
rtph264pay name=pay0 pt=96 )");


This is the rtsp server code in android. The function below is called by an
android app using jni:

static void *launch_rtsp_server() {

	/* Initiate debugging */
	GST_DEBUG_CATEGORY_INIT (debug_category, "rtspserver", 0, "RTSP Server");
	gst_debug_set_threshold_for_name("rtspserver", GST_LEVEL_DEBUG);

	/* Set debugging level */
	gst_debug_set_default_threshold(5);

	/* Create new loop for rtsp server */
	loop = g_main_loop_new (NULL, FALSE);

	/* Create a server instance */
	server = gst_rtsp_server_new ();

	/* get the mount points for this server, every server has a default object
	 * that be used to map uri mount points to media factories */
	mounts = gst_rtsp_server_get_mount_points (server);

	/* Make a media factory for a test stream. The default media factory can
use
	 * gst-launch syntax to create pipelines.
	 * any launch line works as long as it contains elements named pay%d. Each
	 * element with pay%d names will be a stream */
	factory = gst_rtsp_media_factory_new ();
	gst_rtsp_media_factory_set_launch (factory,
			"( videotestsrc is-live=true do-timestamp=true name=videosrc ! capsfilter
caps=\"video/x-raw,width=320,height=256,framerate=30/1\" !
amcvidenc-omxtiducati1videoh264e bitrate=1024 i-frame-interval=8 !
rtph264pay name=pay0 pt=96 )");

	/* Configure if media created from this factory can be shared between
clients */
	gst_rtsp_media_factory_set_shared (factory, TRUE);

	/* Attach the test factory to the /test url */
	gst_rtsp_mount_points_add_factory (mounts, "/test", factory);

	/* Don't need the ref to the mapper anymore */
	g_object_unref (mounts);

	/* Attach the server to the default maincontext */
	if (gst_rtsp_server_attach (server, NULL) == 0) {
	  GST_ERROR("FAILED TO ATTACH THE SERVER");
	}

	/* add a timeout for the session cleanup */
	g_timeout_add_seconds (2, (GSourceFunc) timeout, server);

	/* Start serving, this never stops */
	g_main_loop_run (loop);


	GST_DEBUG ("Stopping RTSP server...");
	g_object_unref (server);

	GST_DEBUG ("Unref main loop...");
	g_main_loop_unref (loop);

	GST_DEBUG("RTSP - EXITING SERVER THREAD");
	return NULL;
}



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/android-h264-hardware-encoding-tp4662522p4662844.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list