WIP fix: Skip NAL header byte when reading SPS profile data in HlsMuxer #20

Open
dean wants to merge 2 commits from fix/hlsmuxer-codec-string into main
Showing only changes of commit dd26812a9c - Show all commits

View File

@@ -753,10 +753,23 @@ class HlsMuxer(
dos.writeShort(-1) // pre-defined
output.write(buildAvcCBox(sps, pps))
output.write(buildPaspBox())
return wrapBox("avc1", output.toByteArray())
}
/**
* Builds pixel aspect ratio box to explicitly declare square pixels (1:1).
* This helps players correctly interpret video dimensions without SAR scaling.
*/
private fun buildPaspBox(): ByteArray {
val output = ByteArrayOutputStream()
val dos = DataOutputStream(output)
dos.writeInt(1) // hSpacing (horizontal)
dos.writeInt(1) // vSpacing (vertical)
return wrapBox("pasp", output.toByteArray())
}
private fun buildAvcCBox(sps: ByteArray, pps: ByteArray): ByteArray {
val output = ByteArrayOutputStream()
val dos = DataOutputStream(output)