]> git.sesse.net Git - mlt/commitdiff
Call invalidate_pixel_data() after frame rendering.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 21 Jan 2014 22:46:04 +0000 (23:46 +0100)
committerDan Dennedy <dan@dennedy.org>
Sun, 26 Jan 2014 19:59:50 +0000 (11:59 -0800)
This helps the input return its values back to the ResourcePool,
which means we won't be allocating ever more textures as we get
more clips on the timeline.

src/modules/opengl/filter_movit_convert.cpp
src/modules/opengl/mlt_movit_input.cpp
src/modules/opengl/mlt_movit_input.h

index 8595173e8d5a3702822f64c1d749795b6240ebb5..3f7b587976eb5220773120bdd6d8f24beaf97d4a 100644 (file)
@@ -307,22 +307,24 @@ static void set_movit_parameters( GlslChain *chain, mlt_service service, mlt_fra
        }
 }
 
-static void dispose_pixel_pointers( mlt_service service, mlt_frame frame )
+static void dispose_pixel_pointers( GlslChain *chain, mlt_service service, mlt_frame frame )
 {
        if ( service == (mlt_service) -1 ) {
                mlt_producer producer = mlt_producer_cut_parent( mlt_frame_get_original_producer( frame ) );
+               MltInput* input = (MltInput *) chain->effects[ MLT_PRODUCER_SERVICE( producer ) ];
+               input->invalidate_pixel_data();
                mlt_pool_release( GlslManager::get_input_pixel_pointer( producer, frame ) );
                return;
        }
 
        mlt_service input_a = GlslManager::get_effect_input( service, frame );
-       dispose_pixel_pointers( input_a, frame );
+       dispose_pixel_pointers( chain, input_a, frame );
 
        mlt_service input_b;
        mlt_frame frame_b;
        GlslManager::get_effect_secondary_input( service, frame, &input_b, &frame_b );
        if ( input_b ) {
-               dispose_pixel_pointers( input_b, frame_b );
+               dispose_pixel_pointers( chain, input_b, frame_b );
        }
 }
 
@@ -442,7 +444,7 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo
 
                error = movit_render( chain->effect_chain, frame, format, output_format, width, height, image );
 
-               dispose_pixel_pointers( leaf_service, frame );
+               dispose_pixel_pointers( chain, leaf_service, frame );
        }
 
        // If we've been asked to render some frame directly to a texture (without any
index a75fe1ffdd5798ca422e590452083de100050515..59306be4474cfd9c8feb84170e3877b11265812f 100644 (file)
@@ -120,3 +120,15 @@ void MltInput::set_pixel_data(const unsigned char* data)
                ycbcr->set_pixel_data(2, &data[m_width * m_height + (m_width / m_ycbcr_format.chroma_subsampling_x * m_height / m_ycbcr_format.chroma_subsampling_y)]);
        }
 }
+
+void MltInput::invalidate_pixel_data()
+{
+       assert(input);
+       if (isRGB) {
+               FlatInput* flat = (FlatInput*) input;
+               flat->invalidate_pixel_data();
+       } else {
+               YCbCrInput* ycbcr = (YCbCrInput*) input;
+               ycbcr->invalidate_pixel_data();
+       }
+}
index d7f64c55b2bbcdcb73f41dddba3a9524909a1cc6..16bed6200d14e080511a23c79564d981baa77728 100644 (file)
@@ -49,6 +49,7 @@ public:
        void useFlatInput(MovitPixelFormat pix_fmt, unsigned width, unsigned height);
        void useYCbCrInput(const ImageFormat& image_format, const YCbCrFormat& ycbcr_format, unsigned width, unsigned height);
        void set_pixel_data(const unsigned char* data);
+       void invalidate_pixel_data();
 
 private:
        unsigned m_width, m_height;