Fix a case in get_event_start_packet_it where if no pre_event_count we log an error and maybe don't start on a keyframe
This commit is contained in:
parent
4ea48708ed
commit
43f2f195f1
|
@ -645,7 +645,8 @@ packetqueue_iterator *PacketQueue::get_event_start_packet_it(
|
|||
// Step one count back pre_event_count frames as the minimum
|
||||
// Do not assume that snapshot_it is video
|
||||
// snapshot it might already point to the beginning
|
||||
while (( (*it) != pktQueue.begin() ) and pre_event_count) {
|
||||
if (pre_event_count) {
|
||||
while ((*it) != pktQueue.begin()) {
|
||||
packet = *(*it);
|
||||
Debug(1, "Previous packet pre_event_count %d stream_index %d keyframe %d score %d",
|
||||
pre_event_count, packet->packet.stream_index, packet->keyframe, packet->score);
|
||||
|
@ -657,13 +658,10 @@ packetqueue_iterator *PacketQueue::get_event_start_packet_it(
|
|||
}
|
||||
(*it)--;
|
||||
}
|
||||
}
|
||||
// it either points to beginning or we have seen pre_event_count video packets.
|
||||
|
||||
if ((*it) == pktQueue.begin()) {
|
||||
packet = *(*it);
|
||||
Debug(1, "Hit begin");
|
||||
// hit end, the first packet in the queue should ALWAYS be a video keyframe.
|
||||
// So we should be able to return it.
|
||||
if (pre_event_count) {
|
||||
if (packet->image_index < (int)pre_event_count) {
|
||||
// probably just starting up
|
||||
|
@ -672,24 +670,18 @@ packetqueue_iterator *PacketQueue::get_event_start_packet_it(
|
|||
Warning("Hit end of packetqueue before satisfying pre_event_count. Needed %d more video frames", pre_event_count);
|
||||
}
|
||||
ZM_DUMP_PACKET(packet->packet, "");
|
||||
}
|
||||
return it;
|
||||
}
|
||||
|
||||
// Not at beginning, so must be pointing at a video keyframe or maybe pre_event_count == 0
|
||||
if (packet->keyframe) {
|
||||
ZM_DUMP_PACKET(packet->packet, "Found video keyframe, Returning");
|
||||
return it;
|
||||
}
|
||||
|
||||
while (--(*it) != pktQueue.begin()) {
|
||||
while ((*it) != pktQueue.begin()) {
|
||||
packet = *(*it);
|
||||
ZM_DUMP_PACKET(packet->packet, "No keyframe");
|
||||
if ((packet->packet.stream_index == video_stream_id) and packet->keyframe)
|
||||
return it; // Success
|
||||
--(*it);
|
||||
}
|
||||
if (!(*(*it))->keyframe) {
|
||||
Warning("Hit end of packetqueue before satisfying pre_event_count. Needed %d more video frames", pre_event_count);
|
||||
Warning("Hit beginning of packetqueue and packet is not a keyframe. index is %d", packet->image_index);
|
||||
}
|
||||
return it;
|
||||
} // end packetqueue_iterator *PacketQueue::get_event_start_packet_it
|
||||
|
|
Loading…
Reference in New Issue