fix(camera): set QSV decoder packet timebase
This commit is contained in:
parent
41d8482faf
commit
69b96cb60b
@ -430,6 +430,15 @@ bool UVCCamera::open_capture_()
|
||||
}
|
||||
|
||||
result = avcodec_parameters_to_context(capture_decoder_context_, video_stream->codecpar);
|
||||
if (result >= 0) {
|
||||
const AVRational stream_time_base = video_stream->time_base;
|
||||
capture_decoder_context_->pkt_timebase =
|
||||
stream_time_base.num > 0 && stream_time_base.den > 0
|
||||
? stream_time_base
|
||||
: AVRational{1, AV_TIME_BASE};
|
||||
capture_decoder_context_->framerate = av_guess_frame_rate(
|
||||
capture_format_context_, video_stream, nullptr);
|
||||
}
|
||||
if (result >= 0) {
|
||||
AVBufferRef* vaapi_device_context = nullptr;
|
||||
result = av_hwdevice_ctx_create(
|
||||
@ -473,6 +482,8 @@ bool UVCCamera::open_capture_()
|
||||
<< ", hardware_device=qsv"
|
||||
<< ", width=" << capture_decoder_context_->width
|
||||
<< ", height=" << capture_decoder_context_->height
|
||||
<< ", packet_time_base=" << capture_decoder_context_->pkt_timebase.num
|
||||
<< "/" << capture_decoder_context_->pkt_timebase.den
|
||||
<< ", requested_fps=" << fps_;
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user