
一、libstreaming概述
libstreamingis an API that allows you, with only a few lines of code, to stream the camera and/or microphone of an android powered device using RTP over UDP.
Android 4.0 or more recent is required.
Supported encoders include H.264, H.263, AAC and AMR.
The first step you will need to achieve to start a streaming session to some peer is called 'signaling'. During this step you will contact the receiver and send a description of the incomming streams. You have three ways to do that with libstreaming.
With the RTSP client: if you want to stream to a Wowza Media Server, it's the way to go.The example 3illustrates that use case.
With the RTSP server: in that case the phone will act as a RTSP server and wait for a RTSP client to request a stream. This use case is illustated inthe example 1.
Or you use libstreaming without using the RTSP protocol at all, and signal the session using SDP over a protocol you like.The example 2illustrates that use case.

example1 是将libstreaming作为 RTSP server ,在手机上安装并启动net.majorkernelpanic.streaming.rtsp.RtspServer,在PC上用vlc打开rtsp://your rtspserver ip:8086,即可实现视频直播。
example3 是将libstreaming作为 RTSP client ,通过net.majorkernelpanic.streaming.rtsp.RtspCilent将视频流push到wowza服务器,在PC上用VLC打开rtsp://your wowzastreaming ip:1935/live/test.stream,即可实现视频直播。rtsp协议源码
example3只要一个MainActivity.java。主要是为Session、RtspClient设置初,如分辨率、帧率、编码式等。
除了MainActivity.java,其他java文件包名均为“net.majorkernelpanic.streaming”。大致流程如下:
MainActivity.java: 点击button “R.id.start”,进入 toggleStream 方法,关键代码:
从log信息可以看出rtsp连接成功,只需在播放端用vlc播放地址:rtsp://wowza ip:1935/live/test.stream 。关于RTSP协议的分析,此处不做详细说明。rtsp协议源码
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-47658-1.html
建议中国军舰对美军舰前后20海里进行军事导弹实弹射击演练
容许现在打击的红灯区的存在
比芝麻糊营养高