File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
srt/src/main/java/com/pedro/srt/srt/packets Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,16 @@ abstract class SrtPacket {
4444 @Throws(IOException ::class )
4545 fun getSrtPacket (buffer : ByteArray ): SrtPacket {
4646 val packetType = PacketType .from((buffer[0 ].toInt() ushr 7 ) and 0x01 )
47+ val input = ByteArrayInputStream (buffer)
4748 when (packetType) {
4849 PacketType .DATA -> {
49- return DataPacket ()
50+ val dataPacket = DataPacket ()
51+ dataPacket.read(input)
52+ return dataPacket
5053 }
5154 PacketType .CONTROL -> {
5255 val headerData = buffer.sliceArray(0 until 4 )
53- val type = ControlPacket .getType(ByteArrayInputStream (headerData))
54- val input = ByteArrayInputStream (buffer)
55- when (type) {
56+ when (val type = ControlPacket .getType(ByteArrayInputStream (headerData))) {
5657 ControlType .HANDSHAKE -> {
5758 val handshake = Handshake ()
5859 handshake.read(input)
You can’t perform that action at this time.
0 commit comments