Comments (4)
SendingBuffer
is the buffer queue which storing the frame for the adaptive bit-rate.
SendingBufferProfile
is the profile for SendingBuffer
. There are some thresholds as following:
public static final float LOW_THRESHOLD_MIN = 0;
public static final float LOW_THRESHOLD_MAX = 1.0f;
public static final float LOW_THRESHOLD_DEFAULT = 0.2f;
public static final float HIGH_THRESHOLD_MIN = 0;
public static final float HIGH_THRESHOLD_MAX = 1.0f;
public static final float HIGH_THRESHOLD_DEFAULT = 0.8f;
public static final float DURATION_LIMIT_MIN = HIGH_THRESHOLD_MAX + 0.1f;
public static final float DURATION_LIMIT_MAX = 5.0f;
public static final float DURATION_LIMIT_DEFAULT = 3.0f;
public static final long LOW_THRESHOLD_TIMEOUT_MIN = 10 * 1000; // ms
public static final long DEFAULT_LOW_THRESHOLD_TIMEOUT = 60 * 1000; // ms
// [LOW_THRESHOLD_MIN, LOW_THRESHOLD_MAX] && [LOW_THRESHOLD_MIN, high - 0.1)
private float mLowThreshold;
// [HIGH_THRESHOLD_MIN, HIGH_THRESHOLD_MAX] && (low + 0.1, HIGH_THRESHOLD_MAX]
private float mHighThreshold;
// [DURATION_LIMIT_MIN, DURATION_LIMIT_MAX]
private float mDurationLimit;
// [LOW_THRESHOLD_TIMEOUT_MIN, Long.MAX_VALUE)
// To measure the low buffering case
private long mLowThresholdTimeout;
SendingBuffer have some related states:
STATE.SENDING_BUFFER_EMPTY
STATE.SENDING_BUFFER_FULL // means the sending buffer is full and some frames will be removed tactically
STATE.SENDING_BUFFER_HAS_FEW_ITEMS // means the network is in good condition as few buffers to be sent out. mLowThreshold
is the threshold for this.
STATE.SENDING_BUFFER_HAS_MANY_ITEMS // means the network is in bad condition as many buffers to be send out. mHighThreshold
is the threshold for this.
mLowThresholdTimeout
: if the network switch to good from bad , it needs mLowThresholdTimeout
to wait . It's difficult to change to good except the network is really in good condition.
Hope this helps!
from pldroidmediastreaming.
What does DURATION_LIMIT_MIN control?
Also what exactly does the value mLowThreshold and mHighThreshold indicate? How do we know what value should be set? Does it indicate the number of items in the buffer or size of buffer etc?
By the way, thanks for the info. This also brings me to the 2nd question. Assume we have a stable internet connection at 1mbps. Assume all SendingBufferProfile settings at default and mLowThresholdTimeout at 10s. Now looking at the code below
case CameraStreamingManager.STATE.SENDING_BUFFER_HAS_FEW_ITEMS:
mProfile.improveVideoQuality(1);
mCameraStreamingManager.notifyProfileChanged(mProfile);
return true;
case CameraStreamingManager.STATE.SENDING_BUFFER_HAS_MANY_ITEMS:
mProfile.reduceVideoQuality(1);
mCameraStreamingManager.notifyProfileChanged(mProfile);
return true;
Suppose with start at Quality MEDIUM 1 (30fps, 500kbps). After 10 secs SENDING_BUFFER_HAS_FEW_ITEMS will be called and quality will be improved to MEDIUM_2. After 10 secs again SENDING_BUFFER_HAS_MANY_ITEMS will be called and so on..
And if the internet speed is very very good (eg 10mbps) then SENDING_BUFFER_HAS_FEW_ITEMS will be called over and over again.
What are your suggestions as to what should the upper limit and lower limit for changing quality be, assuming we start at Medium_1.
For example, if we start at MEDIUM_1, should be go to a maximum of HIGH_1 and minimum of LOW_1. Or do you think it does not matter how high or low we go, depending on the internet speed.
from pldroidmediastreaming.
mDurationLimit
can be only between DURATION_LIMIT_MIN and DURATION_LIMIT_MAX. That's what exactly this means:
// [DURATION_LIMIT_MIN, DURATION_LIMIT_MAX]
private float mDurationLimit;
mLowThreshold
and mHighThreshold
are the thresholds to trigger the STATE.SENDING_BUFFER_HAS_FEW_ITEMS
and STATE.SENDING_BUFFER_HAS_MANY_ITEMS
. Let me take an example, if you set mLowThreshold
to 0.2 and mHighThreshold
to 0.8, and
BufferQueue
remained <= 0.2 buffers,STATE.SENDING_BUFFER_HAS_FEW_ITEMS
triggeredBufferQueue
remained >= 0.8 buffers,STATE.SENDING_BUFFER_HAS_MANY_ITEMS
triggered
Thus, mDurationLimit
is useful to restrict the STATE.SENDING_BUFFER_HAS_FEW_ITEMS
triggered. That means,
Only if BufferQueue
remained <= 0.2 buffers with mDurationLimit
, the STATE.SENDING_BUFFER_HAS_FEW_ITEMS
triggered.
Your second question:
We have the algorithm to avoid the quality being changed all the time in stable network condition. To be honest, the algorithm need to be improved. We trust we will do the best thing.
from pldroidmediastreaming.
Thanks, very helpful
from pldroidmediastreaming.
Related Issues (20)
- Youtube rtmp link not working HOT 1
- 录屏推流需要使用CameraPreviewFrameView吗?
- 视频进度条 HOT 1
- Access denied finding property "camera.aux.packagelist"
- 推流端预览左右两边有黑色 HOT 1
- 如何推流前预览? HOT 1
- 开始推流后 返回状态码 streamingState = UNAUTHORIZED_STREAMING_URL extra = -3 HOT 1
- 快速开始是不是已经不能快速开始了? HOT 1
- targetSdkVersion 29录屏会闪退 HOT 1
- 编译报错,与我的项目中使用的库有冲突? HOT 2
- 通过captureFrame截帧,图像变形。
- 引用happy-dns,还报NoSuchMethodError错误 HOT 4
- No static method defaultResolver() HOT 3
- Issue with the support of 64 bit libraries.
- Unauthorized Package while starting the Streaming
- Pili Streaming not working with Pili Android Version 2.4.0
- activity添加两个fragment,使用懒加载,第二个fragment,无法调起相机 HOT 1
- 最新Demo运行不起来 HOT 3
- 急急急,请问为啥下载的apk demo是牛直播,github上下载的代码跑起来又不像同一个app
- 播放器拉流问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pldroidmediastreaming.