[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-dev] AMF::encodeElement
From: |
strk |
Subject: |
Re: [Gnash-dev] AMF::encodeElement |
Date: |
Tue, 9 Dec 2008 13:32:38 +0100 |
On Tue, Dec 09, 2008 at 12:40:35PM +0100, strk wrote:
> I'm comparing tcp dumps of gnash and pp while trying to
> encode NetConnection encoding for rtmpget.
>
> The bug I'm up to is on encoding a string element
> being the string 'connect', which with libamf results
> in 2 bytes more then required.
>
> The AMF type is 1 byte, for a string we have 2 bytes of
> length and then the string (not null-terminated):
>
> 02 00 07 63 6f 6e 6e 65 63 74
> <type> <len> c o n n e c t
>
> This gives a total buffer length of 10 (7+3)
> but Element::encode() returns a buffer of 12 bytes.
I found this being the result of AMF::encodeElement
adding AMF_PROP_HEADER_SIZE instead of AMF_HEADER_SIZE.
There's also an AMF::encodeProperty, so maybe we should
use AMF_HEADER_SIZE in AMF::encodeElement ?
Most of the problems I encounter seems to be based
on computing the encoded size of an Element object.
Element::getDataSize only returns the size of the
underlying Buffer, but an Element might also have
a name, and an optional list of Element properties,
each with its own size.
Should we define a ::getEncodedSize function to
scan all componets and tell us ?
--strk;