android h264 hardware encoding

yoyosuper8 yoyosuper8 at yahoo.com
Thu Oct 24 06:34:23 CEST 2013


Seeing that udpsink does not work in MCPlayer, I decided to use my own
version of rtsp-server which uses rtsp-server-1.0 library. When I launch the
app and the rtsp server starts, it seems to open a port and waits for an
incoming connection. I use vlc to try to connect to the rtsp server and it
seems to connect, however, nothing comes up. I get no video, it just sits
there.

This is my code:
	/* 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(3);

	/* 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,format=NV12,width=320,height=256,framerate=30/1\" !
bufferinspect ! amcvidenc-omxtiducati1videoh264e bitrate=300
i-frame-interval=8 ! bufferinspect ! rtph264pay name=pay0 pt=96 )");

	// This works using rtsp-server-1.0
		//	"( videotestsrc is-live=1 !
video/x-raw-yuv,width=640,height=480,framerate=30/1 ! ffmpegcolorspace !
x264enc tune=zerolatency byte-stream=true bitrate=300 ! 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);


Here is the logcat with the errors I get:
10-24 00:28:29.246: D/dalvikvm(11622): Trying to load lib
/data/app-lib/com.example.rtspserversample-1/libgstreamer_android.so
0x421ab610
10-24 00:28:29.270: D/dalvikvm(11622): Added shared lib
/data/app-lib/com.example.rtspserversample-1/libgstreamer_android.so
0x421ab610
10-24 00:28:29.270: D/dalvikvm(11622): Trying to load lib
/data/app-lib/com.example.rtspserversample-1/librtspserver.so 0x421ab610
10-24 00:28:29.270: D/dalvikvm(11622): Added shared lib
/data/app-lib/com.example.rtspserversample-1/librtspserver.so 0x421ab610
10-24 00:28:29.785: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:29.942: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:29.973: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:29.996: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.012: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.028: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.035: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.043: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.051: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.059: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.067: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.075: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.082: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.098: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.114: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.129: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.137: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.145: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.153: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.160: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:30.184: W/GStreamer+amc(11622): 0:00:00.877166748 0x51dce060
gstamc.c:2994:gst_amc_codec_info_to_caps Unsupported mimetype 'audio/gsm'
10-24 00:28:30.192: W/GStreamer+amc(11622): 0:00:00.884002685 0x51dce060
gstamc.c:3008:gst_amc_codec_info_to_caps Unknown color format 0x7f000789
10-24 00:28:30.192: W/GStreamer+amc(11622): 0:00:00.884307861 0x51dce060
gstamc.c:3008:gst_amc_codec_info_to_caps Unknown color format 0x7f000789
10-24 00:28:30.192: W/GStreamer+amc(11622): 0:00:00.886138915 0x51dce060
gstamc.c:3008:gst_amc_codec_info_to_caps Unknown color format 0x7f000789
10-24 00:28:30.200: W/GStreamer+amc(11622): 0:00:00.888793945 0x51dce060
gstamc.c:3008:gst_amc_codec_info_to_caps Unknown color format 0x7f000789
10-24 00:28:30.200: I/GStreamer(11622): GStreamer initialization complete
10-24 00:28:30.356: D/libEGL(11622): loaded
/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
10-24 00:28:30.356: D/libEGL(11622): loaded
/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
10-24 00:28:30.364: D/libEGL(11622): loaded
/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
10-24 00:28:30.426: D/OpenGLRenderer(11622): Enabling debug mode 0
10-24 00:28:32.762: D/GStreamer+rtspserver(11622): 0:00:03.454986564
0x57bde3c0
rtsp-server.c:803:gst_rtsp_server_create_socket:<GstRTSPServer at 0x519845f8>
getting address info of 0.0.0.0/8554
10-24 00:28:32.770: D/GStreamer+rtspserver(11622): 0:00:03.458770794
0x57bde3c0
rtsp-server.c:886:gst_rtsp_server_create_socket:<GstRTSPServer at 0x519845f8>
opened sending server socket
10-24 00:28:32.770: D/GStreamer+rtspserver(11622): 0:00:03.459289594
0x57bde3c0
rtsp-server.c:914:gst_rtsp_server_create_socket:<GstRTSPServer at 0x519845f8>
listening on server socket 0x59479900 with queue of 5
10-24 00:28:46.028: D/GStreamer+rtspserver(11622): 0:00:16.716674828
0x57bde3c0 rtsp-server.c:1022:manage_client:<GstRTSPServer at 0x519845f8>
manage client 0x57907de0
10-24 00:28:46.114: I/OMXClient(11622): Using client-side OMX mux.
10-24 00:28:46.325: V/GStreamer+default(11622): 0:00:17.014160157 0x59579890
gstutils.c:3649:gst_pad_create_stream_id_printf_valist:<videosrc:src>
Creating random stream-id, consider implementing a deterministic way of
creating a stream-id
10-24 00:28:46.332: I/GLib+stdout(11622): [2]accept caps video/x-raw,
format=(string)NV12, width=(int)320, height=(int)256,
framerate=(fraction)30/1
10-24 00:28:46.332: V/GStreamer+default(11622): 0:00:17.025878902 0x59579830
gstutils.c:3649:gst_pad_create_stream_id_printf_valist:<appsrc1:src>
Creating random stream-id, consider implementing a deterministic way of
creating a stream-id
10-24 00:28:46.332: V/GStreamer+default(11622): 0:00:17.027191158 0x59579860
gstutils.c:3649:gst_pad_create_stream_id_printf_valist:<appsrc0:src>
Creating random stream-id, consider implementing a deterministic way of
creating a stream-id
10-24 00:28:46.340: I/GLib+stdout(11622): [2]allowed caps video/x-raw,
width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[
0/1, 2147483647/1 ], format=(string)NV12
10-24 00:28:46.340: I/GLib+stdout(11622): [2]accept caps video/x-raw,
format=(string)NV12, width=(int)320, height=(int)256,
framerate=(fraction)30/1
10-24 00:28:46.348: I/GLib+stdout(11622): [2]allowed caps video/x-raw,
width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[
0/1, 2147483647/1 ], format=(string)NV12
10-24 00:28:46.348: I/GLib+stdout(11622): [2]accept caps video/x-raw,
format=(string)NV12, width=(int)320, height=(int)256,
framerate=(fraction)30/1
10-24 00:28:46.348: I/GLib+stdout(11622): [2]allowed caps video/x-raw,
width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[
0/1, 2147483647/1 ], format=(string)NV12
10-24 00:28:46.379: W/ACodec(11622): Use baseline profile instead of 8 for
AVC recording
10-24 00:28:46.379: I/ACodec(11622): setupVideoEncoder succeeded
10-24 00:28:46.442: E/GLib+GLib-GObject(11622): g_object_unref: assertion
'G_IS_OBJECT (object)' failed
10-24 00:28:46.450: E/GStreamer+amc(11622): 0:00:17.139465332 0x59630830
gstamc.c:977:gst_amc_format_get_float Failed to call Java method
10-24 00:28:46.450: E/GStreamer+amc(11622): 0:00:17.139678955 0x59630830
gstamc.c:1041:gst_amc_format_get_int Failed to call Java method
10-24 00:28:46.450: E/GStreamer+amc(11622): 0:00:17.139831543 0x59630830
gstamc.c:1041:gst_amc_format_get_int Failed to call Java method
10-24 00:28:46.450: I/GLib+stdout(11622): [2]accept caps video/x-h264,
parsed=(boolean)true, stream-format=(string)byte-stream,
alignment=(string)au, width=(int)320, height=(int)256,
framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
10-24 00:28:46.450: I/GLib+stdout(11622): [2]allowed caps video/x-h264,
profile=(string)constrained-baseline, stream-format=(string)avc,
alignment=(string)au; video/x-h264, stream-format=(string)avc,
alignment=(string)au; video/x-h264, profile=(string)constrained-baseline,
stream-format=(string)byte-stream, alignment=(string){ nal, au };
video/x-h264, stream-format=(string)byte-stream, alignment=(string){ nal, au
}
10-24 00:28:46.465: E/GStreamer+amcvideoenc(11622): 0:00:17.160003662
0x59630830
gstamcvideoenc.c:998:gst_amc_video_enc_handle_output_frame:<amcvideoenc-omxtiducati1videoh264e0>
No corresponding frame found
10-24 00:28:46.489: E/GStreamer+amc(11622): 0:00:17.178222656 0x59630830
gstamc.c:703:gst_amc_codec_dequeue_output_buffer Failed to call Java method




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


More information about the gstreamer-devel mailing list