From pieter at insync.za.net Wed Feb 7 22:57:49 2018 From: pieter at insync.za.net (Pieter De Wit) Date: Thu, 8 Feb 2018 09:57:49 +1300 Subject: [rtmpdump] Construct of Video Data messages Message-ID: <25C0BE15-FA31-4FED-B3A8-F2275D659389@insync.za.net> Hello Again group; I am seeing something strange in the video data message - at least, I think it’s strange :) Here is my app log (it’s my own server written in C): The variables used are: State - state of the server - 3 is after C2+S2, so handshake is done bRX - Bytes received in this “read” event bSD - Starting byte inside the buffer that was read (if we got multiple packets in one read then this will move to the end of the packet inside the buffer) From there it is the variables as described by the spec. Feb 08 06:53:37 ktms [17610]: (main.c@ 370) -> <==== Starting Packet of 7078 byte(s), starting at 0 Feb 08 06:53:37 ktms [17610]: (main.c@ 394) -> ---- Looping in packet State:3/bRX:7078/bSD:0 Feb 08 06:53:37 ktms [17610]: (main.c@ 486) -> Chunk Stream ID : 4 Feb 08 06:53:37 ktms [17610]: (main.c@ 487) -> Format : 0 Feb 08 06:53:37 ktms [17610]: (main.c@ 510) -> Timestamp:0/msg_len:4/msg_tid:8/msg_sid:259 Feb 08 06:53:37 ktms [17610]: (main.c@ 577) -> Audio Message of 4 bytes Feb 08 06:53:37 ktms [17610]: (main.c@ 962) -> Loop ended We are done with the first RTMP packet in the buffer, next one :) Feb 08 06:53:37 ktms [17610]: (main.c@ 394) -> ---- Looping in packet State:3/bRX:7078/bSD:16 Feb 08 06:53:37 ktms [17610]: (main.c@ 486) -> Chunk Stream ID : 4 Feb 08 06:53:37 ktms [17610]: (main.c@ 487) -> Format : 0 Feb 08 06:53:37 ktms [17610]: (main.c@ 510) -> Timestamp:0/msg_len:46/msg_tid:9/msg_sid:259 Feb 08 06:53:37 ktms [17610]: (main.c@ 583) -> Video Message of 46 bytes - we have 7050 bytes Feb 08 06:53:37 ktms [17610]: (main.c@ 612) -> Read 46 bytes of Video data, read_ret:7078 Feb 08 06:53:37 ktms [17610]: (main.c@ 962) -> Loop ended Rinse,repeat Feb 08 06:53:37 ktms [17610]: (main.c@ 394) -> ---- Looping in packet State:3/bRX:7078/bSD:74 Feb 08 06:53:37 ktms [17610]: (main.c@ 486) -> Chunk Stream ID : 4 Feb 08 06:53:37 ktms [17610]: (main.c@ 487) -> Format : 0 Feb 08 06:53:37 ktms [17610]: (main.c@ 510) -> Timestamp:0/msg_len:33754/msg_tid:9/msg_sid:259 Feb 08 06:53:37 ktms [17610]: (main.c@ 583) -> Video Message of 33754 bytes - we have 6992 bytes Feb 08 06:53:37 ktms [17610]: (main.c@ 590) -> Reading the next 26762 bytes for video data Feb 08 06:53:37 ktms [17610]: (main.c@ 612) -> Read 33754 bytes of Video data, read_ret:7078 Feb 08 06:53:37 ktms [17610]: (main.c@ 962) -> Loop ended Feb 08 06:53:37 ktms [17610]: (main.c@ 969) -> ====> Done with packet, waiting for next one Between the previous step and this one is where I suspect it all broke. Chuck Stream ID 37 was never defined so I suspect I am off on the byte count Feb 08 06:53:37 ktms [17610]: (main.c@ 370) -> <==== Starting Packet of 92 byte(s), starting at 0 Feb 08 06:53:37 ktms [17610]: (main.c@ 394) -> ---- Looping in packet State:3/bRX:92/bSD:0 Feb 08 06:53:37 ktms [17610]: (main.c@ 486) -> Chunk Stream ID : 37 Feb 08 06:53:37 ktms [17610]: (main.c@ 487) -> Format : 2 Feb 08 06:53:37 ktms [17610]: (main.c@ 537) -> Timestamp:4606387 Feb 08 06:53:37 ktms [17610]: (main.c@ 583) -> Video Message of 33754 bytes - we have 88 bytes Feb 08 06:53:37 ktms [17610]: (main.c@ 590) -> Reading the next 33666 bytes for video data Feb 08 06:53:37 ktms [17610]: (main.c@ 612) -> Read 33754 bytes of Video data, read_ret:92 Feb 08 06:53:37 ktms [17610]: (main.c@ 962) -> Loop ended Feb 08 06:53:37 ktms [17610]: (main.c@ 969) -> ====> Done with packet, waiting for next one So my question is: Is there headers that I need to read when the network read is less than the message length ? My understanding is that it looks like the following: | HEADER | <—DATA —>| But it appears ? That it’s: | HEADER | <— DATA —> | SMALLER HEADER | <— DATA —> | If this is the case, where can I get a definition of the headers ? Thanks ! Pieter