[vlc-devel] commit: Don' t send blocks from qtcapture Demux that we have already sent before. Avoid excessive CPU usage while there are no new blocks. ( Derk-Jan Hartman )
git version control
git at videolan.org
Wed Jul 16 17:13:04 CEST 2008
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Wed Jul 16 17:14:22 2008 +0200| [06e5daea61f283d5608de17742ed373a2e407b30]
Don't send blocks from qtcapture Demux that we have already sent before. Avoid excessive CPU usage while there are no new blocks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06e5daea61f283d5608de17742ed373a2e407b30
---
modules/access/qtcapture.m | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/access/qtcapture.m b/modules/access/qtcapture.m
index dd850dc..fba2fbe 100644
--- a/modules/access/qtcapture.m
+++ b/modules/access/qtcapture.m
@@ -68,6 +68,7 @@ vlc_module_end();
{
CVImageBufferRef currentImageBuffer;
mtime_t currentPts;
+ mtime_t previousPts;
}
- (id)init;
- (void)outputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection;
@@ -82,6 +83,7 @@ vlc_module_end();
{
currentImageBuffer = nil;
currentPts = 0;
+ previousPts = 0;
}
return self;
}
@@ -117,13 +119,13 @@ vlc_module_end();
CVImageBufferRef imageBuffer;
mtime_t pts;
- if(!currentImageBuffer)
+ if(!currentImageBuffer || currentPts == previousPts )
return 0;
@synchronized (self)
{
imageBuffer = CVBufferRetain(currentImageBuffer);
- pts = currentPts;
+ pts = previousPts = currentPts;
CVPixelBufferLockBaseAddress(imageBuffer, 0);
void * pixels = CVPixelBufferGetBaseAddress(imageBuffer);
@@ -353,6 +355,7 @@ static int Demux( demux_t *p_demux )
/* Nothing to display yet, just forget */
block_Release( p_block );
[pool release];
+ msleep( 10000 );
return 1;
}
More information about the vlc-devel
mailing list