From: Steinar H. Gunderson Date: Thu, 7 Jan 2016 23:00:34 +0000 (+0100) Subject: Rename copy_thread to encode_thread. X-Git-Tag: 1.0.0~43 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=baf23298b4648b3e2ad708041834376a47a2db3e Rename copy_thread to encode_thread. --- diff --git a/h264encode.cpp b/h264encode.cpp index 641cf50..79697c8 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -1610,8 +1610,8 @@ void H264Encoder::save_codeddata(storage_task task) vector audio; { unique_lock lock(frame_queue_mutex); - frame_queue_nonempty.wait(lock, [this]{ return copy_thread_should_quit || !pending_audio_frames.empty(); }); - if (copy_thread_should_quit && pending_audio_frames.empty()) return; + frame_queue_nonempty.wait(lock, [this]{ return encode_thread_should_quit || !pending_audio_frames.empty(); }); + if (encode_thread_should_quit && pending_audio_frames.empty()) return; auto it = pending_audio_frames.begin(); if (it->first > task.pts) break; audio_pts = it->first; @@ -1777,7 +1777,7 @@ H264Encoder::H264Encoder(QSurface *surface, int width, int height, HTTPD *httpd) storage_thread = thread(&H264Encoder::storage_task_thread, this); - copy_thread = thread([this]{ + encode_thread = thread([this]{ //SDL_GL_MakeCurrent(window, context); QOpenGLContext *context = create_context(this->surface); eglBindAPI(EGL_OPENGL_API); @@ -1786,7 +1786,7 @@ H264Encoder::H264Encoder(QSurface *surface, int width, int height, HTTPD *httpd) eglGetError()); exit(1); } - copy_thread_func(); + encode_thread_func(); }); } @@ -1794,10 +1794,10 @@ H264Encoder::~H264Encoder() { { unique_lock lock(frame_queue_mutex); - copy_thread_should_quit = true; + encode_thread_should_quit = true; frame_queue_nonempty.notify_all(); } - copy_thread.join(); + encode_thread.join(); { unique_lock lock(storage_task_queue_mutex); storage_thread_should_quit = true; @@ -1892,7 +1892,7 @@ void H264Encoder::end_frame(RefCountedGLsync fence, int64_t pts, const vector lock(frame_queue_mutex); frame_queue_nonempty.wait(lock, [this, display_frame_num]{ - return copy_thread_should_quit || pending_video_frames.count(display_frame_num) != 0; + return encode_thread_should_quit || pending_video_frames.count(display_frame_num) != 0; }); - if (copy_thread_should_quit) { + if (encode_thread_should_quit) { return; } else { frame = move(pending_video_frames[display_frame_num]); diff --git a/h264encode.h b/h264encode.h index eadfca7..748fa51 100644 --- a/h264encode.h +++ b/h264encode.h @@ -87,14 +87,14 @@ private: int64_t pts; }; - void copy_thread_func(); + void encode_thread_func(); void encode_frame(PendingFrame frame, int encoding_frame_num, int display_frame_num, int gop_start_display_frame_num, int frame_type, int64_t pts, int64_t dts); void storage_task_thread(); void storage_task_enqueue(storage_task task); void save_codeddata(storage_task task); - std::thread copy_thread, storage_thread; + std::thread encode_thread, storage_thread; std::mutex storage_task_queue_mutex; std::condition_variable storage_task_queue_changed; @@ -104,7 +104,7 @@ private: std::mutex frame_queue_mutex; std::condition_variable frame_queue_nonempty; - bool copy_thread_should_quit = false; // under frame_queue_mutex + bool encode_thread_should_quit = false; // under frame_queue_mutex //int frame_width, frame_height; //int ;