diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5aa6a540c5b2f59553d088ad58fad07f638840fa..be61074b169be9b17a97adf1c9a786a181f1d095 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -930,7 +930,7 @@ static int handle_client_bw(URLContext *s, RTMPPacket *pkt)
         av_log(s, AV_LOG_ERROR,
                "Client bandwidth report packet is less than 4 bytes long (%d)\n",
                pkt->data_size);
-        return -1;
+        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;