[MPlayer-dev-eng] Performance of libdvdread/libdvdcss

Vicente Sendra visenri at yahoo.es
Fri Aug 31 22:30:02 CEST 2012


--- El vie, 31/8/12, Reimar Döffinger <Reimar.Doeffinger at gmx.de> escribió:

> De: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> Asunto: Re: [MPlayer-dev-eng] Performance of libdvdread/libdvdcss
> Para: mplayer-dev-eng at mplayerhq.hu
> Fecha: viernes, 31 de agosto, 2012 21:43
> On Fri, Aug 31, 2012 at 08:28:37PM
> +0100, Vicente Sendra wrote:
> > I'm new to mplayer developers mailing list, i hope this
> is the right place to talk about this.
> > 
> > Firs of all, i am compiling for Win32 with mingw, and
> testing on my windows xp laptop, but i think all this is ok
> for all other platforms.
> > 
> > I've been developing a new system for double frame rate
> output (for filters like yadif and tfields) that solves 3
> problems with mplayer:
> > 
> > 1-You get exact double framerate timing, old system did
> 2 continuous page flips, resulting in two frames very close
> in time, depending on your video card refresh rate.
> > 
> > 2-New system always pushes filter frames to queue and
> gets them in mplayer.c main loop with
> vf_output_queued_frame, so they can be framedropped if
> needed.
> > 
> > 3-New framedrop system for framerates > video card
> refresh rate, that resulted in 100% cpu usage with vsync
> activated, because page flip gets blocked with full buffer
> until next video card refresh. New system checks page flip
> time and if it gets too big, it starts dropping interpolated
> frames, if no interpolated frames or if dropping them is not
> enougth, only then full frames are dropped, this problem is
> very old but now it's very annoying because most lcd
> monitors can't go > 60hz (my old CRT was set to 75Hz, so
> no problem here).
> > 
> > http://forum.doom9.org/showthread.php?p=1333149
> > http://www.nvnews.net/vbulletin/showthread.php?t=106409
> > 
> > I've got this system working with r34401 (i was getting
> compile errors from las r35119), but debugging this system
> has shown me the low performance of cache system when using
> "Win2K API" for dvd access (vs "libc" acess).
> > 
> > Cache doesn't fill fast enough, even if there is cpu
> time available and, of course, media is fast enough.
> > 
> > Cache works ok with libc and same settings, double
> frame rate and same dvd.
> > 
> > To test it i'm using this command line options:
> > 
> > for win32k:
> > mplayer.exe -ao dsound:device=0 -vf-add yadif=1 
> -dvd-device K:\ -dvdangle 1 -msglevel all=9
> > 
> > for libc:
> > mplayer.exe -ao dsound:device=0 -vf-add yadif=1 
> -dvd-device K:\VIDEO_TS -dvdangle 1 -msglevel all=9
> > 
> > (i set DVDCSS_VERBOSE environment variable to 2 to see
> more info about css)
> > 
> > DVD activity led performs very different with the two
> access methods, win32k blinks a lot, indicating a lot of
> activity, when in fact it fills cache at a lower speed, with
> libc, it barely lights up but it fills cache pretty
> quickly.
> > 
> > Any ideas on how can i improve reading with win32k.
> 
> As you can see both functions do basically the same thing,
> even if one
> uses the windows ReadFile etc. APIs directly.
> Are you sure it isn't your DVD drive that after
> authentication switches
> to a special "Video DVD playback" mode that completely
> breaks
> performance?

Thre drive performs ok with other DVD playing software (windvd of powerdvd, media player classic...), i've observed this behavior before (dvd activity led shows a notable difference), even before doing all this modifications, it is just more noticeable with double frame rate. I was testing in my laptop, but i observed the very same behavior with my desktop.

I've tested an scrambled dvd with:

mplayer.exe -ao dsound:device=0 -vf-add yadif=1 -dvd-device K:\VIDEO_TS -dvdangle 1 -msglevel all=9

And it finally it plays the file, but decoding takes a long time:

######### libc: #######

libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdcss debug: opening target `K:\VIDEO_TS'
libdvdcss debug: using libc for access
libdvdcss debug: cannot open K:\VIDEO_TS (Permission denied)
libdvdcss error: failed to open device
libdvdread: Could not open K:\VIDEO_TS with libdvdcss.
libdvdread: Can't open K:\VIDEO_TS for reading
libdvdread: Device K:\VIDEO_TS inaccessible, CSS authentication not available.
libdvdcss debug: opening target `K:\VIDEO_TS/VIDEO_TS.IFO'
libdvdcss debug: using libc for access
libdvdcss debug: opening target `K:\VIDEO_TS/VTS_01_0.IFO'
libdvdcss debug: using libc for access
libdvdcss debug: using CSS key cache dir: C:\Documents and Settings\VISENRI/.dvd
css/-0c4d59000c4e6200-0000000000/
libdvdcss debug: opening target `K:\VIDEO_TS/VTS_01_1.VOB'
libdvdcss debug: using libc for access
libdvdcss debug: cracking title key at block 0
libdvdcss debug: at block 4096, still cracking...
libdvdcss debug: at block 8192, still cracking...
libdvdcss debug: at block 12288, still cracking... 
......

and after 2 minutes it starts playing


just for reference, the same DVD with Win2K
######### Win2K: #######

libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdcss debug: opening target `K:\'
libdvdcss debug: using Win2K API for access
libdvdcss debug: disc reports copyright information 0x1
libdvdcss debug: drive region mask 0xfd, RPC-II, region code set
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: decrypting disc key f4:d3:7b:1e:0d
libdvdcss debug: trying player key 01:af:e3:12:80
libdvdcss debug: decrypted disc key is 00:00:00:00:0b

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdcss debug: getting title key at block 289 the classic way
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: title key is 00:00:00:00:00
libdvdcss debug: unencrypted title
libdvdcss debug: getting title key at block 32475 the classic way
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: initial disc key 00:00:00:00:0b
libdvdcss debug: decrypted title key c0:00:00:00:0b
libdvdcss debug: title key is c0:00:00:00:0b
libdvdcss debug: getting title key at block 45454 the classic way
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: initial disc key 00:00:00:00:0b
libdvdcss debug: decrypted title key c0:00:00:00:0b
libdvdcss debug: title key is c0:00:00:00:0b
libdvdcss debug: getting title key at block 1600953 the classic way
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: initial disc key 00:00:00:00:0b
libdvdcss debug: decrypted title key c0:00:00:00:0c
libdvdcss debug: title key is c0:00:00:00:0c
libdvdcss debug: getting title key at block 1600958 the classic way
libdvdcss debug: requesting AGID
libdvdcss debug: drive authenticated, using variant 0
libdvdcss debug: authentication established
libdvdcss debug: GetASF authenticated, ASF=1
libdvdcss debug: initial disc key 00:00:00:00:0b
libdvdcss debug: decrypted title key c0:00:00:00:0c
libdvdcss debug: title key is c0:00:00:00:0c

Plays files in seconds.


If, as you say, both win32k and libc do the same thing, can libc read the disc the same way it does win32k? , i mean, authenticating the disc, getting the disc key and so on.

I think it's just a matter of passing the root drive to the function that shows this message with libc:
debug: cannot open K:\VIDEO_TS (Permission denied).

If this can't be done, another solution would be to get keys with win32 and handle the files with libc.

I'm going to have a look at the code, any advice?




More information about the MPlayer-dev-eng mailing list