[Live-devel] Matroska BANK_SIZE overflow

Ross Finlayson finlayson at live555.com
Tue Nov 5 20:45:08 PST 2013


> Surely I badly use the matroska parser…
> What I was trying to do is to connect each matroska subsession to a sink. In fact I don’t need ServerMediaSession, it is just to get the FramedSource corresponding to a subsession.

The "MatroskaFileServerDemux" class should be used only within a RTSP server, in which case you don't 'play' the demultiplexed tracks directly; instead, this is done indirectly, via the RTSP server implementation.  I'm not sure exactly why the BANK_SIZE error was occurring for your application, but it turns out that you weren't using the API in the intended way.

If you want to demultiplex the tracks from a Matroska file directly - without a RTSP server - then you can do this; however, the API didn't make this clear.  That was my fault.

To fix this, I have installed a new version (2013.11.06) of the "LIVE555 Streaming Media" code that improves and clarifies the API for demultiplexing a Matroska file.

The following is a version of your demo application that uses the new, cleaned-up API to demultiplex a Matroska file into files for its constituent tracks.  (When I run this, I don't get the BANK_SIZE error.)

///////////////////////////
#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
 
static char newMatroskaFileWatchVariable = 0;
static MatroskaFile* matroskaFile;
static void onMatroskaFileCreation(MatroskaFile* newFile, void* /*clientData*/) {
  matroskaFile = newFile;
  newMatroskaFileWatchVariable = 1;
}
 
int main(int argc, char** argv) {
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);
 
  // Open a Matroska file:
  char const* inputFileName = "test.mkv";
  MatroskaFile::createNew(*env, inputFileName, onMatroskaFileCreation, NULL);
  env->taskScheduler().doEventLoop(&newMatroskaFileWatchVariable);
 
  // Create a demultiplexor from the file:
  MatroskaDemux* demux = matroskaFile->newDemux();

  // And start copying each track:
  unsigned const fileSinkBufferSize = 300000;      
  while (1) {
    unsigned trackNumber;
    FramedSource* trackSource = demux->newDemuxedTrack(trackNumber);
    if (trackSource == NULL) break;

    // For reference, display information about each track:
    MatroskaTrack* trackInfo = matroskaFile->lookup(trackNumber);
    fprintf(stderr, "Reading track %d, codec: %s\n", trackNumber, trackInfo->codecID);

    char outFileName[100];
    sprintf(outFileName, "track%d", trackNumber);
    MediaSink* sink = FileSink::createNew(*env, outFileName, fileSinkBufferSize, False);
    sink->startPlaying(*trackSource,NULL,NULL);        
  }
 
  env->taskScheduler().doEventLoop();
 
  return 0;
}


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20131105/79fb7bfd/attachment.html>


More information about the live-devel mailing list