It is necessary to prefer the image in the packet to in_frame as it has been timestamped etc

This commit is contained in:
Isaac Connor 2021-01-29 15:37:51 -05:00
parent 292e1b4c9e
commit b812e0d484
1 changed files with 13 additions and 13 deletions

View File

@ -977,7 +977,19 @@ int VideoStore::writeVideoFramePacket(ZMPacket *zm_packet) {
return 0; return 0;
} }
if ( !zm_packet->in_frame ) { if ( zm_packet->image ) {
Debug(2, "Have an image, convert it");
//Go straight to out frame
swscale.Convert(
zm_packet->image,
zm_packet->buffer,
zm_packet->codec_imgsize,
zm_packet->image->AVPixFormat(),
video_out_ctx->pix_fmt,
video_out_ctx->width,
video_out_ctx->height
);
} else if ( !zm_packet->in_frame ) {
Debug(4, "Have no in_frame"); Debug(4, "Have no in_frame");
if ( zm_packet->packet.size ) { if ( zm_packet->packet.size ) {
Debug(4, "Decoding"); Debug(4, "Decoding");
@ -987,18 +999,6 @@ int VideoStore::writeVideoFramePacket(ZMPacket *zm_packet) {
} }
// Go straight to out frame // Go straight to out frame
swscale.Convert(zm_packet->in_frame, out_frame); swscale.Convert(zm_packet->in_frame, out_frame);
} else if ( zm_packet->image ) {
Debug(2, "Have an image, convert it");
//Go straight to out frame
swscale.Convert(
zm_packet->image,
zm_packet->buffer,
zm_packet->codec_imgsize,
zm_packet->image->AVPixFormat(),
video_out_ctx->pix_fmt,
video_out_ctx->width,
video_out_ctx->height
);
} else { } else {
Error("Have neither in_frame or image in packet %p %d!", Error("Have neither in_frame or image in packet %p %d!",