Mercurial > libavformat.hg
comparison rtp.c @ 2587:d751acab2622 libavformat
Allow to set the maximum number of frames per RTP packet (and add support for
this in the AAC packetizer)
author | lucabe |
---|---|
date | Tue, 02 Oct 2007 14:48:08 +0000 |
parents | 5fa858c38291 |
children | cc693f9e80ee |
comparison
equal
deleted
inserted
replaced
2586:1813683cc888 | 2587:d751acab2622 |
---|---|
745 max_packet_size = url_fget_max_packet_size(&s1->pb); | 745 max_packet_size = url_fget_max_packet_size(&s1->pb); |
746 if (max_packet_size <= 12) | 746 if (max_packet_size <= 12) |
747 return AVERROR(EIO); | 747 return AVERROR(EIO); |
748 s->max_payload_size = max_packet_size - 12; | 748 s->max_payload_size = max_packet_size - 12; |
749 | 749 |
750 s->max_frames_per_packet = 0; | |
751 if (s1->max_delay) { | |
752 if (st->codec->codec_type == CODEC_TYPE_AUDIO) { | |
753 if (st->codec->frame_size == 0) { | |
754 av_log(s1, AV_LOG_ERROR, "Cannot respect max delay: frame size = 0\n"); | |
755 } else { | |
756 s->max_frames_per_packet = av_rescale_rnd(s1->max_delay, st->codec->sample_rate, AV_TIME_BASE * st->codec->frame_size, AV_ROUND_DOWN); | |
757 } | |
758 } | |
759 if (st->codec->codec_type == CODEC_TYPE_VIDEO) { | |
760 /* FIXME: We should round down here... */ | |
761 s->max_frames_per_packet = av_rescale_q(s1->max_delay, AV_TIME_BASE_Q, st->codec->time_base); | |
762 } | |
763 } | |
764 | |
750 av_set_pts_info(st, 32, 1, 90000); | 765 av_set_pts_info(st, 32, 1, 90000); |
751 switch(st->codec->codec_id) { | 766 switch(st->codec->codec_id) { |
752 case CODEC_ID_MP2: | 767 case CODEC_ID_MP2: |
753 case CODEC_ID_MP3: | 768 case CODEC_ID_MP3: |
754 s->buf_ptr = s->buf + 4; | 769 s->buf_ptr = s->buf + 4; |