Merge commit '9a7b56883d1333cdfcdf0fa7584a333841b86114'

* commit '9a7b56883d1333cdfcdf0fa7584a333841b86114':
  au: set bit rate
  au: validate bits-per-sample separately from codec tag
  rtpdec_vp8: Mark broken packets with AV_PKT_FLAG_CORRUPT

Conflicts:
	libavformat/au.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/8/head
Michael Niedermayer 12 years ago
commit 70a65ecabf
  1. 12
      libavformat/au.c
  2. 5
      libavformat/rtpdec_vp8.c

@ -66,10 +66,11 @@ static int au_probe(AVProbeData *p)
/* au input */ /* au input */
static int au_read_header(AVFormatContext *s) static int au_read_header(AVFormatContext *s)
{ {
int size, bps, data_size = 0; int size, data_size = 0;
unsigned int tag; unsigned int tag;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int id, channels, rate; unsigned int id, channels, rate;
int bps;
enum AVCodecID codec; enum AVCodecID codec;
AVStream *st; AVStream *st;
@ -91,7 +92,13 @@ static int au_read_header(AVFormatContext *s)
codec = ff_codec_get_id(codec_au_tags, id); codec = ff_codec_get_id(codec_au_tags, id);
if (!(bps = av_get_bits_per_sample(codec))) { if (codec == AV_CODEC_ID_NONE) {
av_log_ask_for_sample(s, "unknown or unsupported codec tag: %d\n", id);
return AVERROR_PATCHWELCOME;
}
bps = av_get_bits_per_sample(codec);
if (!bps) {
av_log_ask_for_sample(s, "could not determine bits per sample\n"); av_log_ask_for_sample(s, "could not determine bits per sample\n");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
@ -115,6 +122,7 @@ static int au_read_header(AVFormatContext *s)
st->codec->codec_id = codec; st->codec->codec_id = codec;
st->codec->channels = channels; st->codec->channels = channels;
st->codec->sample_rate = rate; st->codec->sample_rate = rate;
st->codec->bit_rate = channels * rate * bps;
st->codec->block_align = FFMAX(bps * st->codec->channels / 8, 1); st->codec->block_align = FFMAX(bps * st->codec->channels / 8, 1);
if (data_size != AU_UNKNOWN_SIZE) if (data_size != AU_UNKNOWN_SIZE)
st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * (int64_t)bps); st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * (int64_t)bps);

@ -90,6 +90,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
if (ret < 0) if (ret < 0)
return ret; return ret;
*timestamp = vp8->timestamp; *timestamp = vp8->timestamp;
if (vp8->sequence_dirty)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
return 0; return 0;
} }
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
@ -199,6 +201,7 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
if (ret < 0) if (ret < 0)
return ret; return ret;
pkt->size = vp8->first_part_size; pkt->size = vp8->first_part_size;
pkt->flags |= AV_PKT_FLAG_CORRUPT;
returned_old_frame = 1; returned_old_frame = 1;
old_timestamp = vp8->timestamp; old_timestamp = vp8->timestamp;
} else { } else {
@ -261,6 +264,8 @@ static int vp8_handle_packet(AVFormatContext *ctx, PayloadContext *vp8,
return ret; return ret;
if (vp8->broken_frame) if (vp8->broken_frame)
pkt->size = vp8->first_part_size; pkt->size = vp8->first_part_size;
if (vp8->sequence_dirty)
pkt->flags |= AV_PKT_FLAG_CORRUPT;
return 0; return 0;
} }

Loading…
Cancel
Save