From b300bb0e8f761d39dba2fedaad28ec5537059cf2 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 7 Jan 2016 22:17:28 +0100 Subject: [PATCH] Make current_frame_encoding non-global. --- h264encode.cpp | 17 +++++++---------- h264encode.h | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/h264encode.cpp b/h264encode.cpp index 4d7882a..3520158 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -131,7 +131,6 @@ static int rc_default_modes[] = { VA_RC_VCM, VA_RC_NONE, }; -static unsigned long long current_frame_encoding = 0; static unsigned long long current_frame_display = 0; static unsigned long long current_IDR_display = 0; static unsigned int current_frame_num = 0; @@ -1525,7 +1524,7 @@ static void render_packedslice() free(packedslice_buffer); } -static int render_slice(void) +static int render_slice(int encoding_frame_num) { VABufferID slice_param_buf; VAStatus va_status; @@ -1538,7 +1537,7 @@ static int render_slice(void) slice_param.num_macroblocks = frame_width_mbaligned * frame_height_mbaligned/(16*16); /* Measured by MB */ slice_param.slice_type = (current_frame_type == FRAME_IDR)?2:current_frame_type; if (current_frame_type == FRAME_IDR) { - if (current_frame_encoding != 0) + if (encoding_frame_num != 0) ++slice_param.idr_pic_id; } else if (current_frame_type == FRAME_P) { int refpiclist0_max = h264_maxref & 0xffff; @@ -1780,7 +1779,6 @@ H264Encoder::H264Encoder(QSurface *surface, int width, int height, HTTPD *httpd) frame_width_mbaligned = (frame_width + 15) & (~15); frame_height_mbaligned = (frame_height + 15) & (~15); frame_bitrate = 15000000; // / 60; - current_frame_encoding = 0; //print_input(); @@ -1914,10 +1912,10 @@ void H264Encoder::end_frame(RefCountedGLsync fence, int64_t pts, const vector