Excessive number of chunks when streaming to MediaMTX
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 15/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 領域
- mobile-dev, networking
調査の方向性
The report gives no reproduction steps beyond streaming to MediaMTX, so start by reading the code it quotes: GenericStream setup, getStreamClient().setBitrateExponentialFactor(0.5f), the BitrateAdapter callback calling setVideoBitrateOnFly, and startStreaming calling genericStream.startStream. Done would mean identifying which of these changes bitrate or chunk sizing under poor LTE conditions, backed by a reproduction or test. The thread has no maintainer decision yet, so confirm the approach in the comments before writing code.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When streaming to MediaMTX we see randomly excessive number of chunks recorded.
When streaming from an application created with RootEncoder we are randomly seeing excessive number of chunks (about 7000 in one instance) when recording the streaming. The same is observed on HLS streamed from the server.
The client (device) is an android phone with RootEncoder app. It is streaming over LTE(4g) mobile network with h264/720p/1.6 Mbps CBR.
The behaviour is observed on different quality of network connectivity (not only poor). We do not have control over location, quality of connectivity of the device doing the streaming.
We have 60 ingest servers (mediamtx handling incomming rtmp traffic) and the clinets are more or less equally distributed on them. Top planned load per server is 200 streams, and we are doing extremely minimal processing (e.g. appending a bit of metadata with ffmpeg, calling few curls to external services). Servers in and of themselves are not overloaded. Usuall observed load is in the range of 90% - 95%
code is mostly:
/**
* StreamActivity is responsible for handling the camera preview and video streaming functionality.
* It utilizes the RootEncoder library for streaming video and audio data.
* This activity implements the ConnectChecker interface to handle streaming connection events.
*/
class StreamActivity : ComponentActivity(), ConnectChecker, Loggable {
//region PROPERTIES ⤵
private lateinit var viewModel: StreamActivityViewModel
/**
* Lazy-loaded instance of GenericStream, used for handling video and audio streaming.
* Sets automatic orientation handling and adjusts bitrate based on network conditions.
*/
val genericStream: GenericStream by lazy {
GenericStream(this, this).apply {
getGlInterface().autoHandleOrientation = true
getStreamClient().setBitrateExponentialFactor(0.5f)
}
}
private var _binding: ActivityStreamBinding? = null
private val binding get() = _binding!!
private val width = 1280 // Video resolution width
private val height = 720 // Video resolution height
private val vBitrate = 1500 * 1000 // Video bitrate in bps
private var rotation = 0 // Video rotation angle
private val sampleRate = 44100 // Audio sample rate
private val isStereo = false // Stereo audio configuration(Mono)
private val aBitrate = 48 * 1000 // Audio bitrate in kbps
private var recordPath = "" // Path for saving recorded video
private val fps = 20 // Frames per second
private var timerJob: Job? = null
private var broadcastStartTime: Long = 0L
private var checkBatteryLevelTimer: Timer? = null
private val handler = Handler(Looper.getMainLooper())
private val orientationHelper = OrientationHelper()
private val section: Section = getCurrentSection()
private val backPressHandler = Handler(Looper.getMainLooper())
private var currentToast: Toast? = null
private var backPressedOnce = false
private var soundLevelJob: Job? = null
private var microphoneSourceWrapper: MicrophoneSourceWrapper? = null
private var startingTime: Date = Date()
// Bitrate adapter to dynamically adjust bitrate based on bandwidth conditions
private val bitrateAdapter = BitrateAdapter {
genericStream.setVideoBitrateOnFly(it)
}.apply {
setMaxBitrate(vBitrate + aBitrate)
}
/**
* Initiates streaming if not already active.
*
* @param rtmpUrl The RTMP URL to stream to.
*
*/
private fun startStreaming(rtmpUrl: String) {
logInfo("Start streaming to -> $rtmpUrl")
if (!genericStream.isStreaming) {
binding.apply {
genericStream.startStream(rtmpUrl)
}
}
}
To Reproduce
Start streaming against mediamtx
Expected behavior
Normal streaming with no chunking except in extremely lossy conditions (e.g. very bad 4/5G connectivity)
Smartphone (please complete the following information):
- Library version: 2.6.1
- Device: motorola moto e13
- OS: android 13
- Media server: MediaMTX 1.7.0
- Class used [e.g. RtmpCamera1]
Additional context
Cross posted to Mediamtx: https://github.com/bluenviron/mediamtx/issues/5810
- 主要言語
- Kotlin
- スター
- 3k
- フォーク
- 946
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pedroSG94/RootEncoder のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pedroSG94/RootEncoder#2224 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
pedroSG94/RootEncoder#2213 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 43/100
pedroSG94/RootEncoder#2220 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
pedroSG94/RootEncoder#2207 · リアクション 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
pedroSG94/RootEncoder#2203 ·
メンテナーはふだん 2 日以内に返信
pedroSG94/RootEncoder の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 2 日以内に返信
-
unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
thunderbird/thunderbird-android#11893 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
Droid-Deck/DroidDeck#2198 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
world-federation-of-advertisers/cross-media-measurement#4846 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信