From 662656e55bc5e23e501605a0c5f859f15bc4cfdc Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 19 Apr 2016 01:58:45 +0200 Subject: [PATCH] More shutdown issues with X264Encoder (still not fully there). --- h264encode.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/h264encode.cpp b/h264encode.cpp index b9c52eb..50d90a1 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -304,6 +304,16 @@ private: vector audio_queue_file; vector audio_queue_stream; + unique_ptr stream_mux; // To HTTP. + unique_ptr file_mux; // To local disk. + + // While Mux object is constructing, is true, + // and the header is being collected into stream_mux_header. + bool stream_mux_writing_header; + string stream_mux_header; + + bool stream_mux_writing_keyframes = false; + AVFrame *audio_frame = nullptr; HTTPD *httpd; unique_ptr reorderer; @@ -366,16 +376,6 @@ private: int frame_height; int frame_width_mbaligned; int frame_height_mbaligned; - - unique_ptr stream_mux; // To HTTP. - unique_ptr file_mux; // To local disk. - - // While Mux object is constructing, is true, - // and the header is being collected into stream_mux_header. - bool stream_mux_writing_header; - string stream_mux_header; - - bool stream_mux_writing_keyframes = false; }; // Supposedly vaRenderPicture() is supposed to destroy the buffer implicitly, @@ -2094,6 +2094,7 @@ void H264EncoderImpl::shutdown() frame_queue_nonempty.notify_all(); } encode_thread.join(); + x264_encoder.reset(); { unique_lock lock(storage_task_queue_mutex); storage_thread_should_quit = true; -- 2.39.2