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
|
// Step one count back pre_event_count frames as the minimum
|
||||||
// Do not assume that snapshot_it is video
|
// Do not assume that snapshot_it is video
|
||||||
// snapshot it might already point to the beginning
|
// 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);
|
packet = *(*it);
|
||||||
Debug(1, "Previous packet pre_event_count %d stream_index %d keyframe %d score %d",
|
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);
|
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)--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// it either points to beginning or we have seen pre_event_count video packets.
|
// it either points to beginning or we have seen pre_event_count video packets.
|
||||||
|
|
||||||
if ((*it) == pktQueue.begin()) {
|
|
||||||
packet = *(*it);
|
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 (pre_event_count) {
|
||||||
if (packet->image_index < (int)pre_event_count) {
|
if (packet->image_index < (int)pre_event_count) {
|
||||||
// probably just starting up
|
// 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);
|
Warning("Hit end of packetqueue before satisfying pre_event_count. Needed %d more video frames", pre_event_count);
|
||||||
}
|
}
|
||||||
ZM_DUMP_PACKET(packet->packet, "");
|
ZM_DUMP_PACKET(packet->packet, "");
|
||||||
}
|
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not at beginning, so must be pointing at a video keyframe or maybe pre_event_count == 0
|
while ((*it) != pktQueue.begin()) {
|
||||||
if (packet->keyframe) {
|
|
||||||
ZM_DUMP_PACKET(packet->packet, "Found video keyframe, Returning");
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (--(*it) != pktQueue.begin()) {
|
|
||||||
packet = *(*it);
|
packet = *(*it);
|
||||||
ZM_DUMP_PACKET(packet->packet, "No keyframe");
|
ZM_DUMP_PACKET(packet->packet, "No keyframe");
|
||||||
if ((packet->packet.stream_index == video_stream_id) and packet->keyframe)
|
if ((packet->packet.stream_index == video_stream_id) and packet->keyframe)
|
||||||
return it; // Success
|
return it; // Success
|
||||||
|
--(*it);
|
||||||
}
|
}
|
||||||
if ( !(*(*it))->keyframe ) {
|
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;
|
return it;
|
||||||
} // end packetqueue_iterator *PacketQueue::get_event_start_packet_it
|
} // end packetqueue_iterator *PacketQueue::get_event_start_packet_it
|
||||||
|
|
Loading…
Reference in New Issue