[libdvdnav-devel] [PATCH] [RFC] Read in advance all the IFO file, in order to reduce number of read access

Jean-Baptiste Kempf jb at videolan.org
Sat Sep 27 09:25:52 CEST 2014


On 26 Sep, Diego Biurrun wrote :
> On Fri, Aug 29, 2014 at 01:51:27AM +0200, Jean-Baptiste Kempf wrote:
> > --- a/src/ifo_read.c
> > +++ b/src/ifo_read.c
> > @@ -304,6 +304,15 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
> >  
> > +  // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> > +  ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> > +  void* null_buffer = malloc(s);
> > +  if (null_buffer)
> > +  {
> > +    DVDReadBytes(ifofile->file, null_buffer, s);
> > +    free(null_buffer);
> > +  }
> > +
> > @@ -440,6 +449,15 @@ ifo_handle_t *ifoOpenVMGI(dvd_reader_t *dvd) {
> >  
> > +  // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> > +  ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> > +  void* null_buffer = malloc(s);
> > +  if (null_buffer)
> > +  {
> > +    DVDReadBytes(ifofile->file, null_buffer, s);
> > +    free(null_buffer);
> > +  }
> > +
> > @@ -473,6 +491,15 @@ ifo_handle_t *ifoOpenVTSI(dvd_reader_t *dvd, int title) {
> >  
> > +  // read in advance all the IFO file, in order to keep it in the system buffer and reduce number of read access
> > +  ssize_t s = DVDFileSize(ifofile->file)*DVD_VIDEO_LB_LEN;
> > +  void* null_buffer = malloc(s);
> > +  if (null_buffer)
> > +  {
> > +    DVDReadBytes(ifofile->file, null_buffer, s);
> > +    free(null_buffer);
> > +  }
> 
> The code duplication calls for some refactoring.
> 
> Do we have an idea how much of a performance difference this makes?

When playing from a network, it is visibly better, but I don't know how
we can measure perf on this.

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the libdvdnav-devel mailing list