aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-12 14:24:09 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-12 14:25:50 +0200
commit204c8798a89665d78d79c77ea5cc13ff1452f2e8 (patch)
treee630386ba97b44ff4db431f56c814a1b77242279
parent9767d7513cbc24f01221965c95e65a73bea780d2 (diff)
parent0662967d2bbdbe90540eaa8c847f521fa4b75aab (diff)
downloadffmpeg-204c8798a89665d78d79c77ea5cc13ff1452f2e8.tar.gz
Merge commit '0662967d2bbdbe90540eaa8c847f521fa4b75aab' into release/1.1
* commit '0662967d2bbdbe90540eaa8c847f521fa4b75aab': hls, segment: fix splitting for audio-only streams. afifo: fix request_samples on the last frame in certain cases id3v2: check for end of file while unescaping tags indeo3: fix off by one in MV validity check Conflicts: libavformat/id3v2.c libavformat/segment.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/indeo3.c8
-rw-r--r--libavfilter/fifo.c36
-rw-r--r--libavformat/hlsenc.c12
-rw-r--r--libavformat/id3v2.c6
4 files changed, 34 insertions, 28 deletions
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 6396f94a78..88cf9fec2f 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -242,8 +242,8 @@ static int copy_cell(Indeo3DecodeContext *ctx, Plane *plane, Cell *cell)
/* -1 because there is an extra line on top for prediction */
if ((cell->ypos << 2) + mv_y < -1 || (cell->xpos << 2) + mv_x < 0 ||
- ((cell->ypos + cell->height) << 2) + mv_y >= plane->height ||
- ((cell->xpos + cell->width) << 2) + mv_x >= plane->width) {
+ ((cell->ypos + cell->height) << 2) + mv_y > plane->height ||
+ ((cell->xpos + cell->width) << 2) + mv_x > plane->width) {
av_log(ctx->avctx, AV_LOG_ERROR,
"Motion vectors point out of the frame.\n");
return AVERROR_INVALIDDATA;
@@ -626,8 +626,8 @@ static int decode_cell(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
/* -1 because there is an extra line on top for prediction */
if ((cell->ypos << 2) + mv_y < -1 || (cell->xpos << 2) + mv_x < 0 ||
- ((cell->ypos + cell->height) << 2) + mv_y >= plane->height ||
- ((cell->xpos + cell->width) << 2) + mv_x >= plane->width) {
+ ((cell->ypos + cell->height) << 2) + mv_y > plane->height ||
+ ((cell->xpos + cell->width) << 2) + mv_x > plane->width) {
av_log(ctx->avctx, AV_LOG_ERROR,
"Motion vectors point out of the frame.\n");
return AVERROR_INVALIDDATA;
diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c
index 9597fb3255..b0894e7e2f 100644
--- a/libavfilter/fifo.c
+++ b/libavfilter/fifo.c
@@ -184,8 +184,25 @@ static int return_audio_frame(AVFilterContext *ctx)
}
while (s->buf_out->audio->nb_samples < s->allocated_samples) {
- int len = FFMIN(s->allocated_samples - s->buf_out->audio->nb_samples,
- head->audio->nb_samples);
+ int len;
+
+ if (!s->root.next &&
+ (ret = ff_request_frame(ctx->inputs[0])) < 0) {
+ if (ret == AVERROR_EOF) {
+ av_samples_set_silence(s->buf_out->extended_data,
+ s->buf_out->audio->nb_samples,
+ s->allocated_samples -
+ s->buf_out->audio->nb_samples,
+ nb_channels, link->format);
+ s->buf_out->audio->nb_samples = s->allocated_samples;
+ break;
+ }
+ return ret;
+ }
+ head = s->root.next->buf;
+
+ len = FFMIN(s->allocated_samples - s->buf_out->audio->nb_samples,
+ head->audio->nb_samples);
av_samples_copy(s->buf_out->extended_data, head->extended_data,
s->buf_out->audio->nb_samples, 0, len, nb_channels,
@@ -195,21 +212,6 @@ static int return_audio_frame(AVFilterContext *ctx)
if (len == head->audio->nb_samples) {
avfilter_unref_buffer(head);
queue_pop(s);
-
- if (!s->root.next &&
- (ret = ff_request_frame(ctx->inputs[0])) < 0) {
- if (ret == AVERROR_EOF) {
- av_samples_set_silence(s->buf_out->extended_data,
- s->buf_out->audio->nb_samples,
- s->allocated_samples -
- s->buf_out->audio->nb_samples,
- nb_channels, link->format);
- s->buf_out->audio->nb_samples = s->allocated_samples;
- break;
- }
- return ret;
- }
- head = s->root.next->buf;
} else {
buffer_offset(link, head, len);
}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 9eed9577b8..164a079877 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -252,18 +252,20 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
AVFormatContext *oc = hls->avf;
AVStream *st = s->streams[pkt->stream_index];
int64_t end_pts = hls->recording_time * hls->number;
- int ret;
+ int ret, can_split = 1;
if (hls->start_pts == AV_NOPTS_VALUE) {
hls->start_pts = pkt->pts;
hls->end_pts = pkt->pts;
}
- if ((hls->has_video && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
- av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
- end_pts, AV_TIME_BASE_Q) >= 0 &&
- pkt->flags & AV_PKT_FLAG_KEY) {
+ if (hls->has_video) {
+ can_split = st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
+ pkt->flags & AV_PKT_FLAG_KEY;
+ }
+ if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
+ end_pts, AV_TIME_BASE_Q) >= 0) {
ret = append_entry(hls, av_rescale(pkt->pts - hls->end_pts,
st->time_base.num,
st->time_base.den));
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 995b78bbb0..65c521dbe3 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -705,9 +705,11 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
uint8_t *b;
b = buffer;
- while (avio_tell(s->pb) < end && b - buffer < tlen) {
+ while (avio_tell(s->pb) < end && b - buffer < tlen && !s->pb->eof_reached) {
*b++ = avio_r8(s->pb);
- if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 && b - buffer < tlen) {
+ if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 &&
+ b - buffer < tlen &&
+ !s->pb->eof_reached ) {
uint8_t val = avio_r8(s->pb);
*b++ = val ? val : avio_r8(s->pb);
}