FFmpeg stability fixes

This commit is contained in:
DarkKnight2122
2026-04-26 05:16:02 +05:30
parent beede425df
commit c0c395b100
4 changed files with 30 additions and 28 deletions

View File

@@ -231,29 +231,31 @@ class BridgeService : Service() {
chunkIndex: Int, chunkIndex: Int,
totalChunks: Int totalChunks: Int
) { ) {
if (chunkIndex == 0) { synchronized(friendAccumulator) {
friendAccumulator.clear() if (chunkIndex == 0) {
groupAccumulator.clear() friendAccumulator.clear()
} groupAccumulator.clear()
}
remoteSideContext.log.verbose("Received chunk $chunkIndex/$totalChunks: ${groups.size} groups, ${friends.size} friends") remoteSideContext.log.verbose("Received chunk $chunkIndex/$totalChunks: ${groups.size} groups, ${friends.size} friends")
friendAccumulator.addAll(friends.mapNotNull { toParcelable<MessagingFriendInfo>(it) }) friendAccumulator.addAll(friends.mapNotNull { toParcelable<MessagingFriendInfo>(it) })
groupAccumulator.addAll(groups.mapNotNull { toParcelable<MessagingGroupInfo>(it) }) groupAccumulator.addAll(groups.mapNotNull { toParcelable<MessagingGroupInfo>(it) })
if (chunkIndex == totalChunks - 1) { if (chunkIndex == totalChunks - 1) {
val finalFriends = friendAccumulator.toList() val finalFriends = friendAccumulator.toList()
val finalGroups = groupAccumulator.toList() val finalGroups = groupAccumulator.toList()
friendAccumulator.clear() friendAccumulator.clear()
groupAccumulator.clear() groupAccumulator.clear()
remoteSideContext.coroutineScope.launch(Dispatchers.IO) { remoteSideContext.coroutineScope.launch(Dispatchers.IO) {
pendingSocialSnapshotCallback?.let { callback -> pendingSocialSnapshotCallback?.let { callback ->
pendingSocialSnapshotCallback = null pendingSocialSnapshotCallback = null
callback(finalFriends, finalGroups) callback(finalFriends, finalGroups)
}
remoteSideContext.database.replaceMessagingData(finalFriends, finalGroups)
remoteSideContext.database.messagingDataFlow.tryEmit(finalFriends to finalGroups)
} }
remoteSideContext.database.replaceMessagingData(finalFriends, finalGroups)
remoteSideContext.database.messagingDataFlow.tryEmit(finalFriends to finalGroups)
} }
} }
} }

View File

@@ -211,7 +211,7 @@ class FFMpegProcessor(
filterSecondPart.append("[v$index][$index:a]") filterSecondPart.append("[v$index][$index:a]")
} else { } else {
containsNoSound = true containsNoSound = true
filterSecondPart.append("[v$index][${filesInfo.size}]") filterSecondPart.append("[v$index][${filesInfo.size}:a]")
} }
inputArguments += "-i" to file inputArguments += "-i" to file
} }
@@ -228,9 +228,9 @@ class FFMpegProcessor(
outputArguments += "-fps_mode" to "vfr" outputArguments += "-fps_mode" to "vfr"
outputArguments += "-filter_complex" to "\"$filterFirstPart ${filterSecondPart}concat=n=${filesInfo.size}:v=1:a=1[vout][aout]\"" outputArguments += "-filter_complex" to "$filterFirstPart ${filterSecondPart}concat=n=${filesInfo.size}:v=1:a=1[vout][aout]"
outputArguments += "-map" to "\"[aout]\"" outputArguments += "-map" to "[aout]"
outputArguments += "-map" to "\"[vout]\"" outputArguments += "-map" to "[vout]"
} finally { } finally {
filesInfo.forEach { it.second.close() } filesInfo.forEach { it.second.close() }
} }
@@ -264,8 +264,8 @@ class FFMpegProcessor(
filterParts.append("[a$index]") filterParts.append("[a$index]")
} }
filterParts.append("amix=inputs=${args.inputs.size}:duration=longest:normalize=0[aout]") filterParts.append("amix=inputs=${args.inputs.size}:duration=longest:normalize=0[aout]")
outputArguments += "-filter_complex" to "\"$filterParts\"" outputArguments += "-filter_complex" to filterParts.toString()
outputArguments += "-map" to "\"[aout]\"" outputArguments += "-map" to "[aout]"
} }
} }
outputArguments += args.output.absolutePath outputArguments += args.output.absolutePath

View File

@@ -112,11 +112,11 @@ object Updater {
private val cache = mutableMapOf<Channel, LatestRelease?>() private val cache = mutableMapOf<Channel, LatestRelease?>()
fun getLatestRelease(channel: Channel): LatestRelease? { fun getLatestRelease(channel: Channel): LatestRelease? {
return cache.getOrPut(Channel.STABLE) { return cache.getOrPut(channel) {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG && channel == Channel.STABLE) {
fetchLatestDebugCI() ?: fetchLatestRelease(Channel.STABLE) fetchLatestDebugCI() ?: fetchLatestRelease(Channel.STABLE)
} else { } else {
fetchLatestRelease(Channel.STABLE) fetchLatestRelease(channel)
} }
} }
} }

View File

@@ -97,7 +97,7 @@ class HomeSettings : Routes.Route() {
workManager.enqueueUniquePeriodicWork( workManager.enqueueUniquePeriodicWork(
"purrfectsnap_update_check", "purrfectsnap_update_check",
ExistingPeriodicWorkPolicy.KEEP, ExistingPeriodicWorkPolicy.REPLACE,
workRequest workRequest
) )
} else { } else {