Compare commits

...

8 Commits
master ... v0.5

Author SHA1 Message Date
Andri Yngvason 68581dbb70 meson: Release v0.5.4 2022-09-10 15:55:35 +00:00
Andri Yngvason 5c5a696910 h264-encoder: Set async_depth=1
This fixes stalling during encoding. The FFmpeg devs seem to think that it's
normal to change the default behaviour or their code, so this needs to be
fixed here instead.

Fixes #73
2022-09-10 15:55:07 +00:00
Andri Yngvason 29ce32732f Release v0.5.3 2022-08-23 22:40:05 +00:00
Andri Yngvason 560fb8053d server: Fix encoding selection for sw frames
This fixes encoding selection when not using the --gpu option. Before this
change, raw encoding would always be selected.

Reported-by: Consolatis
Suggested-by: Consolatis
2022-08-23 22:39:30 +00:00
Andri Yngvason d8d15946c5 Revert "h264-encoder: Add 30 bit color depth formats"
This reverts commit 613761cf5f.

These are not available on older libav version and they don't event work.
2022-08-23 22:39:11 +00:00
Andri Yngvason 48d44a3ee9 Release v0.5.2 2022-08-23 21:24:42 +00:00
Andri Yngvason 05d408511f resampler: Use transformed width as destination stride
Fixes #72
2022-08-23 20:56:00 +00:00
Andri Yngvason bf332bd91f stream: Remove stray ampersand in tls handshake failure code path 2022-08-23 20:55:22 +00:00
5 changed files with 18 additions and 13 deletions

View File

@ -1,7 +1,7 @@
project( project(
'neatvnc', 'neatvnc',
'c', 'c',
version: '0.5.1', version: '0.5.4',
license: 'ISC', license: 'ISC',
default_options: [ default_options: [
'c_std=gnu11', 'c_std=gnu11',

View File

@ -34,6 +34,7 @@
#include <libavutil/hwcontext.h> #include <libavutil/hwcontext.h>
#include <libavutil/hwcontext_drm.h> #include <libavutil/hwcontext_drm.h>
#include <libavutil/pixdesc.h> #include <libavutil/pixdesc.h>
#include <libavutil/dict.h>
#include <libavfilter/avfilter.h> #include <libavfilter/avfilter.h>
#include <libavfilter/buffersink.h> #include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h> #include <libavfilter/buffersrc.h>
@ -99,12 +100,6 @@ static enum AVPixelFormat drm_to_av_pixel_format(uint32_t format)
case DRM_FORMAT_BGRX8888: case DRM_FORMAT_BGRX8888:
case DRM_FORMAT_BGRA8888: case DRM_FORMAT_BGRA8888:
return AV_PIX_FMT_0RGB; return AV_PIX_FMT_0RGB;
case DRM_FORMAT_XRGB2101010:
case DRM_FORMAT_ARGB2101010:
return AV_PIX_FMT_X2RGB10LE;
case DRM_FORMAT_BGRX1010102:
case DRM_FORMAT_BGRA1010102:
return AV_PIX_FMT_X2RGB10BE;
} }
return AV_PIX_FMT_NONE; return AV_PIX_FMT_NONE;
@ -423,7 +418,9 @@ static void h264_encoder__do_work(void* handle)
int rc = h264_encoder__encode(self, frame); int rc = h264_encoder__encode(self, frame);
if (rc != 0) { if (rc != 0) {
// TODO: log failure char err[256];
av_strerror(rc, err, sizeof(err));
nvnc_log(NVNC_LOG_ERROR, "Failed to encode packet: %s", err);
goto failure; goto failure;
} }
@ -449,8 +446,10 @@ static void h264_encoder__on_work_done(void* handle)
return; return;
} }
if (self->current_packet.len == 0) if (self->current_packet.len == 0) {
nvnc_log(NVNC_LOG_WARNING, "Whoops, encoded packet length is 0");
return; return;
}
void* userdata = self->userdata; void* userdata = self->userdata;
@ -542,7 +541,12 @@ struct h264_encoder* h264_encoder_create(uint32_t width, uint32_t height,
self->codec_ctx->hw_frames_ctx = self->codec_ctx->hw_frames_ctx =
av_buffer_ref(self->filter_out->inputs[0]->hw_frames_ctx); av_buffer_ref(self->filter_out->inputs[0]->hw_frames_ctx);
rc = avcodec_open2(self->codec_ctx, codec, NULL); AVDictionary *opts = NULL;
av_dict_set_int(&opts, "async_depth", 1, 0);
rc = avcodec_open2(self->codec_ctx, codec, &opts);
av_dict_free(&opts);
if (rc != 0) if (rc != 0)
goto avcodec_open_failure; goto avcodec_open_failure;

View File

@ -183,7 +183,7 @@ int resampler_feed(struct resampler* self, struct nvnc_fb* fb,
nvnc_transform_dimensions(fb->transform, &width, &height); nvnc_transform_dimensions(fb->transform, &width, &height);
nvnc_fb_pool_resize(self->pool, width, height, fb->fourcc_format, nvnc_fb_pool_resize(self->pool, width, height, fb->fourcc_format,
fb->stride); width);
struct aml* aml = aml_get_default(); struct aml* aml = aml_get_default();
assert(aml); assert(aml);

View File

@ -1353,13 +1353,14 @@ static enum rfb_encodings choose_frame_encoding(struct nvnc_client* client,
case RFB_ENCODING_RAW: case RFB_ENCODING_RAW:
case RFB_ENCODING_TIGHT: case RFB_ENCODING_TIGHT:
case RFB_ENCODING_ZRLE: case RFB_ENCODING_ZRLE:
return client->encodings[i];
#ifdef ENABLE_OPEN_H264 #ifdef ENABLE_OPEN_H264
case RFB_ENCODING_OPEN_H264: case RFB_ENCODING_OPEN_H264:
// h264 is useless for sw frames // h264 is useless for sw frames
if (fb->type != NVNC_FB_GBM_BO) if (fb->type != NVNC_FB_GBM_BO)
break; break;
#endif
return client->encodings[i]; return client->encodings[i];
#endif
default: default:
break; break;
} }

View File

@ -399,7 +399,7 @@ static int stream__try_tls_accept(struct stream* self)
} }
if (gnutls_error_is_fatal(rc)) { if (gnutls_error_is_fatal(rc)) {
aml_stop(aml_get_default(), &self->handler); aml_stop(aml_get_default(), self->handler);
return -1; return -1;
} }