Revision 08e696c0 libavformat/rtpenc.c

View differences:

libavformat/rtpenc.c
60 60
    case CODEC_ID_PCM_U16LE:
61 61
    case CODEC_ID_PCM_U8:
62 62
    case CODEC_ID_MPEG2TS:
63
    case CODEC_ID_AMR_NB:
64
    case CODEC_ID_AMR_WB:
63 65
        return 1;
64 66
    default:
65 67
        return 0;
......
134 136
        s->max_payload_size = n * TS_PACKET_SIZE;
135 137
        s->buf_ptr = s->buf;
136 138
        break;
139
    case CODEC_ID_AMR_NB:
140
    case CODEC_ID_AMR_WB:
141
        if (!s->max_frames_per_packet)
142
            s->max_frames_per_packet = 12;
143
        if (st->codec->codec_id == CODEC_ID_AMR_NB)
144
            n = 31;
145
        else
146
            n = 61;
147
        /* max_header_toc_size + the largest AMR payload must fit */
148
        if (1 + s->max_frames_per_packet + n > s->max_payload_size) {
149
            av_log(s1, AV_LOG_ERROR, "RTP max payload size too small for AMR\n");
150
            return -1;
151
        }
152
        if (st->codec->channels != 1) {
153
            av_log(s1, AV_LOG_ERROR, "Only mono is supported\n");
154
            return -1;
155
        }
137 156
    case CODEC_ID_AAC:
138 157
        s->num_frames = 0;
139 158
    default:
......
366 385
    case CODEC_ID_AAC:
367 386
        ff_rtp_send_aac(s1, buf1, size);
368 387
        break;
388
    case CODEC_ID_AMR_NB:
389
    case CODEC_ID_AMR_WB:
390
        ff_rtp_send_amr(s1, buf1, size);
391
        break;
369 392
    case CODEC_ID_MPEG2TS:
370 393
        rtp_send_mpegts_raw(s1, buf1, size);
371 394
        break;

Also available in: Unified diff