Postby goutam_d » 02 Jun 2014 12:25
Hi I have resolved "if(sp->mAudioDataSize < size)" issue... Now I am trying to play that audio buffer through QIODevice (QtMultiMedia4.dll).
But I am getting crash while writing that buffer into QIODevice->write function...
Here is the handleStream() Function
void handleStream(void* p_audio_data, uint8_t* p_pcm_buffer, unsigned int channels, unsigned int rate, unsigned int nb_samples, unsigned int bits_per_sample, size_t size, int64_t pts )
{
unsigned int copied = 0;
Player *sp = ((Player*)p_audio_data);
// Update the frequency if needed
if(rate != sp->mFrequency)
sp->mFrequency = rate;
sp->mChannels = channels;
int16_t* temp = (int16_t*)p_pcm_buffer;
size /= 2;
while(copied < size)
{
unsigned int to_copy = min(channels*(sp->chunkSize() - sp->mBufferSize), size - copied);
// TODO : remove this comment
/* cout << "channels : " << channels << endl
<< "chunk size : " << sp->chunkSize() << endl
<< "buffer size : " << sp->mBufferSize << endl
<< "size : " << size << endl
<< "copied : " << copied << endl
<< "=> to_copy : " << to_copy << endl; */
memcpy(sp->mBuffer + channels*sp->bufferSize(), temp + copied,
to_copy*sizeof(int16_t));
copied += to_copy;
sp->mBufferSize += to_copy / channels;
if(sp->bufferSize() >= sp->chunkSize())
{
//Assign sound samples to short array
short* resultingData = (short*)(sp->mBuffer);
short *outdata = resultingData;
outdata[ 0 ] = resultingData [ 0 ];
// The buffer is sent to the "user"
////+++++++sp->useBuffer();
sp->GetOutputDevice()->write((char*)outdata, size);
// Emptying buffer
sp->flushBuffer();
}
}
sp->mLock.unlock();
}
Here is the log:
logger interface: VLC media player - 2.1.3 Rincewind
logger interface: Copyright © 1996-2014 the VideoLAN team
logger interface:
Warning: if you cannot access the GUI anymore, open a command-line window, go to the directory where you installed VLC and run "vlc -I qt"
logger interface: using logger.
logger interface warning: no log filename provided, using `vlc-log.txt'
logger interface debug: opening logfile `vlc-log.txt'
main libvlc debug: VLC media player - 2.1.3 Rincewind
main libvlc debug: Copyright © 1996-2014 the VideoLAN team
main libvlc debug: revision 2.1.3-0-ge6a71cc
main libvlc debug: configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--disable-dirac' '--host=i686-w64-mingw32' 'host_alias=i686-w64-mingw32'
main interface debug: using interface module "logger"
main input debug: Creating an input for 'rtsp://10.60.17.102:8554/mp3AudioTest'
using null output device, none available
main stream output debug: using sout chain=`transcode{acodec=s16l}:smem{audio-prerender-callback=13767116,audio-postrender-callback=13766676,audio-data=3013552,no-time-sync},'
main stream output debug: stream=`smem'
main stream out debug: looking for sout stream module matching "smem": 21 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\stream_out\libstream_out_smem_plugin.dll', Binary was not built with debug information.
main stream out debug: set config option: sout-smem-audio-prerender-callback to 13767116
main stream out debug: set config option: sout-smem-audio-postrender-callback to 13766676
main stream out debug: set config option: sout-smem-audio-data to 3013552
main stream out debug: set config option: sout-smem-time-sync to (null)
main stream out debug: using sout stream module "stream_out_smem"
main stream output debug: stream=`transcode'
main stream out debug: looking for sout stream module matching "transcode": 21 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\stream_out\libstream_out_transcode_plugin.dll', Binary was not built with debug information.
main stream out debug: set config option: sout-transcode-acodec to s16l
stream_out_transcode stream out debug: codec audio=s16l 0Hz 0 channels 96Kb/s
main stream out debug: using sout stream module "stream_out_transcode"
main input debug: using timeshift granularity of 50 MiB, in path 'C:\Users\m1004804\AppData\Local\Temp'
main input debug: `rtsp://10.60.17.102:8554/mp3AudioTest' gives access `rtsp' demux `' path `10.60.17.102:8554/mp3AudioTest'
main input debug: creating demux: access='rtsp' demux='' location='10.60.17.102:8554/mp3AudioTest' file='\\10.60.17.102:8554\mp3AudioTest'
main demux debug: looking for access_demux module matching "rtsp": 12 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\access\liblive555_plugin.dll', Binary was not built with debug information.
live555 demux debug: version 2014.01.21
'Player.exe': Loaded 'C:\Windows\System32\mswsock.dll'
'Player.exe': Loaded 'C:\Windows\System32\WSHTCPIP.DLL'
'Player.exe': Loaded 'C:\Windows\System32\nlaapi.dll'
'Player.exe': Loaded 'C:\Windows\System32\NapiNSP.dll'
'Player.exe': Loaded 'C:\Windows\System32\pnrpnsp.dll'
'Player.exe': Loaded 'C:\Windows\System32\dnsapi.dll'
'Player.exe': Loaded 'C:\Windows\System32\winrnr.dll'
'Player.exe': Loaded 'C:\Program Files\Audinate\Shared Files\mdnsNSP.dll'
'Player.exe': Loaded 'C:\Windows\System32\dante_dnssd.dll'
'Player.exe': Loaded 'C:\Windows\System32\IPHLPAPI.DLL'
'Player.exe': Loaded 'C:\Windows\System32\winnsi.dll'
live555 demux debug: RTP subsession 'audio/MPA'
main input debug: selecting program id=0
live555 demux debug: setup start: 0.000000 stop:363.906000
live555 demux debug: We have a timeout of 65 seconds
live555 demux debug: spawned timeout thread
live555 demux debug: play start: 0.000000 stop:363.906000
main demux debug: using access_demux module "live555"
main decoder debug: looking for packetizer module matching "any": 21 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libtheora_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\librawvideo_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libspeex_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libvorbis_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libaes3_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\liblpcm_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_flac_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_dirac_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_mlp_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_mpeg4audio_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_vc1_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libsvcdsub_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libspudec_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_mpeg4video_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_mpegvideo_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libcvdsub_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\packetizer\libpacketizer_h264_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libmpeg_audio_plugin.dll', Binary was not built with debug information.
main decoder debug: using packetizer module "mpeg_audio"
main input debug: starting in sync mode
main demux meta debug: looking for meta reader module matching "any": 2 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\meta_engine\libtaglib_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\lua\liblua_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'C:\Windows\System32\profapi.dll'
lua demux meta debug: Trying Lua scripts in C:\Users\m1004804\AppData\Roaming\vlc\lua\meta\reader
lua demux meta debug: Trying Lua scripts in d:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\lua\meta\reader
lua demux meta debug: Trying Lua playlist script d:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\lua\meta\reader\filename.luac
main demux meta debug: no meta reader modules matched
main input debug: `rtsp://10.60.17.102:8554/mp3AudioTest' successfully opened
main input debug: switching to async mode
live555 demux debug: tk->rtpSource->hasBeenSynchronizedUsingRTCP()
mpeg_audio decoder debug: MPGA channels:2 samplerate:44100 bitrate:128
main input error: ES_OUT_RESET_PCR called
main stream output debug: adding a new sout input (sout_input:00aee6f8)
stream_out_transcode stream out debug: creating audio transcoding from fcc=`mpga' to fcc=`s16l'
main generic debug: looking for decoder module matching "any": 39 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libpng_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libcdg_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libschroedinger_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libdts_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libfaad_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libflac_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libg711_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\liblibass_plugin.dll', Binary was not built with debug information.
main generic debug: using decoder module "mpeg_audio"
main encoder debug: looking for encoder module matching "any": 17 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libx264_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\codec\libaraw_plugin.dll', Binary was not built with debug information.
araw encoder debug: samplerate:44100Hz channels:2 bits/sample:16
main encoder debug: using encoder module "araw"
main stream out debug: input 'mpga' 44100 Hz Stereo frame=1152 samples/1053 bytes
main stream out debug: conversion: 'mpga'->'s16l' 44100 Hz->44100 Hz Stereo->Stereo
main audio converter debug: looking for audio converter module matching "any": 12 candidates
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libmpgatofixed32_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libdtstofloat32_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\liba52tofloat32_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libsamplerate_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libsimple_channel_mixer_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\liba52tospdif_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libdtstospdif_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libdolby_surround_decoder_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libugly_resampler_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libtrivial_channel_mixer_plugin.dll', Binary was not built with debug information.
'Player.exe': Loaded 'D:\WSM4.2\WSM 4.2\SampleCode-smem-ext\Player\Win32\Debug\plugins\audio_filter\libaudio_format_plugin.dll', Binary was not built with debug information.
main audio converter debug: no audio converter modules matched
main audio converter debug: looking for audio converter module matching "any": 12 candidates
mpgatofixed32 audio converter debug: mpga->f32l, bits per sample: 32
main audio converter debug: using audio converter module "mpgatofixed32"
main audio converter debug: looking for audio converter module matching "any": 12 candidates
audio_format audio converter debug: f32l->s16l, bits per sample: 32->16
main audio converter debug: using audio converter module "audio_format"
main stream out debug: conversion pipeline complete
main audio resampler debug: looking for audio resampler module matching "any": 3 candidates
main audio resampler debug: using audio resampler module "ugly_resampler"
main input debug: Buffering 0%
main input debug: Buffering 7%
main input debug: Buffering 15%
main input debug: Buffering 23%
main input debug: Buffering 31%
main input debug: Buffering 39%
main input debug: Buffering 47%
main input debug: Buffering 54%
main input debug: Buffering 62%
main input debug: Buffering 70%
main input debug: Buffering 78%
main input debug: Buffering 86%
main input debug: Buffering 94%
main input debug: Stream buffering done (1018 ms in 726 ms)
main input debug: Decoder buffering done in 0 ms
mpeg_audio generic debug: MPGA channels:2 samplerate:44100 bitrate:128
mpgatofixed32 audio converter error: libmad error: bad main_data_begin pointer
mpgatofixed32 audio converter error: libmad error: bad main_data_begin pointer