The MPEG-1/-2 video packetizer has to create a new packet_t structure for each packet it passes downstream because it may produce more than one output packet from each input packet, and packet_t structures must only be used once.

This commit is contained in:
Moritz Bunkus 2005-06-24 07:52:23 +00:00
parent f76cf0353e
commit 8b5d160c70

View File

@ -219,15 +219,13 @@ mpeg1_2_video_packetizer_c::process(packet_cptr packet) {
if (hcodec_private == NULL)
create_private_data();
packet->memory = memory_cptr(new memory_c(frame->data, frame->size,
true));
packet->timecode = frame->timecode;
packet->duration = frame->duration;
packet->bref = frame->firstRef;
packet->fref = frame->secondRef;
packet->time_factor =
packet_t *new_packet =
new packet_t(new memory_c(frame->data, frame->size, true),
frame->timecode, frame->duration,
frame->firstRef, frame->secondRef);
new_packet->time_factor =
MPEG2_PICTURE_TYPE_FRAME == frame->pictureStructure ? 1 : 2;
video_packetizer_c::process(packet);
video_packetizer_c::process(packet_cptr(new_packet));
frame->data = NULL;
delete frame;