Dear Experts,<br><br>I have a doubt on my MP3 Streamer.<br><br>This streamer is based on testMP3Streamer code, but I changed to use BasicUDPSink. And it works fine.<br><br>As you know, in play() function, the code was like:<br>
<br>source = MP3FileSource::createNew(*env,fileName);<br><br><br><br>But after I slightly changed my code as follows:<br><br>MP3FileSource *mp3fileSource = MP3FileSource::createNew(*env,fileName);<br>MPEG2TransportStreamFromESSource *m2ts = MPEG2TransportStreamFromESSource::createNew(*env);<br>
m2ts->addNewAudioSource(mp3fileSource,1);<br>source = MPEG2TransportStreamFramer::createNew(*env, m2ts);<br><br>What I want is streaming mp3 within mpeg2ts / udp. For the first round of play, this is perfect. But, when mp3 file reaches end, the stop() and play() functions are called in sequence, the program segment fault when it starts to playing again.<br>
<br>But if I comment the Medium::close() in stop() function, (I do this only for testing purpose), I can repeatedly stream that mp3 file.<br><br>After testing in different ways, I suspect there is something wrong when I use MPEG2TransportStreamFromESSource, especially when I delete it. But according to my understanding, in my code, the delete operations should be:<br>
<br>stop() function --> Medium::close(source) --> delete MPEG2TransportStreamFramer --> delete MPEG2TransportStreamFromESSource --> delete MP3FileSource. It looks OK! But what is wrong? <br><br>Could anyone give me a suggestion?<br>
<br>Thanks<br><br><br>-- <br>Woods<br>