[Live-devel] Problem streaming continuous H.264 video over Transport Stream

Bruno Filipe Basilio Bruno.Basilio at brisa.pt
Mon Dec 13 09:19:18 PST 2010


Hi,

I'm using Live555 to send H.264 ES video over Transport Stream using MPEG2TransportStreamFromESSource but the video stream blocks for >20 minutes in every hour or so.
The goal is to deliver a live video stream using an H.264 video encoder as the source, initial tests showed that Transport Stream offered the most fluid stream.
This problem doesn't happen when sending raw H.264 ES using H264VideoRTPSink directly.

After some analysis it's my understanding that MyDeviceSource::doGetNextFrame() stops being called for a long time and MyDeviceSource::deliverFrame() isn't called at all because FrameSource::isCurrentlyAwaitingData() equals false all the time the video has been blocked.

Could you give me some pointers where to look or what to do in order to understand what seems to be the problem using MPEG2TransportStreamFromESSource?
The latest version of live555 isn't as yet integrated.
Your feedback would be very appreciated.

Follows the testMPEG2TransportStreamer.cpp source code changes that detail the object chain used:

void play() {
  // Create the video source:
  MyDeviceSource* deviceSource
      = MyDeviceSource::createNew(*env, path,channel);
  if (deviceSource == NULL) {
      *env << "Unable to open \"" << inputFileName << "\" as a device source\n";
      exit(1);
  }
  *env << "DEBUG: device source successfully opened\n";

  // Create a framer for the Video Elementary Stream:
  FramedFilter * h264framer = H264VideoDiscreteFramer::createNew(*env, deviceSource);

  const int VIDEO_H264_VERSION =5;
  // And generate a Transport Stream from this:
  MPEG2TransportStreamFromESSource * mpeg2tsSource = MPEG2TransportStreamFromESSource::createNew(*env);
  mpeg2tsSource->addNewVideoSource(h264framer, VIDEO_H264_VERSION);
  videoSource=mpeg2tsSource;

  // Finally, start playing:
  *env << "Beginning to read from Picolo H264 encoder...\n";
  videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
}


Also, a part of the DeviceSource extension source code:

void MyDeviceSource::doGetNextFrame() {
  if (!fHaveStartedReading)
  {
    envir().taskScheduler().turnOnBackgroundReadHandling(fd,
      (TaskScheduler::BackgroundHandlerProc*)&fileReadableHandler, this);
    fHaveStartedReading = True;
    FILE_LOG(logDEBUG) << __PRETTY_FUNCTION__
        << ": Frame request by the 'downstream' element, the file read is scheduled.";
  }
}

void MyDeviceSource::doStopGettingFrames() {
  envir().taskScheduler().turnOffBackgroundReadHandling(fd);
  fHaveStartedReading = False;
  FILE_LOG(logDEBUG) << __PRETTY_FUNCTION__ << ": The file read is unscheduled.";
}

void MyDeviceSource::fileReadableHandler( PicoloH264DeviceSource* source, int /*mask*/) {
  if (!source->isCurrentlyAwaitingData()) {
    source->doStopGettingFrames(); // we're not ready for the data yet
    return;
  }
  source->deliverFrame();
}

void MyDeviceSource::deliverFrame() {
  // Deliver the data here:
  ENCODED_DATA data = liveSource->GetData();
  if (data.size <= fMaxSize) {
    memcpy(fTo, data.data , data.size);
    fFrameSize = data.size;
  }
  else {
    memcpy(fTo, data.data , fMaxSize);
    fNumTruncatedBytes = data.size - fMaxSize;
    fFrameSize = fMaxSize;
  }

  //compute fPresentationTime
  timeradd(&presentationTimeBase, &(data.timestamp),&fPresentationTime );

  liveSource->ReleaseData();

  fDurationInMicroseconds = 0;
  // After delivering the data, inform the reader that it is now available:
  FramedSource::afterGetting(this);
}


Best Regards,
Bruno Basilio



--------------------------------------------------------------------------------

Declara??o:
A informa??o contida nesta mensagem, e os ficheiros anexos, ? privilegiada e confidencial, destinando-se exclusivamente ao(s) destinat?rio(s).Se n?o ? o destinat?rio (ou o respons?vel pela sua entrega ao destinat?rio) e recebeu a mesma por engano, fica notificado que ? estritamente proibido reproduzir, guardar ou distribuir toda ou qualquer parte desta mensagem e ficheiros anexos.Por favor reencaminhe a mensagem para o respons?vel pelo seu envio ou contacte-nos por telefone e elimine a mensagem e ficheiros anexos do seu computador,sem os reproduzir.

Disclaimer:
The information contained in this message, and any files attached, is privileged and confidential, and intended exclusively for the included addresses.If you are not the intended recipient (or the person responsible for delivering to the intended recipient) and received this message by mistake, be aware that copy, storage, distribution or any other use of all or part of this message and the files attached is strictly prohibited. Please notify the sender by reply e-mail or contact us by telephone and delete this message and the files attached, without retaining a copy.

--------------------------------------------------------------------------------




More information about the live-devel mailing list