[FFmpeg-cvslog] rtmp: Return an error when the client bandwidth is incorrect
Samuel Pitoiset
git at videolan.org
Thu Jul 26 21:55:14 CEST 2012
ffmpeg | branch: master | Samuel Pitoiset <samuel.pitoiset at gmail.com> | Wed Jul 25 20:51:11 2012 +0200| [abf77a247baa19357bbf41d6460d4f65a8ff07f2] | committer: Martin Storsjö
rtmp: Return an error when the client bandwidth is incorrect
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abf77a247baa19357bbf41d6460d4f65a8ff07f2
---
libavformat/rtmpproto.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5ac60d2..a2efe38 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -932,8 +932,16 @@ static int handle_client_bw(URLContext *s, RTMPPacket *pkt)
pkt->data_size);
return AVERROR_INVALIDDATA;
}
- av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", AV_RB32(pkt->data));
- rt->client_report_size = AV_RB32(pkt->data) >> 1;
+
+ rt->client_report_size = AV_RB32(pkt->data);
+ if (rt->client_report_size <= 0) {
+ av_log(s, AV_LOG_ERROR, "Incorrect client bandwidth %d\n",
+ rt->client_report_size);
+ return AVERROR_INVALIDDATA;
+
+ }
+ av_log(s, AV_LOG_DEBUG, "Client bandwidth = %d\n", rt->client_report_size);
+ rt->client_report_size >>= 1;
return 0;
}
More information about the ffmpeg-cvslog
mailing list