KallDrexx / rust-media-libs

Rust based libraries for misc media functionality
Apache License 2.0
229 stars 58 forks source link

Unable to deserialize AMF0 Command _result('NetConnection.Connect.Success') after requesting Connection in ClientSession #3

Closed alexschhmchr closed 5 years ago

alexschhmchr commented 5 years ago

Hi,

I'm trying to connect to Twitch. After a successful handshake I try to use ClientSession::request_connection(), but after receiving some packets and passing them into handle_input() I get the following error: ChunkDeserializationError { kind: NoPreviousChunkOnStream { csid: 46 } }

In WireShark I found out, that it's the AMF0 Command _result('NetConnection.Connect.Success')) packet, that causes the error. Here's a hex dump from WireShark:

0000 c4 9d ed 92 05 9b 18 83 bf 8d 20 18 08 00 45 00 0010 01 63 c4 ca 40 00 3b 06 2f 94 b9 2a cd f4 c0 a8 0020 02 6f 07 8f dc 0a 20 e7 f2 56 f5 31 dd c9 50 18 0030 88 20 9f 4d 00 00 02 00 00 00 00 00 04 05 00 00 0040 00 00 00 26 25 a0 02 00 00 00 00 00 05 06 00 00 0050 00 00 00 26 25 a0 02 02 00 00 00 00 00 06 04 00 0060 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 04 0070 01 00 00 00 00 00 00 10 00 03 00 00 00 00 00 ec 0080 14 00 00 00 00 02 00 07 5f 72 65 73 75 6c 74 00 0090 3f f0 00 00 00 00 00 00 03 00 06 66 6d 73 56 65 00a0 72 02 00 0e 46 4d 53 2f 33 2c 35 2c 37 2c 37 30 00b0 30 39 00 0c 63 61 70 61 62 69 6c 69 74 69 65 73 00c0 00 40 3f 00 00 00 00 00 00 00 04 6d 6f 64 65 00 00d0 3f f0 00 00 00 00 00 00 00 00 09 03 00 05 6c 65 00e0 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 00f0 64 65 02 00 1d 4e 65 74 43 6f 6e 6e 65 63 74 69 0100 6f 6e 2e 43 6f 6e 6e 65 63 74 2e 53 75 63 63 65 0110 73 73 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 0120 00 14 43 6f 6e 6e 65 63 74 69 6f 6e 20 61 63 63 0130 65 70 74 65 64 2e 00 04 64 61 74 61 03 00 06 73 0140 74 72 69 6e 67 02 00 0a 33 2c 35 2c 37 2c 37 30 0150 30 39 00 00 09 00 0e 6f 62 6a 65 63 74 45 6e 63 0160 6f 64 69 6e 67 00 00 00 00 00 00 00 00 00 00 00 0170 09

The 4 packets before are getting successfully deserialized.

KallDrexx commented 5 years ago

Hey thanks for the report. I'm out of town this weekend but I should be able to look into it early next week.

Are you experiencing this in a custom application using this library or one of the the sample applications?

KallDrexx commented 5 years ago

fyi, was able to reproduce this in my mio example server. Investigating now.

KallDrexx commented 5 years ago

@alexschhmchr I just uploaded version 0.2.1, which fixed this issue. Somehow I forgot to have the client update it's RTMP chunk size, and I'm actually pretty surprised my tests had worked previously against another 3rd party RTMP server.

Let me know if you still have issues!