vp8: adjust video size/fps to bitrate

parent edeaf53a
......@@ -255,13 +255,37 @@ static int enc_set_br(MSFilter *f, void*data){
int br=*(int*)data;
EncState *s=(EncState*)f->data;
s->cfg.rc_target_bitrate = br / 1024;
if (br>=1024000){
s->width = MS_VIDEO_SIZE_VGA_W;
s->height = MS_VIDEO_SIZE_VGA_H;
s->fps=25;
}else if (br>=512000){
s->width = MS_VIDEO_SIZE_CIF_W;
s->height = MS_VIDEO_SIZE_CIF_H;
s->fps=25;
} else if (br>=256000){
s->width = MS_VIDEO_SIZE_CIF_W;
s->height = MS_VIDEO_SIZE_CIF_H;
s->fps=15;
}else if (br>=170000){
s->width=MS_VIDEO_SIZE_QVGA_W;
s->height=MS_VIDEO_SIZE_QVGA_H;
s->fps=15;
}else if (br>=128000){
s->width=MS_VIDEO_SIZE_QVGA_W;
s->height=MS_VIDEO_SIZE_QVGA_H;
s->fps=10;
}else if (br>=64000){
s->width=MS_VIDEO_SIZE_QCIF_W;
s->height=MS_VIDEO_SIZE_QCIF_H;
s->fps=12;
}else{
s->width=MS_VIDEO_SIZE_QCIF_W;
s->height=MS_VIDEO_SIZE_QCIF_H;
s->fps=5;
}
#ifdef ANDROID
// s->width = MS_VIDEO_SIZE_QVGA_W;
// s->height = MS_VIDEO_SIZE_QVGA_H;
#endif
ms_warning("bitrate requested...: %d (%d x %d)\n", br, s->width, s->height);
ms_warning("bitrate requested...: %d (%d x %d)\n", br, s->width, s->height);
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment