- } else {
- /* At this point, the RTP header has been stripped;
- * This is ASSUMING that there is only 1 CSRC, which isn't wise. */
- switch (st->codec->codec_id) {
- case AV_CODEC_ID_MP2:
- case AV_CODEC_ID_MP3:
- /* better than nothing: skip MPEG audio RTP header */
- if (len <= 4)
- return -1;
- h = AV_RB32(buf);
- len -= 4;
- buf += 4;
- if (av_new_packet(pkt, len) < 0)
- return AVERROR(ENOMEM);
- memcpy(pkt->data, buf, len);
- break;
- case AV_CODEC_ID_MPEG1VIDEO:
- case AV_CODEC_ID_MPEG2VIDEO:
- /* better than nothing: skip MPEG video RTP header */
- if (len <= 4)
- return -1;
- h = AV_RB32(buf);
- buf += 4;
- len -= 4;
- if (h & (1 << 26)) {
- /* MPEG-2 */
- if (len <= 4)
- return -1;
- buf += 4;
- len -= 4;
- }
- if (av_new_packet(pkt, len) < 0)
- return AVERROR(ENOMEM);
- memcpy(pkt->data, buf, len);
- break;
- default:
- if (av_new_packet(pkt, len) < 0)
- return AVERROR(ENOMEM);
- memcpy(pkt->data, buf, len);
- break;
- }
-
+ } else if (st) {
+ if ((rv = av_new_packet(pkt, len)) < 0)
+ return rv;
+ memcpy(pkt->data, buf, len);