File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
sdk/video-link-android/src/main/java/com/tencent/iot/video/link/encoder Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public class VideoEncoder {
2525 private OnEncodeListener encoderListener ;
2626 private long seq = 0L ;
2727 private int MAX_BITRATE_LENGTH = 1000000 ;
28+ private int beginBitRate = 0 ;
2829
2930 public VideoEncoder (VideoEncodeParam param ) {
3031 this .videoEncodeParam = param ;
@@ -42,6 +43,7 @@ private void initMediaCodec() {
4243 if (bitRate > MAX_BITRATE_LENGTH ) {
4344 bitRate = MAX_BITRATE_LENGTH ;
4445 }
46+ beginBitRate = bitRate ;
4547 mediaFormat .setInteger (MediaFormat .KEY_BIT_RATE , bitRate );
4648 //描述视频格式的帧速率(以帧/秒为单位)的键。帧率,一般在15至30之内,太小容易造成视频卡顿。
4749 mediaFormat .setInteger (MediaFormat .KEY_FRAME_RATE , videoEncodeParam .getFrameRate ());
@@ -68,10 +70,8 @@ private void initMediaCodec() {
6870 @ TargetApi (Build .VERSION_CODES .KITKAT )
6971 public void setVideoBitRate (int bitRate ) {
7072 int nowBitrate = videoEncodeParam .getBitRate ();
71- int nowWidth = videoEncodeParam .getWidth ();
72- int nowHeight = videoEncodeParam .getHeight ();
7373
74- if ((bitRate > nowWidth * nowHeight ) || (bitRate < 10000 ) || (nowBitrate == bitRate ) || (bitRate > MAX_BITRATE_LENGTH )) {
74+ if ((bitRate > beginBitRate ) || (bitRate < 10000 ) || (nowBitrate == bitRate ) || (bitRate > MAX_BITRATE_LENGTH )) {
7575 return ;
7676 }
7777
You can’t perform that action at this time.
0 commit comments