From owner-freebsd-multimedia@FreeBSD.ORG Tue Dec 8 19:52:59 2009 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECCE41065672; Tue, 8 Dec 2009 19:52:59 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: from mail-ew0-f211.google.com (mail-ew0-f211.google.com [209.85.219.211]) by mx1.freebsd.org (Postfix) with ESMTP id 4E75B8FC14; Tue, 8 Dec 2009 19:52:58 +0000 (UTC) Received: by ewy3 with SMTP id 3so32742ewy.13 for ; Tue, 08 Dec 2009 11:52:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wrbV3nR8TkfqMYkt5OgQdZ1cGxBoy8Cax1kh/8024c8=; b=XvPzL5EO81kb0oLvuMlTgyJe/Cu+VBJbXKt8ztiJPBK0zB6cY7sNnw3HOp7pTdvqyo qsuHh6YF5gdurIuypxb16/VMHuKm1sc0/8GhoDybNfLms2Zfq3QTIF4ktt7AJWt8X0cA kIkcUW8OhiNR/nNUc8FHaC44f/ponrH6M/ujY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=iXo9hCK7H2U6swA8CJHllzRw2AV/dPQPA2H7TWzXp1lRzXIDCGK0GwYKQI9gs1FWgR CtXXu77tZwbbCOYc1wl5VhSDUTFGXx2aXLKVfFGAwARyshweDKH7tOoPHZAqEPc4N2f7 ZtwTYTwk5saLkNFKFEIol+gtzQ0LAs1XYEYwU= MIME-Version: 1.0 Received: by 10.213.2.84 with SMTP id 20mr16276995ebi.90.1260301977586; Tue, 08 Dec 2009 11:52:57 -0800 (PST) In-Reply-To: <2e027be00912081129k1df5bf05g7e9b2fd2804674f1@mail.gmail.com> References: <2e027be00912070613y5b3c4841tcd4d9ff58e1db330@mail.gmail.com> <2e027be00912071114t6a69b0a5vfdefea06e6ea9273@mail.gmail.com> <1260285252.2315.280.camel@balrog.2hip.net> <2e027be00912080744u5c085de0v92a546dbe3e449b4@mail.gmail.com> <2e027be00912081129k1df5bf05g7e9b2fd2804674f1@mail.gmail.com> Date: Tue, 8 Dec 2009 19:52:57 +0000 Message-ID: <2e027be00912081152k328603eej194985d0e6a033cd@mail.gmail.com> From: Tom Evans To: freebsd-multimedia@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: mav@freebsd.org Subject: Re: mplayer SVN plays video too fast on FreeBSD X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 19:53:00 -0000 On Tue, Dec 8, 2009 at 7:29 PM, Tom Evans wrote: > On Tue, Dec 8, 2009 at 3:44 PM, Tom Evans wrot= e: >> On Tue, Dec 8, 2009 at 3:14 PM, Robert Noland wrot= e: >>> On Mon, 2009-12-07 at 19:14 +0000, Tom Evans wrote: >>>> Hi all >>>> >>>> I sent this to the mplayer mailing list earlier today, without >>>> thinking that probably someone on multimedia@ has tried to compile >>>> mplayer from svn. Has anyone succesfully managed to do it? - and get a >>>> working player out of it! >>> >>> I haven't tried mplayer from SVN, but the video playing too fast issue >>> is your audio codec. =C2=A0mplayer (and gstreamer, iirc) seem to set th= e >>> frame rate based on the audio. =C2=A0Generally, what I have seen is tha= t >>> people with ATI/AMD (radeon) video cards with HDMI ports end up with th= e >>> HDMI port as dsp0. =C2=A0If you aren't running the radeonhd driver with= the >>> AUDIO option set, the codec isn't initialized properly and so the video >>> plays too fast. =C2=A0To correct this issue, usually all you need to do= is >>> set the sysctl hw.snd.default_unit to the correct pcm device. Basically= , >>> if you have the following: >>> >>> balrog% cat /dev/sndstat >>> FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64) >>> Installed devices: >>> pcm0: at cad 0 nid 1 on hdac0 kld >>> snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex) >>> pcm1: at cad 0 nid 1 on hdac= 1 >>> kld snd_hda [MPSAFE] (1p:4v/1r:2v channels duplex default) >>> pcm2: at cad 0 nid 1 on hdac= 1 >>> kld snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex) >>> pcm3: at cad 0 nid 1 on >>> hdac1 kld snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex) >>> pcm4: at cad 0 nid 1 on >>> hdac1 kld snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex) >>> >>> Setting "sysctl hw.snd.default_unit=3D1" will choose the primary analog >>> pcm for audio output and mplayer will work fine. >>> >>> robert. >>> >> >> Thanks Robert, the mplayer list also said that mplayer syncs to audio, >> so I've got a few things to check there tonight :) >> >> I'm not using radeonhd or hdmi, I have an amplifier connected to the >> onboard snd_hda via spdif, and use spdif pass through if available on >> the source. I already specify hw.snd.default_unit=3D2, since that is >> seemingly the correct device: >> >> FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64) >> Installed devices: >> pcm0: at cad 0 nid 1 on hdac0 kld >> snd_hda [MPSAFE] (1p:1v/1r:1v channels duplex) >> pcm1: at cad 0 nid 1 on hdac0 kld >> snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex) >> pcm2: at cad 0 nid 1 on hdac0 kld >> snd_hda [MPSAFE] (1p:1v/0r:0v channels simplex default) >> >> Audio plays correctly for both AC3 and MP3 audio tracks in both >> mplayer svn and the port. I wonder if it is possible the codec on this >> snd_hda card is slightly 'strange' and doing something out of the >> ordinary - maybe I'll have a browse of the linux azalia driver and see >> if they have any quirks for it. >> >> Cheers >> >> Tom >> > > Ok, I've made a few more tests. It seems that the problem only comes > about when I run mplayer svn with '-ao oss -afm hwac3'. If I run with > '-ao none' or with '-ao oss' (ie playing 2 channel pcm out over the > digital output), then the video plays back at the correct rate. > > Just to reiterate, all of those options work correctly with the > version in ports - if only that supported vdpau :) > > Alexander, is this like anything you have come across before with the > snd_hda driver? I have bootverbose logs of snd_hda if that helps[1]. > > Cheers > > Tom > > [1] http://pastebin.ca/1707268 > I've discovered the problem, reverting a sound rate fix in mplayer's libao2/ao_oss.c fixes it. Sorry to bother anyone. Cheers Tom PS: For posterity, it is this change that broke it: ------------------------------------------------------------------------ r29750 | cladisch | 2009-10-05 08:42:02 +0100 (Mon, 05 Oct 2009) | 1 line fix calculation of ao_data.bps for sample formats with more than 16 bits ------------------------------------------------------------------------ Index: libao2/ao_oss.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libao2/ao_oss.c (revision 29749) +++ libao2/ao_oss.c (revision 29750) @@ -396,8 +396,19 @@ } ao_data.bps=3Dao_data.channels; - if(ao_data.format !=3D AF_FORMAT_U8 && ao_data.format !=3D AF_FORMAT_S8) + switch (ao_data.format & AF_FORMAT_BITS_MASK) { + case AF_FORMAT_8BIT: + break; + case AF_FORMAT_16BIT: ao_data.bps*=3D2; + break; + case AF_FORMAT_24BIT: + ao_data.bps*=3D3; + break; + case AF_FORMAT_32BIT: + ao_data.bps*=3D4; + break; + } ao_data.outburst-=3Dao_data.outburst % ao_data.bps; // round down ao_data.bps*=3Dao_data.samplerate;