]> git.sesse.net Git - nageru/blobdiff - decklink_capture.cpp
Fix a compiler warning.
[nageru] / decklink_capture.cpp
index 92fd6ae296e567a402928bb3fd15a7e4f9300042..a0e890fcbcdd4fdc7c8bbb55e8212e8039980192 100644 (file)
@@ -8,6 +8,7 @@
 #ifdef __SSE2__
 #include <immintrin.h>
 #endif
+#include <pthread.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -301,12 +302,17 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
        IDeckLinkAudioInputPacket *audio_frame)
 {
        if (!done_init) {
+               char thread_name[16];
+               snprintf(thread_name, sizeof(thread_name), "DeckLink_C_%d", card_index);
+               pthread_setname_np(pthread_self(), thread_name);
                if (has_dequeue_callbacks) {
                        dequeue_init_callback();
                }
                done_init = true;
        }
 
+       steady_clock::time_point now = steady_clock::now();
+
        FrameAllocator::Frame current_video_frame, current_audio_frame;
        VideoFormat video_format;
        AudioFormat audio_format;
@@ -353,7 +359,7 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
                        video_format.width = width;
                        video_format.height = height;
 
-                       current_video_frame.received_timestamp = steady_clock::now();
+                       current_video_frame.received_timestamp = now;
                }
        }
 
@@ -371,7 +377,7 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived(
                        audio_format.bits_per_sample = 32;
                        audio_format.num_channels = 2;
 
-                       current_audio_frame.received_timestamp = steady_clock::now();
+                       current_audio_frame.received_timestamp = now;
                }
        }