09.06.11 15:57, Maksym Veremeyenko написав(ла):
09.06.11 09:57, Dan Dennedy написав(ла):
[...]
Overall, I like the direction of it very much; it is much clearer.
However, there is at least one big problem. It does not respect the
realtime frame-dropping behavior of mlt_consumer. Basically, I
re-added this part between renderAudio() and renderVideo() plus
members and initializers to support it.

if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "rendered") )
{
// Close the previous frame and use the new one
mlt_frame_close( m_frame );
m_frame = frame;
}
else
{
if ( !m_frame )
m_frame = frame;
// Reuse the last frame
mlt_log_verbose( getConsumer(), "dropped video frame %u\n",
++m_dropped );
}

---

If a frame is not rendered, then the render-ahead thread in
mlt_consumer has decided to skip preparing an image for it (if
real_time> 0). You did not notice because you can still request to
render an image anyway on-demand by calling mlt_frame_get_image and
also because you were probably not stressing it.

i attached second patch from that series that revert dropped frame behavior

here is updated version

--
________________________________________
Maksym Veremeyenko
>From c6e76f7942689dbb5327098a1208ff78416ab9d1 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Thu, 9 Jun 2011 16:23:36 +0300
Subject: [PATCH 2/2] revert respect the realtime frame-dropping behavior of
 mlt_consumer

---
 src/modules/decklink/consumer_decklink.cpp |   31 +++++++++++++++++++++------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp
index eea528e..590ffd2 100644
--- a/src/modules/decklink/consumer_decklink.cpp
+++ b/src/modules/decklink/consumer_decklink.cpp
@@ -44,6 +44,7 @@ private:
 	uint64_t                    m_count;
 	int                         m_channels;
 	unsigned                    m_dropped;
+	mlt_frame                   m_frame;
 	bool                        m_isAudio;
 	int                         m_isKeyer;
 	IDeckLinkKeyer*             m_deckLinkKeyer;
@@ -156,6 +157,7 @@ public:
 		// Initialize members
 		m_count = 0;
 		m_dropped = 0;
+		m_frame = NULL;
 		preroll = preroll < PREROLL_MINIMUM ? PREROLL_MINIMUM : preroll;
 		m_channels = mlt_properties_get_int( properties, "channels" );
 		m_isAudio = !mlt_properties_get_int( properties, "audio_off" );
@@ -361,14 +363,31 @@ public:
 	HRESULT render( mlt_frame frame )
 	{
 		HRESULT result = S_OK;
+		double speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES(frame), "_speed" );
+
+		if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "rendered") )
+		{
+			// Close the previous frame and use the new one
+			if ( m_frame )
+				mlt_frame_close( m_frame );
+			m_frame = frame;
+		}
+		else
+		{
+			if ( m_frame )
+				mlt_frame_close( frame );
+			else
+				m_frame = frame;
+
+			mlt_log_verbose( getConsumer(), "dropped video frame %u\n", ++m_dropped );
+		}
 
 		// Get the audio
-		double speed = mlt_properties_get_double( MLT_FRAME_PROPERTIES(frame), "_speed" );
-		if ( m_isAudio && speed == 1.0 )
-			renderAudio( frame );
+		if ( m_isAudio && speed == 1.0 && m_frame == frame)
+			renderAudio( m_frame );
 
 		// Get the video
-		renderVideo( frame );
+		renderVideo( m_frame );
 		++m_count;
 
 		return result;
@@ -426,8 +445,6 @@ public:
 			frame = mlt_consumer_rt_frame( consumer );
 			if ( frame != NULL )
 			{
-				render( frame );
-
 				mlt_events_fire( properties, "consumer-frame-show", frame, NULL );
 
 				// terminate on pause
@@ -435,7 +452,7 @@ public:
 					mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ) == 0.0)
 					stop();
 
-				mlt_frame_close( frame );
+				render( frame );
 			}
 		}
 	}
-- 
1.7.4.4

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to