[FFmpeg-devel] [PATCH 2/6] RTMP output: small fixes

Kostya kostya.shishkov
Thu Dec 3 17:15:06 CET 2009


On Thu, Dec 03, 2009 at 05:14:49PM +0200, Sergiy wrote:
> 

> ---
>  libavformat/rtmppkt.h   |    2 +-
>  libavformat/rtmpproto.c |    5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
> index 8be5907..84ca54b 100644
> --- a/libavformat/rtmppkt.h
> +++ b/libavformat/rtmppkt.h
> @@ -73,7 +73,7 @@ enum RTMPPacketSize {
>   * structure for holding RTMP packets
>   */
>  typedef struct RTMPPacket {
> -    uint8_t        channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)
> +    uint16_t       channel_id; ///< RTMP channel ID (nothing to do with audio/video channels though)

Still too small - maximum value is 65599 which won't fit into uint16_t
either. I made it simple integer.

>      RTMPPacketType type;       ///< packet payload type
>      uint32_t       timestamp;  ///< packet full timestamp
>      uint32_t       ts_delta;   ///< timestamp increment to the previous one in milliseconds (latter only for media packets)
> diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
> index 296cb7e..61b611d 100644
> --- a/libavformat/rtmpproto.c
> +++ b/libavformat/rtmpproto.c
> @@ -434,15 +434,14 @@ static int rtmp_parse_result(URLContext *s, RTMPContext *rt, RTMPPacket *pkt)
>                      av_log(LOG_CONTEXT, AV_LOG_WARNING, "Unexpected reply on connect()\n");
>                  } else {
>                      rt->main_channel_id = (int) av_int2dbl(AV_RB64(pkt->data + 21));
> +                    gen_play(s, rt);
> +                    rt->state = STATE_READY;
>                  }
> -                gen_play(s, rt);
> -                rt->state = STATE_READY;
>                  break;

Why?

>              }
>          } else if (!memcmp(pkt->data, "\002\000\010onStatus", 11)) {
>              const uint8_t* ptr = pkt->data + 11;
>              uint8_t tmpstr[256];
> -            int t;
>  
>              for (i = 0; i < 2; i++) {
>                  t = ff_amf_tag_size(ptr, data_end);

Plain wrong - variable is used right below.



More information about the ffmpeg-devel mailing list