Hi,<br><br>I am doing a little experiment. I record a single channel 16khz raw PCM sample for 3 seconds as a file and then I modify wis-streamer codes for playing this raw sample as audio source.<br><br>Here is the code which I have modified.<br>
<br>void copypcm(char *to)<br>{<br>    int fd;<br>    <br>    printf("copypcm\n");<br>    char buf[96000];<br>    fd = open("/tmp/wav", O_RDWR);<br>  if (fd < 0) <br>   return ;<br>  <br>  memset(buf,0,96000);<br>
  read(fd, buf, sizeof(buf));<br>  memcpy(to,buf,96000);<br>  <br>  close(fd);<br>  printf("copydone\n");<br>  <br>}<br><br>void WISAudioOpenFileSource::readFromFile() {<br>  // Read available audio data:<br>  int timeinc;<br>
  //int ret = read(fInput.fOurAudioFileNo, fTo, fMaxSize);<br> //my modification from here<br><br><br>copypcm(fTo);<br><br>  fFrameSize = (unsigned)96000;<br>  gettimeofday(&fPresentationTime, NULL);  <br><br><br><br>
  /* PR#2665 fix from Robin<br>   * Assuming audio format = AFMT_S16_LE<br>   * Get the current time<br>   * Substract the time increment of the audio oss buffer, which is equal to<br>   * buffer_size / channel_number / sample_rate / sample_size ==> 400+ millisec<br>
   */<br>  timeinc = fFrameSize * 1000 / audioNumChannels / (audioSamplingFrequency/1000) / 2;<br>  while (fPresentationTime.tv_usec < timeinc)<br>  {<br>    fPresentationTime.tv_sec -= 1;<br>    timeinc -= 1000000;<br>
  }<br>  fPresentationTime.tv_usec -= timeinc;<br>}<br><br><br>The audio can't be played by VLC and VLC complains about PTS is out of range. Is there any thing wrong with my modification?<br>By the way, I saw VLC drops a lot of audio buffers. Here is the RTSP negotiation detail of my experiment. 192.168.1.168 is the wis-streamer IP.<br>
<br>DESCRIBE rtsp://<a href="http://192.168.1.168:7777/audio">192.168.1.168:7777/audio</a> RTSP/1.0<br>CSeq: 3<br>User-Agent: LibVLC/1.1.5 (LIVE555 Streaming Media v2010.09.25)<br>Accept: application/sdp<br><br><br><br>RTSP/1.0 200 OK<br>
CSeq: 3<br>Date: Sat, Jan 01 2000 02:17:21 GMT<br>Content-Base: rtsp://<a href="http://192.168.1.168:7777/audio/">192.168.1.168:7777/audio/</a><br>Content-Type: application/sdp<br>Content-Length: 341<br><br>v=0<br>o=- 946692776958225 1 IN IP4 192.168.1.30<br>
s=PCM raw source experiment<br>i=audio<br>t=0 0<br>a=tool:LIVE555 Streaming Media v2011.01.06<br>a=type:broadcast<br>a=control:*<br>a=range:npt=0-<br>a=x-qt-text-nam:RTSP/RTP stream<br>a=x-qt-text-inf:audio<br>m=audio 0 RTP/AVP 96<br>
c=IN IP4 0.0.0.0<br>b=AS:128<br>a=rtpmap:96 L16/16000<br>a=control:track1<br><br>SETUP rtsp://<a href="http://192.168.1.168:7777/audio/track1">192.168.1.168:7777/audio/track1</a> RTSP/1.0<br>CSeq: 4<br>User-Agent: LibVLC/1.1.5 (LIVE555 Streaming Media v2010.09.25)<br>
Transport: RTP/AVP;unicast;client_port=3650-3651<br><br><br><br>RTSP/1.0 200 OK<br>CSeq: 4<br>Date: Sat, Jan 01 2000 02:17:21 GMT<br>Transport: RTP/AVP;unicast;destination=192.168.1.99;source=192.168.1.168;client_port=3650-3651;server_port=6970-6971<br>
Session: 04632C22<br><br><br><br>PLAY rtsp://<a href="http://192.168.1.168:7777/audio/">192.168.1.168:7777/audio/</a> RTSP/1.0<br>CSeq: 5<br>User-Agent: LibVLC/1.1.5 (LIVE555 Streaming Media v2010.09.25)<br>Session: 04632C22<br>
Range: npt=0.000-<br><br><br><br>RTSP/1.0 200 OK<br>CSeq: 5<br>Date: Sat, Jan 01 2000 02:17:21 GMT<br>Range: npt=0.000-<br>Session: 04632C22<br>RTP-Info: url=rtsp://<a href="http://192.168.1.168:7777/audio/track1;seq=6548;rtptime=292484997">192.168.1.168:7777/audio/track1;seq=6548;rtptime=292484997</a><br>
<br><br><br>GET_PARAMETER rtsp://<a href="http://192.168.1.168:7777/audio/">192.168.1.168:7777/audio/</a> RTSP/1.0<br>CSeq: 6<br>User-Agent: LibVLC/1.1.5 (LIVE555 Streaming Media v2010.09.25)<br>Session: 04632C22<br><br><br>
<br>RTSP/1.0 200 OK<br>CSeq: 6<br>Date: Sat, Jan 01 2000 02:17:21 GMT<br>Session: 04632C22<br><br><br> <br>