[vlc-commits] qtsound: bug fixes
Michael Feurstein
git at videolan.org
Wed Mar 14 22:01:17 CET 2012
vlc | branch: master | Michael Feurstein <michael.feurstein at gmail.com> | Tue Feb 14 17:16:51 2012 +0100| [fd75aab3d6670f7404e1c3e741a87587481472f4] | committer: Felix Paul Kühne
qtsound: bug fixes
fix for selecting the device with the correct UID
GUI and qtsound now both reference the correct UID
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fd75aab3d6670f7404e1c3e741a87587481472f4
---
modules/access/qtsound.m | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/modules/access/qtsound.m b/modules/access/qtsound.m
index 19f8d64..44fb1e0 100644
--- a/modules/access/qtsound.m
+++ b/modules/access/qtsound.m
@@ -74,6 +74,7 @@ vlc_module_end ()
{
demux_t *p_qtsound;
AudioBuffer *currentAudioBuffer;
+ block_t *rawAudioData;
UInt32 numberOfSamples;
date_t date;
mtime_t currentPts;
@@ -82,6 +83,7 @@ vlc_module_end ()
- (id)initWithDemux:(demux_t *)p_demux;
- (void)outputAudioSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection;
- (BOOL)checkCurrentAudioBuffer;
+- (void)freeAudioMem;
- (mtime_t)getCurrentPts;
- (void *)getCurrentAudioBufferData;
- (UInt32)getCurrentTotalDataSize;
@@ -105,18 +107,12 @@ vlc_module_end ()
}
- (void)dealloc
{
- @synchronized (self)
- {
- free(currentAudioBuffer);
- currentAudioBuffer = nil;
- }
[super dealloc];
}
- (void)outputAudioSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection
{
AudioBufferList *tempAudioBufferList;
- block_t *rawAudioData;
UInt32 totalDataSize = 0;
UInt32 count = 0;
@@ -190,7 +186,6 @@ vlc_module_end ()
currentAudioBuffer->mDataByteSize = totalDataSize;
currentAudioBuffer->mData = rawAudioData;
}
- free(rawAudioData);
}
}
@@ -199,6 +194,16 @@ vlc_module_end ()
return (currentAudioBuffer) ? 1 : 0;
}
+- (void)freeAudioMem
+{
+ @synchronized (self)
+ {
+ if (rawAudioData) {
+ free(rawAudioData);
+ }
+ }
+}
+
- (mtime_t)getCurrentPts
{
/* FIXME: can this getter be minimized? */
@@ -293,7 +298,7 @@ static int Open( vlc_object_t *p_this )
QTCaptureDevice *qtk_audioDevice;
qtk_audioDevice = [myAudioDevices objectAtIndex:iaudio];
msg_Dbg( p_demux, "qtsound audio %u/%lu localizedDisplayName: %s uniqueID: %s", iaudio, [myAudioDevices count], [[qtk_audioDevice localizedDisplayName] UTF8String], [[qtk_audioDevice uniqueID] UTF8String]);
- if([[[qtk_audioDevice localizedDisplayName]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_curraudiodevice_uid]){
+ if([[[qtk_audioDevice uniqueID]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] isEqualToString:qtk_curraudiodevice_uid]){
msg_Dbg( p_demux, "Device found" );
break;
}
@@ -545,8 +550,6 @@ static int Demux( demux_t *p_demux )
return 0;
}
- pool = [[NSAutoreleasePool alloc] init];
-
@synchronized (p_sys->audiooutput)
{
if ( [p_sys->audiooutput checkCurrentAudioBuffer] )
@@ -562,19 +565,28 @@ static int Demux( demux_t *p_demux )
{
// Nothing to transfer yet, just forget
block_Release( p_blocka );
- [pool release];
msleep( 10000 );
return 1;
}
- [pool release];
-
if( p_blocka )
{
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_blocka->i_pts );
es_out_Send( p_demux->out, p_sys->p_es_audio, p_blocka );
}
+ @synchronized (p_sys->audiooutput)
+ {
+ /*
+ * Free Memory
+ *
+ * Wait before freeing memory, so we don't get no crackling sound
+ * crackling sound artefacts start at 100 ms and below
+ */
+ msleep( 200 );
+ [p_sys->audiooutput freeAudioMem];
+ }
+
return 1;
}
More information about the vlc-commits
mailing list