Re: streaming mp3 playback

insomnia137@xxxxxxxxxxx wrote:
Chris P. [MVP] wrote:
On 11 Sep 2006 11:16:31 -0700, insomnia137@xxxxxxxxxxx wrote:

We've been using directshow in our client app for streaming mp3's up
till now, but ever since we converted to vc8 (and the corresponding
platform and directx sdk upgrades) we've been having problems with
certain users who have onboard soundcards. specifically some of them
get no audio playback, even though setting up a test app shows playback
working. Because of this we've been wondering what other options
besides directshow were there for streaming mp3's.

DirectShow just wraps the core interfaces of DirectSound and waveOut,
there's no magic there. I guess you would need to figure out where things
are going wrong.

If you want to avoid DirectShow you can decode MP3 with the ACM, or the
Microsoft installed DMO or with a 3rd party lib such as LAME. Audio output
choices would be DirectSound or waveOut.


I guess the first thing i need to do is figure out whether the problem
lies on the directshow streaming/decoding the mp3 side, or with the
actual playback. I'll look into that, thanks.

Well, the problem happens in RenderFile. I get a First chance except at
Memory address. Access violation reading location 0xfffffffe error.
Breaking doesn't reveal any information as I'm told no symbols are
loaded for any call stack frame and the source code cannot be
The first chance exception is reported in other clients (through the
output window) but not the access violation. And the other clients do
not crash, they play music just fine.

I am including the code for the CreateFilter function in case this
sheds some insight. As a parting note, we made a standalone Directshow
test app on the same machine and it had no problems, so maybe it has
some relation to our app using threads.

TBool CDirectShowPlayback::CreateFilter( const TChar* fileWithPath,
CPlaylist* playlist )
if ( mFilterCreated )

mCurrentPlaylist = playlist;

HRESULT hResult = CoInitialize( NULL );

if ( FAILED( hResult ) )
throw 0;

// Create the graph builder interface.
hResult = CoCreateInstance( CLSID_FilterGraph, NULL,
CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void**)&mGraphBuilder );
if ( FAILED( hResult ) )
throw 1;

// Now query the graph builder for the particular controls we
want, checking for failure.
hResult |= mGraphBuilder->QueryInterface( IID_IMediaControl,
(void**)&mMediaControl );
hResult |= mGraphBuilder->QueryInterface( IID_IMediaSeeking,
(void**)&mMediaSeeking );
hResult |= mGraphBuilder->QueryInterface( IID_IMediaEventEx,
(void**)&mMediaEvent );
hResult |= mGraphBuilder->QueryInterface( IID_IBasicAudio,
(void**)&mBasicAudio );
if ( FAILED( hResult ) )
throw 2;

// Build a filter graph to process the given file.
// DirectShow wants a wide char string so translate.
TWord wideString[_MAX_PATH];
mbstowcs( (wchar_t*)wideString, fileWithPath, _MAX_PATH - 1 );
hResult = mGraphBuilder->RenderFile( (wchar_t*)wideString, NULL );
if ( FAILED( hResult ) )
throw 3;

// Determine the total playback time.
mMediaSeeking->GetDuration( &mTotalTime );

// Everything is properly initialized.
mFilterCreated = true;
catch ( TInt errorCode )
DestroyFilter( true );
return false;

return true;