aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpdec_ac3.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-02-24 13:37:03 +0200
committerMartin Storsjö <martin@martin.st>2015-02-24 23:07:44 +0200
commit199fb40278146c5bb162990c66ad3cd561abc780 (patch)
tree0411eef55863c799202a17254b8cc30e9601d28f /libavformat/rtpdec_ac3.c
parent8a273a746061a112e5e35066a8fd8e146d821a62 (diff)
downloadffmpeg-199fb40278146c5bb162990c66ad3cd561abc780.tar.gz
rtpdec: Use ffio_free_dyn_buf
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtpdec_ac3.c')
-rw-r--r--libavformat/rtpdec_ac3.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/libavformat/rtpdec_ac3.c b/libavformat/rtpdec_ac3.c
index 480fdd0cd5..a2ff961721 100644
--- a/libavformat/rtpdec_ac3.c
+++ b/libavformat/rtpdec_ac3.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "avio_internal.h"
#include "rtpdec_formats.h"
#define RTP_AC3_PAYLOAD_HEADER_SIZE 2
@@ -31,19 +32,9 @@ struct PayloadContext {
AVIOContext *fragment;
};
-static void free_fragment(PayloadContext *data)
-{
- if (data->fragment) {
- uint8_t *p;
- avio_close_dyn_buf(data->fragment, &p);
- av_free(p);
- data->fragment = NULL;
- }
-}
-
static void ac3_free_context(PayloadContext *data)
{
- free_fragment(data);
+ ffio_free_dyn_buf(&data->fragment);
}
static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
@@ -82,7 +73,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
case 1:
case 2: /* First fragment */
- free_fragment(data);
+ ffio_free_dyn_buf(&data->fragment);
data->last_frame = 1;
data->nr_frames = nr_frames;
@@ -102,7 +93,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
}
if (nr_frames != data->nr_frames ||
data->timestamp != *timestamp) {
- free_fragment(data);
+ ffio_free_dyn_buf(&data->fragment);
av_log(ctx, AV_LOG_ERROR, "Invalid packet received\n");
return AVERROR_INVALIDDATA;
}
@@ -115,7 +106,7 @@ static int ac3_handle_packet(AVFormatContext *ctx, PayloadContext *data,
return AVERROR(EAGAIN);
if (data->last_frame != data->nr_frames) {
- free_fragment(data);
+ ffio_free_dyn_buf(&data->fragment);
av_log(ctx, AV_LOG_ERROR, "Missed %d packets\n",
data->nr_frames - data->last_frame);
return AVERROR_INVALIDDATA;