fixed SURFACES full

This commit is contained in:
jojo61 2018-10-08 17:02:12 +02:00
parent 92333441bd
commit f03dde19ed
3 changed files with 41 additions and 36 deletions

View File

@ -457,6 +457,8 @@ void DisplayPts(AVCodecContext * video_ctx, AVFrame * frame)
** @param decoder video decoder data
** @param avpkt video packet
*/
extern int CuvidTestSurfaces();
void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
{
AVCodecContext *video_ctx;
@ -478,9 +480,9 @@ next_part:
if (ret1 >= 0) {
consumed = 1;
}
if (ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) { // decoder is full
if ((ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) && CuvidTestSurfaces()) {
ret = 0;
while (ret >= 0) { // get frames until empty
while ((ret >= 0) && CuvidTestSurfaces()) { // get frames until empty snd Surfaces avail.
ret = avcodec_receive_frame(video_ctx, frame); // get new frame
if (ret >= 0) { // one is avail.
@ -515,7 +517,7 @@ next_part:
}
}
} else {
consumed = 1;
// consumed = 1;
}
if (!consumed) {

View File

@ -2588,7 +2588,7 @@ void cSoftHdDevice::TrickSpeed(int speed)
*/
void cSoftHdDevice::Clear(void)
{
dsyslog("[softhddev]%s:\n", __FUNCTION__);
dsyslog("[softhddev] vom VDR kommt %s:\n", __FUNCTION__);
cDevice::Clear();
::Clear();

13
video.c
View File

@ -1353,7 +1353,7 @@ static VideoResolutions VideoResolutionGroup(int width, int height,
if (height <= 720) {
return VideoResolution720p;
}
if (height < 1080) {
if (height <= 1080) {
return VideoResolutionFake1080i;
}
if (width < 1920) {
@ -1864,7 +1864,11 @@ static void CuvidPrintFrames(const CuvidDecoder * decoder)
#endif
}
int CuvidTestSurfaces() {
if (atomic_read(&CuvidDecoders[0]->SurfacesFilled) < VIDEO_SURFACES_MAX)
return 1;
return 0;
}
///
/// Allocate new CUVID decoder.
@ -2296,7 +2300,7 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder,
Fatal(_("CUVID Init failed\n"));
}
#endif
CuvidMessage(2,"no CUVID Init ok %dx%d\n",video_ctx->width,video_ctx->height);
CuvidMessage(2,"CUVID Init ok %dx%d\n",video_ctx->width,video_ctx->height);
ist->active_hwaccel_id = HWACCEL_CUVID;
ist->hwaccel_pix_fmt = AV_PIX_FMT_CUDA;
decoder->InputWidth = video_ctx->width;
@ -4388,8 +4392,7 @@ void VideoRenderFrame(VideoHwDecoder * hw_decoder,
Timestamp2String(frame->pkt_pts), hw_decoder->Cuvid.Closing);
#endif
if (frame->repeat_pict && !VideoIgnoreRepeatPict) {
Warning(_("video: repeated pict %d found, but not handled\n"),
frame->repeat_pict);
Warning(_("video: repeated pict %d found, but not handled\n"), frame->repeat_pict);
}
VideoUsedModule->RenderFrame(hw_decoder, video_ctx, frame);
}