add some debugging codes
merge mpv upstream