X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=h264encode.cpp;h=dd2c80560840c52155dca439c1a8c1335145731f;hb=4e201129e8c4b6f072189636797858bf4c24b697;hp=51ad5178704922c56dd474db247405077e45aae3;hpb=d7bba4abb3d56893399578f0540b9ded0a28380f;p=nageru diff --git a/h264encode.cpp b/h264encode.cpp index 51ad517..dd2c805 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -29,6 +29,7 @@ #include #include "context.h" +#include "defs.h" #include "httpd.h" #include "timebase.h" @@ -113,7 +114,7 @@ static int frame_width = 176; static int frame_height = 144; static int frame_width_mbaligned; static int frame_height_mbaligned; -static int frame_rate = 60; +static int frame_rate = FPS; static unsigned int frame_bitrate = 0; static unsigned int frame_slices = 1; static double frame_size = 0; @@ -121,7 +122,7 @@ static int initial_qp = 15; //static int initial_qp = 28; static int minimal_qp = 0; static int intra_period = 30; -static int intra_idr_period = 60; +static int intra_idr_period = FPS; static int ip_period = 3; static int rc_mode = -1; static int rc_default_modes[] = { @@ -1835,7 +1836,7 @@ H264Encoder::H264Encoder(QSurface *surface, int width, int height, HTTPD *httpd) AVCodec *codec_audio = avcodec_find_encoder(AV_CODEC_ID_MP3); context_audio = avcodec_alloc_context3(codec_audio); context_audio->bit_rate = 256000; - context_audio->sample_rate = 48000; + context_audio->sample_rate = OUTPUT_FREQUENCY; context_audio->sample_fmt = AV_SAMPLE_FMT_FLTP; context_audio->channels = 2; context_audio->channel_layout = AV_CH_LAYOUT_STEREO; @@ -1868,7 +1869,7 @@ H264Encoder::H264Encoder(QSurface *surface, int width, int height, HTTPD *httpd) copy_thread = std::thread([this]{ //SDL_GL_MakeCurrent(window, context); - QOpenGLContext *context = create_context(); + QOpenGLContext *context = create_context(this->surface); eglBindAPI(EGL_OPENGL_API); if (!make_current(context, this->surface)) { printf("display=%p surface=%p context=%p curr=%p err=%d\n", eglGetCurrentDisplay(), this->surface, context, eglGetCurrentContext(),