10.06.11 08:43, Dan Dennedy написав(ла):
On Thu, Jun 9, 2011 at 12:33 PM, Maksym Veremeyenko<ve...@m1stereo.tv> wrote:
On Thu, June 9, 2011 7:27 pm, Dan Dennedy wrote:
[...]
frame that is being saved and repeated, hmm... repeat last
DeckLinkVideoFrame instead of mlt_frame.
great idea!
what would you say about approach used in attached patch? I will test it
tomorrow morning...
Yes, that is good. One small thing, in stop(), after releasing
m_decklinkFrame, you need to set it to NULL.
updated patch attached...
Testing the overall
change, it works fairly good, but I am able to make the audio play
intermittently: 1 sec audio, 2 sec silence, repeat. I reproduce it by
setting up melted for SD, loading a HD clip, scrub a bit, play, and
maybe scrub some more until it happens. Of course, stop followed by
play resolves it. Can you reproduce it?
i reproduced it easy - good catch..
this actually happens on attempt to ScheduleNextFrame if callback status
is bmdOutputFrameDisplayedLate and as result (IMHO) audio samples has
timestamp of past.
i attached a patch that provides workaround for this situation.
BTW
would you please to apply a patch you proposed
(http://sourceforge.net/tracker/?func=detail&aid=3311153&group_id=96039&atid=613414)
to enable verbose output in melted console then it starts with -test
--
________________________________________
Maksym Veremeyenko
>From f335e9cc804a4b06cb16cd90842532b3cdbaf5a8 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Fri, 10 Jun 2011 09:33:32 +0300
Subject: [PATCH 2/3] respect the realtime frame-dropping behavior of
mlt_consumer
---
src/modules/decklink/consumer_decklink.cpp | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp
index eea528e..6cb59d4 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;
+ IDeckLinkMutableVideoFrame* m_decklinkFrame;
bool m_isAudio;
int m_isKeyer;
IDeckLinkKeyer* m_deckLinkKeyer;
@@ -156,6 +157,7 @@ public:
// Initialize members
m_count = 0;
m_dropped = 0;
+ m_decklinkFrame = 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" );
@@ -227,6 +229,11 @@ public:
mlt_properties_set_int( properties, "running", 0 );
mlt_consumer_stopped( getConsumer() );
+ // release decklink frame
+ if ( m_decklinkFrame )
+ m_decklinkFrame->Release();
+ m_decklinkFrame = NULL;
+
// Stop the audio and video output streams immediately
if ( m_deckLinkOutput )
{
@@ -297,15 +304,17 @@ public:
{
mlt_image_format format = m_isKeyer? mlt_image_rgb24a : mlt_image_yuv422;
uint8_t* image = 0;
+ int rendered = mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "rendered");
- if ( !mlt_frame_get_image( frame, &image, &format, &m_width, &m_height, 0 ) )
+ if ( rendered && !mlt_frame_get_image( frame, &image, &format, &m_width, &m_height, 0 ) )
{
- IDeckLinkMutableVideoFrame* decklinkFrame;
uint8_t* buffer = 0;
int stride = m_width * ( m_isKeyer? 4 : 2 );
- if ( createFrame( &decklinkFrame ) )
- decklinkFrame->GetBytes( (void**) &buffer );
+ if ( m_decklinkFrame )
+ m_decklinkFrame->Release();
+ if ( createFrame( &m_decklinkFrame ) )
+ m_decklinkFrame->GetBytes( (void**) &buffer );
if ( buffer )
{
@@ -351,11 +360,13 @@ public:
// Keying blank frames - nullify alpha
memset( buffer, 0, stride * m_height );
}
- m_deckLinkOutput->ScheduleVideoFrame( decklinkFrame, m_count * m_duration, m_duration, m_timescale );
}
- if ( decklinkFrame )
- decklinkFrame->Release();
}
+ if ( m_decklinkFrame )
+ m_deckLinkOutput->ScheduleVideoFrame( m_decklinkFrame, m_count * m_duration, m_duration, m_timescale );
+
+ if ( !rendered )
+ mlt_log_verbose( getConsumer(), "dropped video frame %u\n", ++m_dropped );
}
HRESULT render( mlt_frame frame )
--
1.7.4.4
>From 7dde639dc1b04b5d0e18992777113b92c2a0e1c5 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Fri, 10 Jun 2011 10:42:20 +0300
Subject: [PATCH 3/3] fix workaround against bmdOutputFrameDisplayedLate in
ScheduledFrameCompleted callback
---
src/modules/decklink/consumer_decklink.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp
index 6cb59d4..0832794 100644
--- a/src/modules/decklink/consumer_decklink.cpp
+++ b/src/modules/decklink/consumer_decklink.cpp
@@ -408,9 +408,12 @@ public:
// schedule next frame
ScheduleNextFrame(false);
- // enqueu more frames if underrun
+ // step forward frames counter if underrun
if(bmdOutputFrameDisplayedLate == completed)
- ScheduleNextFrame(false);
+ {
+ mlt_log_verbose( getConsumer(), "ScheduledFrameCompleted: bmdOutputFrameDisplayedLate == completed\n");
+ m_count++;
+ }
return S_OK;
}
--
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