mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-30 22:00:51 +08:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user