Commit 2edd3b7a authored by rbultje's avatar rbultje

Remove packet returning in ff_rm_parse_packet() if we're using the packet

cache, since this can already be accessed through ff_rm_retrieve_cache().
See "[PATCH] rmdec.c: remove cache access duplication" thread.



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@18009 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 356d3eda
...@@ -312,14 +312,16 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st, ...@@ -312,14 +312,16 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
pos = url_ftell(&pb); pos = url_ftell(&pb);
if (res < 0) if (res < 0)
return res; return res;
rdt->audio_pkt_cnt = res; if (res > 0) {
if (rdt->audio_pkt_cnt > 0 && if (st->codec->codec_id == CODEC_ID_AAC) {
st->codec->codec_id == CODEC_ID_AAC) {
memcpy (rdt->buffer, buf + pos, len - pos); memcpy (rdt->buffer, buf + pos, len - pos);
rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0, rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL);
}
goto get_cache;
} }
} else { } else {
get_cache:
rdt->audio_pkt_cnt = rdt->audio_pkt_cnt =
ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
st, rdt->rmst[st->index], pkt); st, rdt->rmst[st->index], pkt);
......
...@@ -64,9 +64,9 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb, ...@@ -64,9 +64,9 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
* @param flags pointer to an integer containing the packet flags, may be * @param flags pointer to an integer containing the packet flags, may be
updated updated
* @param ts pointer to timestamp, may be updated * @param ts pointer to timestamp, may be updated
* @return >=0 on success (where >0 indicates there are cached samples that * @return <0 on error, 0 if a packet was placed in the \p pkt pointer. A
* can be retrieved with subsequent calls to ff_rm_retrieve_cache()), * value >0 means that no data was placed in \p pkt, but that cached
* errno codes on error * data is available by calling ff_rm_retrieve_cache().
*/ */
int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
AVStream *st, RMStream *rst, int len, AVStream *st, RMStream *rst, int len,
......
...@@ -627,16 +627,9 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, ...@@ -627,16 +627,9 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
if (++(ast->sub_packet_cnt) < h) if (++(ast->sub_packet_cnt) < h)
return -1; return -1;
else {
ast->sub_packet_cnt = 0; ast->sub_packet_cnt = 0;
rm->audio_stream_num = st->index; rm->audio_stream_num = st->index;
rm->audio_pkt_cnt = h * w / st->codec->block_align - 1; rm->audio_pkt_cnt = h * w / st->codec->block_align;
// Release first audio packet
av_new_packet(pkt, st->codec->block_align);
memcpy(pkt->data, ast->pkt.data, st->codec->block_align); //FIXME avoid this
*timestamp = ast->audiotimestamp;
*flags = 2; // Mark first packet as keyframe
}
} else if (st->codec->codec_id == CODEC_ID_AAC) { } else if (st->codec->codec_id == CODEC_ID_AAC) {
int x; int x;
rm->audio_stream_num = st->index; rm->audio_stream_num = st->index;
...@@ -644,11 +637,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, ...@@ -644,11 +637,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
if (ast->sub_packet_cnt) { if (ast->sub_packet_cnt) {
for (x = 0; x < ast->sub_packet_cnt; x++) for (x = 0; x < ast->sub_packet_cnt; x++)
ast->sub_packet_lengths[x] = get_be16(pb); ast->sub_packet_lengths[x] = get_be16(pb);
// Release first audio packet rm->audio_pkt_cnt = ast->sub_packet_cnt;
rm->audio_pkt_cnt = ast->sub_packet_cnt - 1; ast->audiotimestamp = *timestamp;
av_get_packet(pb, pkt, ast->sub_packet_lengths[0]); } else
*flags = 2; // Mark first packet as keyframe return -1;
}
} else { } else {
av_get_packet(pb, pkt, len); av_get_packet(pb, pkt, len);
rm_ac3_swap_bytes(st, pkt); rm_ac3_swap_bytes(st, pkt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment