mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-17 20:37:04 +00:00
avformat/rtpdec_rfc4175: fix interlace format
In previous state, a new frame was allocated on each timestamp step, i.e. each frame/field transition. However, for interlace, a new frame should be allocated on 1st field, completed with the 2nd and finally freed. This commit fixes the frame allocation and the detection of missing RTP markers. Signed-off-by: Patrick Keroulas <patrick.keroulas@radio-canada.ca> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
cc5eb2e662
commit
00692139c9
@ -234,20 +234,21 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data,
|
|||||||
uint8_t *dest;
|
uint8_t *dest;
|
||||||
|
|
||||||
if (*timestamp != data->timestamp) {
|
if (*timestamp != data->timestamp) {
|
||||||
if (data->frame) {
|
if (data->frame && (!data->interlaced || data->field)) {
|
||||||
/*
|
/*
|
||||||
* if we're here, it means that two RTP packets didn't have the
|
* if we're here, it means that we missed the cue to return
|
||||||
* same timestamp, which is a sign that they were packets from two
|
* the previous AVPacket, that cue being the RTP_FLAG_MARKER
|
||||||
* different frames, but we didn't get the flag RTP_FLAG_MARKER on
|
* in the last packet of either the previous frame (progressive)
|
||||||
* the first one of these frames (last packet of a frame).
|
* or the previous second field (interlace). Let's finalize the
|
||||||
* Finalize the previous frame anyway by filling the AVPacket.
|
* previous frame (or pair of fields) anyway by filling the AVPacket.
|
||||||
*/
|
*/
|
||||||
av_log(ctx, AV_LOG_ERROR, "Missed previous RTP Marker\n");
|
av_log(ctx, AV_LOG_ERROR, "Missed previous RTP Marker\n");
|
||||||
missed_last_packet = 1;
|
missed_last_packet = 1;
|
||||||
rfc4175_finalize_packet(data, pkt, st->index);
|
rfc4175_finalize_packet(data, pkt, st->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->frame = av_malloc(data->frame_size);
|
if (!data->frame)
|
||||||
|
data->frame = av_malloc(data->frame_size);
|
||||||
|
|
||||||
data->timestamp = *timestamp;
|
data->timestamp = *timestamp;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user