added log statements

This commit is contained in:
davotoula
2025-09-22 19:29:58 +02:00
parent 97d6c791c0
commit f5202dd8a9

View File

@@ -167,7 +167,7 @@ private fun getVideoInfo(
* xxx 1. Check input resolution and input fps * xxx 1. Check input resolution and input fps
* xxx 2. Create configuration matrix: for each quality level, set bitrate based on input resolution * xxx 2. Create configuration matrix: for each quality level, set bitrate based on input resolution
* 3. Create Configuration with no quality setting, a bitrate setting, resizer, streamable = true, isMinBitrateCheckEnabled=false * 3. Create Configuration with no quality setting, a bitrate setting, resizer, streamable = true, isMinBitrateCheckEnabled=false
* 4. Don't upload converted file if compression results in larger file * 4. Don't upload converted file if compression results in larger file (return MediaCompressorResult(uri, contentType, null))
* *
* *
* Don't use Configuration.quality which only determines bitrate. Instead let's create aggressive bitrates based on input and selected quality * Don't use Configuration.quality which only determines bitrate. Instead let's create aggressive bitrates based on input and selected quality
@@ -215,18 +215,23 @@ class MediaCompressor {
val videoBitrateInMbps = val videoBitrateInMbps =
if (videoInfo != null) { if (videoInfo != null) {
compressionRules.getValue(mediaQuality).getValue(videoInfo.resolution.getStandardName()).getBitrateMbpsInt() val bitrate = compressionRules.getValue(mediaQuality).getValue(videoInfo.resolution.getStandardName()).getBitrateMbpsInt()
Log.d("MediaCompressor", "Video bitrate calculated: ${bitrate}Mbps for ${videoInfo.resolution.getStandardName()} quality=$mediaQuality")
bitrate
} else { } else {
// Default/fallback logic when videoInfo is null // Default/fallback logic when videoInfo is null
Log.d("MediaCompressor", "Video bitrate fallback: 2Mbps (videoInfo unavailable)")
2 2
} }
val resizer = val resizer =
if (videoInfo != null) { if (videoInfo != null) {
val rules = compressionRules.getValue(mediaQuality).getValue(videoInfo.resolution.getStandardName()) val rules = compressionRules.getValue(mediaQuality).getValue(videoInfo.resolution.getStandardName())
Log.d("MediaCompressor", "Video resizer: ${videoInfo.resolution.width}x${videoInfo.resolution.height} -> ${rules.width}x${rules.height} (${rules.description})")
VideoResizer.limitSize(rules.width.toDouble(), rules.height.toDouble()) VideoResizer.limitSize(rules.width.toDouble(), rules.height.toDouble())
} else { } else {
// null VideoResizer should result in unchanged resolution // null VideoResizer should result in unchanged resolution
Log.d("MediaCompressor", "Video resizer: null (original resolution preserved)")
null null
} }