SimpleVideoActivity.java 文件源码

java
阅读 45 收藏 0 点赞 0 评论 0

项目:smartcar 作者:
@Override
public void onPreviewFrame(byte[] bytes, Camera camera) {
    if(!isRecording)return;

    ++frame_skipped;
    if(frame_skipped==SKIP_FRAME)frame_skipped=0;
    else return;

    try{
        if(bytes!=null){
            YuvImage img = new YuvImage(bytes,videoFormatIndex,
                    bestSize.width,bestSize.height,null);
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            img.compressToJpeg(new Rect(0,0,bestSize.width,bestSize.height),
                    VIDEO_QUALITY,outputStream);
            //sendImage(outputStream.toByteArray());
            send(outputStream.toByteArray());
        }
    }catch (Exception e){
        e.printStackTrace();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号