Skip to content
Snippets Groups Projects
Commit 3748e187 authored by Ido Ben-Hur's avatar Ido Ben-Hur Committed by Dhina17
Browse files

Screenrecord: Make low quality bitrate scalable per device

Hack our way around that weird formula
Just devide scaled bitrate by 3 for low quality

Change-Id: I7669769ca3104b3566ed38f549af384f83d92d81
parent 1a50507d
No related branches found
No related tags found
No related merge requests found
......@@ -71,8 +71,8 @@ public class ScreenMediaRecorder extends MediaProjection.Callback {
private static final int TOTAL_NUM_TRACKS = 1;
private static final int VIDEO_FRAME_RATE = 30;
private static final int VIDEO_FRAME_RATE_TO_RESOLUTION_RATIO = 6;
private static final int LOW_VIDEO_FRAME_RATE_TO_RESOLUTION_RATIO = 2;
private static final int LOW_VIDEO_FRAME_RATE = 25;
private static final int LOW_VIDEO_BIT_RATE = 1750000;
private static final int AUDIO_BIT_RATE = 196000;
private static final int AUDIO_SAMPLE_RATE = 44100;
private static final int MAX_DURATION_MS = 60 * 60 * 1000;
......@@ -162,9 +162,10 @@ public class ScreenMediaRecorder extends MediaProjection.Callback {
int width = dimens[0];
int height = dimens[1];
refreshRate = dimens[2];
int vidBitRate = mLowQuality ? LOW_VIDEO_BIT_RATE :
width * height * refreshRate / VIDEO_FRAME_RATE
* VIDEO_FRAME_RATE_TO_RESOLUTION_RATIO;
int resRatio = mLowQuality ? LOW_VIDEO_FRAME_RATE_TO_RESOLUTION_RATIO
: VIDEO_FRAME_RATE_TO_RESOLUTION_RATIO;
int vidBitRate = width * height * refreshRate / VIDEO_FRAME_RATE * resRatio;
long maxFilesize = mLongerDuration ? MAX_FILESIZE_BYTES_LONGER : MAX_FILESIZE_BYTES;
mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mMediaRecorder.setVideoEncodingProfileLevel(
MediaCodecInfo.CodecProfileLevel.AVCProfileMain,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment