优化直播播放逻辑,添加追帧速率记录功能,修复项目名称拼写错误
This commit is contained in:
@@ -74,7 +74,7 @@ dependencies {
|
|||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
|
||||||
implementation 'androidx.core:core-ktx:1.13.1'
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
// implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
||||||
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha13'
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha13'
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||||
|
|||||||
Binary file not shown.
@@ -79,6 +79,7 @@ class LivePlayActivity : AppCompatActivity() {
|
|||||||
private var firstAudioFrameElapsedMs: Long? = null
|
private var firstAudioFrameElapsedMs: Long? = null
|
||||||
private var firstAudioFrameCostMs: Long? = null
|
private var firstAudioFrameCostMs: Long? = null
|
||||||
private var isLatencyChasingActive: Boolean = false
|
private var isLatencyChasingActive: Boolean = false
|
||||||
|
private var lastLatencyChasingSpeed: Float? = null
|
||||||
|
|
||||||
private val logLines: ArrayDeque<String> = ArrayDeque()
|
private val logLines: ArrayDeque<String> = ArrayDeque()
|
||||||
private val logTimeFormat = SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault())
|
private val logTimeFormat = SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault())
|
||||||
@@ -159,9 +160,17 @@ class LivePlayActivity : AppCompatActivity() {
|
|||||||
isLatencyChasingActive = true
|
isLatencyChasingActive = true
|
||||||
val speedText = String.format(Locale.US, "%.1f", speedRounded)
|
val speedText = String.format(Locale.US, "%.1f", speedRounded)
|
||||||
logEvent("追帧开始: 速度=${speedText}x")
|
logEvent("追帧开始: 速度=${speedText}x")
|
||||||
|
lastLatencyChasingSpeed = speedRounded
|
||||||
|
} else if (isChasing && isLatencyChasingActive) {
|
||||||
|
if (lastLatencyChasingSpeed == null || lastLatencyChasingSpeed != speedRounded) {
|
||||||
|
val speedText = String.format(Locale.US, "%.1f", speedRounded)
|
||||||
|
logEvent("追帧速率变化: 速度=${speedText}x")
|
||||||
|
lastLatencyChasingSpeed = speedRounded
|
||||||
|
}
|
||||||
} else if (!isChasing && isLatencyChasingActive) {
|
} else if (!isChasing && isLatencyChasingActive) {
|
||||||
isLatencyChasingActive = false
|
isLatencyChasingActive = false
|
||||||
logEvent("追帧结束: 速度=1.0x")
|
logEvent("追帧结束: 速度=1.0x")
|
||||||
|
lastLatencyChasingSpeed = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -661,6 +670,7 @@ class LivePlayActivity : AppCompatActivity() {
|
|||||||
firstAudioFrameElapsedMs = null
|
firstAudioFrameElapsedMs = null
|
||||||
firstAudioFrameCostMs = null
|
firstAudioFrameCostMs = null
|
||||||
isLatencyChasingActive = false
|
isLatencyChasingActive = false
|
||||||
|
lastLatencyChasingSpeed = null
|
||||||
logEvent("播放尝试开始")
|
logEvent("播放尝试开始")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,5 +20,5 @@ dependencyResolutionManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "SellyCLoudSDKExample"
|
rootProject.name = "SellyCloudSDKExample"
|
||||||
include ':example'
|
include ':example'
|
||||||
|
|||||||
Reference in New Issue
Block a user