Open xvusrmqj opened 7 years ago
让系统系统获取, 不强行设置, 就可以了 MediaFormat mediaformat = MediaFormat.createVideoFormat("video/avc", 1920, 1080); mediaformat.setInteger(MediaFormat.KEY_BIT_RATE, 40000000); // 125000 mediaformat.setInteger(MediaFormat.KEY_FRAME_RATE, 30); mMeidaCodec = MediaCodec.createDecoderByType("Video/AVC"); //MediaFormat mediaFormat = new MediaFormat(); //mediaFormat.setString(MediaFormat.KEY_MIME, "Video/AVC"); //mediaFormat.setByteBuffer("csd-0", ByteBuffer.wrap(header_sps)); //mediaFormat.setByteBuffer("csd-1", ByteBuffer.wrap(header_pps)); //mediaFormat.setInteger(MediaFormat.KEY_WIDTH, picWidth); //mediaFormat.setInteger(MediaFormat.KEY_HEIGHT, picHeight); //mMeidaCodec.configure(mediaFormat, mSurfaceView.getHolder().getSurface(), null, 0); mMeidaCodec.configure(mediaformat, mSurfaceView.getHolder().getSurface(), null, 0); mMeidaCodec.start();
空指针异常,H264Stream中的的header_sps和header_pps为空,注释了这两句但是播放不出来,应该怎么办?
后面发现好像是:
public static final Pattern regexSDPspspps = Pattern.compile("sprop-parameter-sets=(\\S+),(\\S+)",Pattern.CASE_INSENSITIVE);
这里没有匹配到,是不是要求rtsp里的视频有什么要求啊?我在vlc里可以播放的。