mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
Merge commit '68b467742092364f9306283f40effde2c12efe08'
* commit '68b467742092364f9306283f40effde2c12efe08': lavf: Make probe_codec return an error code Conflicts: libavformat/utils.c A failure to reallocate should not free the array as it is used to probe the codec. And failure to reallocate if the following probe succeeds isnt a fatal error for probe_codec(). Thus this is only partially merged to ensure probing still is attempted with the data available. Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
3f760214b4
@ -579,7 +579,7 @@ static void force_codec_ids(AVFormatContext *s, AVStream *st)
|
||||
}
|
||||
}
|
||||
|
||||
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
|
||||
static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
|
||||
{
|
||||
if(st->request_probe>0){
|
||||
AVProbeData *pd = &st->probe_data;
|
||||
@ -622,11 +622,12 @@ no_packet:
|
||||
force_codec_ids(s, st);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
int ret, i;
|
||||
int ret, i, err;
|
||||
AVStream *st;
|
||||
|
||||
for(;;){
|
||||
@ -635,8 +636,10 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (pktl) {
|
||||
*pkt = pktl->pkt;
|
||||
st = s->streams[pkt->stream_index];
|
||||
if (s->raw_packet_buffer_remaining_size <= 0)
|
||||
probe_codec(s, st, NULL);
|
||||
if (s->raw_packet_buffer_remaining_size <= 0) {
|
||||
if ((err = probe_codec(s, st, NULL)) < 0)
|
||||
return err;
|
||||
}
|
||||
if(st->request_probe <= 0){
|
||||
s->raw_packet_buffer = pktl->next;
|
||||
s->raw_packet_buffer_remaining_size += pkt->size;
|
||||
@ -655,7 +658,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
st = s->streams[i];
|
||||
if (st->probe_packets) {
|
||||
probe_codec(s, st, NULL);
|
||||
if ((err = probe_codec(s, st, NULL)) < 0)
|
||||
return err;
|
||||
}
|
||||
av_assert0(st->request_probe <= 0);
|
||||
}
|
||||
@ -695,7 +699,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
|
||||
s->raw_packet_buffer_remaining_size -= pkt->size;
|
||||
|
||||
probe_codec(s, st, pkt);
|
||||
if ((err = probe_codec(s, st, pkt)) < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user