rtmpproto: Make bytes_read variables 64bit.

Message ID 20170125082946.16876-1-martin@martin.st
State Superseded
Headers show

Commit Message

Martin Storsjö Jan. 25, 2017, 8:29 a.m.
From: Carl Eugen Hoyos <cehoyos@ag.or.at>

When bytes_read overflowed, last_bytes_read did not yet overflow
and no bytes-read report was created leading to a timeout.

Analyzed-by: Thomas Bernhard
---
 libavformat/rtmpproto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Luca Barbato Jan. 25, 2017, 9:46 a.m. | #1
On 25/01/2017 09:29, Martin Storsjö wrote:
> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
> 
> When bytes_read overflowed, last_bytes_read did not yet overflow
> and no bytes-read report was created leading to a timeout.
> 
> Analyzed-by: Thomas Bernhard
> ---
>  libavformat/rtmpproto.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Not against it, but theoretically wouldn't the problem present itself
unchanged once you shove enough data in? (yes would take quite a bit of
time given the current network fabrics available).

lu
Martin Storsjö Jan. 25, 2017, 9:51 a.m. | #2
On Wed, 25 Jan 2017, Luca Barbato wrote:

> On 25/01/2017 09:29, Martin Storsjö wrote:
>> From: Carl Eugen Hoyos <cehoyos@ag.or.at>
>> 
>> When bytes_read overflowed, last_bytes_read did not yet overflow
>> and no bytes-read report was created leading to a timeout.
>> 
>> Analyzed-by: Thomas Bernhard
>> ---
>>  libavformat/rtmpproto.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>
> Not against it, but theoretically wouldn't the problem present itself
> unchanged once you shove enough data in? (yes would take quite a bit of
> time given the current network fabrics available).

Theoretically yes, but I'm quite ok with a solution that breaks after 
sending/receiving 2^64 bytes.

// Martin

Patch

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5298c18..09d22eb 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -94,8 +94,8 @@  typedef struct RTMPContext {
     int           flv_nb_packets;             ///< number of flv packets published
     RTMPPacket    out_pkt;                    ///< rtmp packet, created from flv a/v or metadata (for output)
     uint32_t      client_report_size;         ///< number of bytes after which client should report to server
-    uint32_t      bytes_read;                 ///< number of bytes read from server
-    uint32_t      last_bytes_read;            ///< number of bytes read last reported to server
+    uint64_t      bytes_read;                 ///< number of bytes read from server
+    uint64_t      last_bytes_read;            ///< number of bytes read last reported to server
     uint32_t      last_timestamp;             ///< last timestamp received in a packet
     int           skip_bytes;                 ///< number of bytes to skip from the input FLV stream in the next write call
     int           has_audio;                  ///< presence of audio data