[EMAIL PROTECTED] wrote:
Hi, Greg,
You are right. I am using that guide to code a HW audio device. I
don't have problems with the dummy PCMs illustrated in that guide.
As you know, HW audio device/decoder buffers encoded audio frames
and feedbacks correspondent dummy PCMs. I did exactly like that.
Later, I found that HXAudioSession pushes down more PCMs to
device than the dummy PCMs decoder feed backed. It is not clear
to me what is case HXAudioSession will insert silent PCMs into
the stream. Maybe packet loss? If so, how does HW audio device
know that PCMs pushed down is actually faked silence? -- this
is very important for HW device/decoders for they don't accept
silent PCMs.
All dummy PCMs send through the audio services should be silence
(in case they get mixed or faded with other streams). Each dummy
PCM should also be thrown away. I assume that the real audio data
is being send directly from your DSP decoder directly to the audio
physical device. Is that correct? Or, are you decoding in the DSP
and then sending *real* audio PCM data back to the renderer, which
in turn, sends it to the audio services?
Also, can you tell me how you know there are *more* PCM then
what your decoder provided? Are you mesuring by bytes or by
number of chunks sent (Write())? Your decoder will decode in
the native format of the coded audio right? It is possible that
the media engine is resampling the PCM data to match what ever
format the audio device was opened up at. For example, the audio
could be 44.1K but the audio device could only open up at 16K.
That will result in a different amount of data be written the
the CHXAudioDevice code. You can take a look at:
HX_RESULT CHXAudioSession::GetDeviceFormat()
You mentioned as "there are a few places in hxaudses.cpp where
the PCM data is silenced and/or inserted into the audio stream".
Would you please explain those places? It seems silent PCMs are
generated in CHXAudioStream, which is controlled by HXAudioSession.
Is it right?
Look in hxaudstr_net.cpp for CAudioSvcSampleConverter::silence() and the
following code chunks in hxaudses.cpp:
/* If the mixer buffer was not used, make sure it is
initialized
* to silence since we pass it to post process hooks
*/
if (!bIsMixBufferDirty)
{
//{FILE* f1 = ::fopen("e:\\audioses.txt", "a+"); ::fprintf(f1, "%lu\t%p\tsilence in
mix buffer\n", HX_GET_BETTERTICKCOUNT(), this);::fclose(f1);}
::memset(pMixBuffer, 0,
HX_SAFESIZE_T(m_ulBytesPerGran));
}
/* did we ever write to the session buffer ? */
if (m_pPlayerList->GetCount() > 1 && !m_bSessionBufferDirty)
{
HXLOGL4(HXLOG_ADEV, "CHXAudioSession[%p]::PlayAudio(): silence in
session buffer", this);
::memset(pSessionBuf, 0, HX_SAFESIZE_T(m_ulBytesPerGran));
}
--greg.
Thanks,
Gang Shen
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of ext Greg
Wright
Sent: Monday, August 15, 2005 3:45 PM
To: Shen Gang.1 (Nokia-TP-MSW/Dallas)
Cc: [email protected]
Subject: Re: [Audio-dev] HXAudioSession & CHXAudioStream
[EMAIL PROTECTED] wrote:
Hi,
When I program a DSP audio device, I found something interesting.
When no data in the buffer (CHXAudioStream), HXAudioSession still pushes
fake PCMs down to audio device(::CheckToPlayMoreAudio). Those PCMs are
generated by CHXAudioStream. Since DSP device has to buffer every
encoded frame in a seperate queue, it is disturbing to receive
::Write() with extra PCMs. Although I made a workaround for that,
I am wondering why HXAudioSession & CHXAudioStream are designed in
that way. Could anyone kindly explain a little bit?
Thanks,
Gang Shen
Could you explain a little more about what it is you are doing
exactly? From the above it sounds like you have a hardware decoder
for some audio stream. Is that correct? If so, have you read
the "Hardware Decoder Integration Guide":
https://client.helixcommunity.org/2004/devdocs/dsp_inte
It will talk a bit about where some of this 'dummy PCM' can come
from and why it is used.
If the above is not the case, then there are a few places in
hxaudses.cpp where the PCM data is silenced and/or inserted into
the audio stream. I would need to know more about your specific
playback scenario to tell you more however.
Let me know if you have any other questions,
--greg.
_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev
_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev