]> git.sesse.net Git - nageru/commitdiff
Rename copy_thread to encode_thread.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 7 Jan 2016 23:00:34 +0000 (00:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 7 Jan 2016 23:00:34 +0000 (00:00 +0100)
h264encode.cpp
h264encode.h

index 641cf5039bb2db9214d15e9277120a43f3e38a61..79697c8e239e24eda4eccfeee2599f3ec4e909ff 100644 (file)
@@ -1610,8 +1610,8 @@ void H264Encoder::save_codeddata(storage_task task)
         vector<float> audio;
         {
              unique_lock<mutex> 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<mutex> 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<mutex> 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<Re
        frame_queue_nonempty.notify_all();
 }
 
-void H264Encoder::copy_thread_func()
+void H264Encoder::encode_thread_func()
 {
        int64_t last_dts = -1;
        int gop_start_display_frame_num = 0;
@@ -1911,9 +1911,9 @@ void H264Encoder::copy_thread_func()
                {
                        unique_lock<mutex> 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]);
index eadfca7f50a9e8bd19ddb011793dab46ac9f3c7e..748fa5170812f387c819208b2059dee819db89c5 100644 (file)
@@ -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 ;