|
|
|
|
@ -204,6 +204,8 @@ bool StreamVideoEncoder::encode(const QImage& image, uint64_t pts, bool key, QLi
|
|
|
|
|
} |
|
|
|
|
StreamEncodedFrame encoded; encoded.key = (packet->flags & AV_PKT_FLAG_KEY) != 0; |
|
|
|
|
encoded.pts = packet->pts >= 0 ? static_cast<uint64_t>(packet->pts) : pts; |
|
|
|
|
if (key) DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "desktop requested KEY name=%s input_PTS=%llu output_PTS=%llu key=%d flags=%x bytes=%d", |
|
|
|
|
qPrintable(m->name), (unsigned long long)pts, (unsigned long long)encoded.pts, encoded.key, packet->flags, packet->size); |
|
|
|
|
if (encoded.key) { |
|
|
|
|
const uint8_t* config = m->filter ? m->filter->par_out->extradata : m->codec->extradata; |
|
|
|
|
int length = m->filter ? m->filter->par_out->extradata_size : m->codec->extradata_size; |
|
|
|
|
@ -216,7 +218,11 @@ bool StreamVideoEncoder::encode(const QImage& image, uint64_t pts, bool key, QLi
|
|
|
|
|
output.push_back(std::move(encoded)); av_packet_unref(packet); |
|
|
|
|
} |
|
|
|
|
av_packet_free(&packet); |
|
|
|
|
if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) return true; |
|
|
|
|
if (result == AVERROR(EAGAIN) || result == AVERROR_EOF) { |
|
|
|
|
if (key && output.isEmpty()) DEBUG_DEBUG(DEBUG_CATEGORY_VIDEO, "desktop requested KEY buffered name=%s PTS=%llu", |
|
|
|
|
qPrintable(m->name), (unsigned long long)pts); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
if (result < 0) { m->error = ffError(result); DEBUG_ERROR(DEBUG_CATEGORY_VIDEO, "desktop encode failed name=%s PTS=%llu: %s", |
|
|
|
|
qPrintable(m->name), (unsigned long long)pts, qPrintable(m->error)); return false; } |
|
|
|
|
return true; |
|
|
|
|
|