]> git.sesse.net Git - nageru/blobdiff - nageru/decklink_output.cpp
Yet another crash fix in changing output cards.
[nageru] / nageru / decklink_output.cpp
index 5cf3abf5f391f6c301e51f6378256aad87cae8a4..56a184e99b326cc6ab3107c985f59bf0345bd384 100644 (file)
@@ -82,6 +82,13 @@ DeckLinkOutput::DeckLinkOutput(ResourcePool *resource_pool, QSurface *surface, u
        });
 }
 
+DeckLinkOutput::~DeckLinkOutput()
+{
+       if (output != nullptr) {
+               output->Release();
+       }
+}
+
 bool DeckLinkOutput::set_device(IDeckLink *decklink, IDeckLinkInput *input_arg)
 {
        input = input_arg;
@@ -258,15 +265,6 @@ void DeckLinkOutput::end_output()
                        frame_freelist.pop();
                }
        }
-
-       if (input != nullptr) {
-               input->Release();
-               input = nullptr;
-       }
-       if (output != nullptr) {
-               output->Release();
-               output = nullptr;
-       }
 }
 
 void DeckLinkOutput::send_frame(GLuint y_tex, GLuint cbcr_tex, YCbCrLumaCoefficients output_ycbcr_coefficients, const vector<RefCountedFrame> &input_frames, int64_t pts, int64_t duration)