Signed-off-by: Leo Ma <begeekmyfriend@gmail.com>
camera2
Leo Ma 9 years ago
parent 4cb3ab0811
commit d999b08765

@ -27,15 +27,15 @@ public class SrsEncoder {
public static int vbitrate = 500 * 1000; // 500kbps
public static final int VCROP_WIDTH = 384; // Note: the stride of resolution must be set as 16x for hard encoding with some chip like MTK
public static final int VCROP_HEIGHT = 640; // Since Y component is quadruple size as U and V component, the stride must be set as 32x
public static final int VFPS = 15;
public static final int VGOP = 15;
public static final int VFPS = 24;
public static final int VGOP = 48;
public static int VFORMAT = ImageFormat.YV12;
public static final int ASAMPLERATE = 44100;
public static final int ACHANNEL = AudioFormat.CHANNEL_IN_STEREO;
public static final int AFORMAT = AudioFormat.ENCODING_PCM_16BIT;
public static final int ABITRATE = 32 * 1000; // 32kbps
private SrsRtmp muxer;
private SrsRtmpFlv muxer;
private SrsRtmpPublisher publisher;
private MediaCodec vencoder;
@ -70,7 +70,7 @@ public class SrsEncoder {
public int start() {
publisher = new SrsRtmpPublisher(rtmpUrl);
muxer = new SrsRtmp(publisher);
muxer = new SrsRtmpFlv(publisher);
try {
muxer.start();
} catch (IOException e) {

@ -41,7 +41,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
* muxer.stop();
* muxer.release();
*/
public class SrsRtmp {
public class SrsRtmpFlv {
private volatile boolean connected;
private SrsRtmpPublisher publisher;
@ -62,7 +62,7 @@ public class SrsRtmp {
* constructor.
* @param p the rtmp publisher.
*/
public SrsRtmp(SrsRtmpPublisher p) {
public SrsRtmpFlv(SrsRtmpPublisher p) {
sequenceHeaderOk = false;
connected = false;
flv = new SrsFlv();
@ -201,7 +201,7 @@ public class SrsRtmp {
*/
public void stop() throws IllegalStateException {
if (worker == null || publisher == null) {
throw new IllegalStateException("SrsRtmp Not init!");
throw new IllegalStateException("SrsRtmpFlv Not init!");
}
disconnect();
@ -793,7 +793,7 @@ public class SrsRtmp {
SrsAnnexbSearch tbbsc = utils.srs_avc_startswith_annexb(bb, bi);
if (!tbbsc.match || tbbsc.nb_start_code < 3) {
Log.e(TAG, "annexb not match.");
SrsRtmp.srs_print_bytes(TAG, bb, 16);
SrsRtmpFlv.srs_print_bytes(TAG, bb, 16);
throw new Exception(String.format("annexb not match for %dB, pos=%d", bi.size, bb.position()));
}
@ -817,8 +817,8 @@ public class SrsRtmp {
tbb.size = bb.position() - pos;
if (bb.position() < bi.size) {
Log.i(TAG, String.format("annexb multiple match ok, pts=%d", bi.presentationTimeUs / 1000));
SrsRtmp.srs_print_bytes(TAG, tbbs, 16);
SrsRtmp.srs_print_bytes(TAG, bb.slice(), 16);
SrsRtmpFlv.srs_print_bytes(TAG, tbbs, 16);
SrsRtmpFlv.srs_print_bytes(TAG, bb.slice(), 16);
}
//Log.i(TAG, String.format("annexb match %d bytes", tbb.size));
break;
Loading…
Cancel
Save