Re: [Helix-client-dev] 24bit 96khz AIFF playback
John Stirling <[email protected]> Wed, 16 Jun 2010 17:15:31 +0100
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Message-ID | <[email protected]> |
Attached diff make it play but with intermittent clicks in audio on average every second Increasing the packet size to eg 15000 seems to increase the click frequency. Any ideas on what's going wrong here ? The equivalent 24/96 .wav file plays smoothly with no clicks.. John Stirling wrote: > We have a patched helix cayenne and have 24/96 .wav playback working. > > Just trying to get 24/96 AIFF playback going as well, but crashing at > the moment > > presumably datatype/aiff/fileformat/ is the likely cuplrit ? > > backtrace - > > #0 0xb7f37410 in ?? () > #1 0xb4c45604 in ?? () > #2 0x00000006 in ?? () > #3 0x00004b33 in ?? () > #4 0xb7b98640 in raise () from /lib/i686/cmov/libc.so.6 > #5 0xb7b9a018 in abort () from /lib/i686/cmov/libc.so.6 > #6 0xb7bd534d in __fsetlocking () from /lib/i686/cmov/libc.so.6 > #7 0xb7bdb624 in malloc_usable_size () from /lib/i686/cmov/libc.so.6 > #8 0x00d91233 in operator delete () from > /usr/local/reciva/lib/libstdc++.so.5 > #9 0x00d9128f in operator delete[] () from > /usr/local/reciva/lib/libstdc++.so.5 > #10 0xb7854794 in CHXBuffer::Deallocate () from ./clntcore.so > #11 0xb7854596 in CHXBuffer::SetSize () from ./clntcore.so > #12 0xb78543c4 in CHXBuffer::Set () from ./clntcore.so > #13 0xb5d3a5a2 in CPCMAudioFormat::DecodeAudioData () from ./audplin.so > #14 0xb5d3a42f in CPCMAudioFormat::DecodeAudioData () from ./audplin.so > #15 0xb5d30c44 in CAudioFormat::CreateAudioFrame () from ./audplin.so > #16 0xb5d34af1 in CAudioRenderer::DoAudio () from ./audplin.so > #17 0xb5d3405c in CAudioRenderer::OnTimeSync () from ./audplin.so > #18 0xb78cfde6 in SourceInfo::OnTimeSync () from ./clntcore.so > #19 0xb78cfb90 in SourceInfo::OnTimeSync () from ./clntcore.so > #20 0xb785ca28 in HXPlayer::OnTimeSync () from ./clntcore.so > #21 0xb78a1ae2 in CHXAudioPlayer::OnTimeSync () from ./clntcore.so > #22 0xb78acb87 in CHXAudioSession::OnTimeSync () from ./clntcore.so > #23 0xb7850ef4 in CHXAudioDevice::OnTimeSync () from ./clntcore.so > #24 0xb78444f5 in CAudioOutUNIX::DoTimeSyncs () from ./clntcore.so > #25 0xb7844831 in CAudioOutUNIX::HXPlaybackCountCB::Func () from > ./clntcore.so > #26 0xb7873979 in PQ::dispatch_element () from ./clntcore.so > #27 0xb784d26b in ClientPQ::execute () from ./clntcore.so > #28 0xb784c0ba in HXScheduler::ExecuteCurrentFunctions () from > ./clntcore.so > #29 0xb784be63 in HXScheduler::OnTimeSync () from ./clntcore.so > #30 0xb789f825 in Timeline::OnTimeSync () from ./clntcore.so > #31 0xb789f8a2 in Timeline::CallAllTimeSyncs () from ./clntcore.so > #32 0xb7847f0b in HXClientEngine::EventOccurred () from ./clntcore.so > #33 0xb7d061ca in vMAIN_DoEvent () from ./libreciva_hxplayer.so > #34 0xb7d0929b in vHXP_PlayerDoEvent () at ../include/atomicbase.h:622 > #35 0x0809024b in vpKickLoop (vpNothing=0x0) at helix_kicker.c:436 > #36 0xb7cce4c0 in start_thread () from /lib/i686/cmov/libpthread.so.0 > #37 0xb7c4d6de in clone () from /lib/i686/cmov/libc.so.6 > > > > -- Reciva Ltd, Unit 1, The Old Granary, Westwick, CAMBRIDGE CB24 3AR Registered in England & Wales No. 04719949 _______________________________________________ Helix-client-dev mailing list [email protected] http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
diff.txt
(text/plain, 7.8 KB)
? ../datatype/aiff/fileformat/Makefile
? ../datatype/aiff/fileformat/Umakefil.upp
? ../datatype/aiff/fileformat/rel
Index: ../datatype/aiff/fileformat/aiffplin.cpp
===================================================================
RCS file: /nexus/proj/InternetRadio/cvs/helix_cayenne_20070820/datatype/aiff/fileformat/aiffplin.cpp,v
retrieving revision 1.2
diff -u -r1.2 aiffplin.cpp
--- ../datatype/aiff/fileformat/aiffplin.cpp 7 Jul 2008 16:38:59 -0000 1.2
+++ ../datatype/aiff/fileformat/aiffplin.cpp 16 Jun 2010 16:12:10 -0000
@@ -55,6 +55,18 @@
#include <hlxclib/math.h>
+// Reciva debug
+#include "../../../../debug_control.h"
+#include <stdio.h>
+#define PFX "aiffplin.cpp:"
+#ifdef RECIVA_DEBUG_ENABLE_AIFF
+#include "hxtick.h"
+#define DBG(_x) printf("[%ld] ", GetTickCount()); ((void)(_x));
+static int iPacketSentCount =0;
+#else
+#define DBG(_x)
+#endif
+
const char* const AIFFFileFormat::zm_pDescription = "Helix AIFF File Format Plugin";
const char* const AIFFFileFormat::zm_pCopyright = HXVER_COPYRIGHT;
const char* const AIFFFileFormat::zm_pMoreInfoURL = HXVER_MOREINFO;
@@ -66,7 +78,11 @@
#define COMM_CHUNK_ID 0x434f4d4d /* 'COMM' */
#define SSND_CHUNK_ID 0x53534e44 /* 'SSND' */
-#define PACKETSIZE 500
+// Was 500. 24 bit files were crashing helix
+// 750 seems to almost work for 24 bit files.
+// But there are intermittent clicks during playback at
+// roughly 1 second intervals on average (not equally spaced)
+#define PACKETSIZE 750
HX_RESULT STDAPICALLTYPE AIFFFileFormat::HXCreateInstance
(
@@ -118,10 +134,12 @@
m_ulLastPacketEndTime(0),
m_state(AS_Ready)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
}
AIFFFileFormat::~AIFFFileFormat()
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
HX_RELEASE(m_pContext);
HX_RELEASE(m_pCommonClassFactory);
HX_RELEASE(m_pRequest);
@@ -137,6 +155,7 @@
STDMETHODIMP
AIFFFileFormat::QueryInterface(REFIID riid, void**ppvObj)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(IsEqualIID(riid, IID_IUnknown))
{
AddRef();
@@ -175,12 +194,14 @@
STDMETHODIMP_(UINT32)
AIFFFileFormat::AddRef()
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
return InterlockedIncrement(&m_lRefCount);
}
STDMETHODIMP_(UINT32)
AIFFFileFormat::Release()
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if (InterlockedDecrement(&m_lRefCount) > 0)
{
return m_lRefCount;
@@ -197,6 +218,7 @@
REF(const char*)pMoreInfoURL,
REF(ULONG32) ulVersionNumber)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
bLoadMultiple = TRUE;
pDescription = zm_pDescription;
@@ -210,6 +232,7 @@
STDMETHODIMP
AIFFFileFormat::InitPlugin(IUnknown* pContext)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
m_pContext = pContext;
m_pContext->AddRef();
@@ -227,6 +250,7 @@
REF(const char**) pFileExtensions,
REF(const char**)pFileOpenNames)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
pFileMimeTypes = (const char**) zm_pFileMimeTypes;
pFileExtensions = (const char**) zm_pFileExtensions;
pFileOpenNames = (const char**) zm_pFileOpenNames;
@@ -238,6 +262,7 @@
IHXFormatResponse* pFormatResponse,
IHXFileObject* pFileObject)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
m_pRequest = pRequest;
m_pFFResponse = pFormatResponse;
m_pFileObject = pFileObject;
@@ -263,6 +288,7 @@
STDMETHODIMP
AIFFFileFormat::Close()
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(m_pRiffReader)
m_pRiffReader->Close();
@@ -278,6 +304,7 @@
STDMETHODIMP
AIFFFileFormat::GetFileHeader()
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
IHXValues* pHeader = 0;
if(m_pCommonClassFactory->CreateInstance(CLSID_IHXValues,
(void**)&pHeader) != HXR_OK)
@@ -305,6 +332,7 @@
STDMETHODIMP
AIFFFileFormat::GetStreamHeader(UINT16 unStreamNumber)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(m_state != AS_Ready) return HXR_UNEXPECTED;
m_state = AS_FindCommChunkPending;
m_pRiffReader->FindChunk(COMM_CHUNK_ID, FALSE);
@@ -314,6 +342,7 @@
STDMETHODIMP
AIFFFileFormat::GetPacket(UINT16 unStreamNumber)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(m_state != AS_Ready) return HXR_UNEXPECTED;
if(!m_bHeaderSent) return HXR_UNEXPECTED;
@@ -333,6 +362,7 @@
STDMETHODIMP
AIFFFileFormat::Seek(UINT32 ulOffset)
{
+ DBG(printf(PFX "%s o=%d\n", __FUNCTION__, ulOffset));
m_ulLastPacketEndTime = 0;
m_ulSeekOffset = ulOffset;
m_state = AS_SeekFindChunkPending;
@@ -345,6 +375,7 @@
REF(IHXBuffer*)pStatusDesc,
REF(UINT16) ulPercentDone)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
HX_RESULT hResult = HXR_OK;
IHXPendingStatus* pFileSystemStatus = NULL;
@@ -371,6 +402,7 @@
STDMETHODIMP
AIFFFileFormat::RIFFOpenDone(HX_RESULT status)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(m_state != AS_InitPending) return HXR_UNEXPECTED;
m_state = AS_Ready;
@@ -381,12 +413,15 @@
STDMETHODIMP
AIFFFileFormat::RIFFCloseDone(HX_RESULT status)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
return HXR_OK;
}
HX_RESULT
AIFFFileFormat::RIFFFindChunkDone(HX_RESULT status, UINT32 len)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
+ char *pcMimeType = "";
UINT32 ulByteRate = 0;
switch(m_state)
{
@@ -442,8 +477,17 @@
ULONG32 ulLenPacked;
m_AudioPCMHEADER.pack((UINT8*)&audioPCMHEADER, ulLenPacked);
- pMimeType->Set((const UINT8*)"audio/x-pn-wav",
- strlen("audio/x-pn-wav") + 1);
+ if (m_AudioPCMHEADER.usBitsPerSample == 24)
+ pcMimeType = "audio/L24";
+ else
+ pcMimeType = "audio/x-pn-wav";
+
+ DBG(printf(PFX "SSND chunk\n"));
+ DBG(printf(PFX " MimeType=%s\n", pcMimeType));
+ DBG(printf(PFX " BitsPerSample=%d\n", m_AudioPCMHEADER.usBitsPerSample));
+ DBG(printf(PFX " SamplesPerSec=%d\n", m_AudioPCMHEADER.ulSamplesPerSec));
+
+ pMimeType->Set((const UINT8*)pcMimeType, strlen(pcMimeType) + 1);
pOpaque->Set((UINT8*)&audioPCMHEADER, ulLenPacked);
pHeader->SetPropertyBuffer("OpaqueData", pOpaque);
pHeader->SetPropertyULONG32("StreamNumber", 0);
@@ -455,6 +499,8 @@
pHeader->SetPropertyULONG32("Preroll", 1000);
pHeader->SetPropertyULONG32("Duration", m_ulDuration);
pHeader->SetPropertyCString("MimeType", pMimeType);
+ pHeader->SetPropertyULONG32("BitsPerSample", (UINT32)m_AudioPCMHEADER.usBitsPerSample);
+ pHeader->SetPropertyULONG32("SamplesPerSecond", (UINT32)m_AudioPCMHEADER.ulSamplesPerSec);
m_bHeaderSent = TRUE;
m_state = AS_Ready;
@@ -487,18 +533,21 @@
STDMETHODIMP
AIFFFileFormat::RIFFDescendDone(HX_RESULT status)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
return HXR_UNEXPECTED;
}
STDMETHODIMP
AIFFFileFormat::RIFFAscendDone(HX_RESULT status)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
return HXR_UNEXPECTED;
}
STDMETHODIMP
AIFFFileFormat::RIFFReadDone(HX_RESULT status, IHXBuffer* pBuffer)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
UCHAR* buf;
UINT32 len;
@@ -524,6 +573,10 @@
m_AudioPCMHEADER.usSampleEndianness = 1; // AIFF is big endian
m_AudioPCMHEADER.usFormatTag = 2; // 2's complement
+ DBG(printf(PFX "COMM chunk\n"));
+ DBG(printf(PFX " BitsPerSample=%d\n", m_AudioPCMHEADER.usBitsPerSample));
+ DBG(printf(PFX " SamplesPerSec=%d\n", m_AudioPCMHEADER.ulSamplesPerSec));
+
UINT32 ulNumberOfSamples = getlong(&buf[2]);
// To compute duration, we must modularlize the
// computation to avoid 32-bit overflow
@@ -591,6 +644,7 @@
STDMETHODIMP
AIFFFileFormat::RIFFSeekDone(HX_RESULT status)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
if(m_state != AS_SeekPending)
return HXR_UNEXPECTED;
@@ -604,5 +658,6 @@
UINT32 chunkType,
IHXBuffer* pBuffer)
{
+ DBG(printf(PFX "%s\n", __FUNCTION__));
return HXR_NOTIMPL;
}