[MPlayer-users] Audio resource leak during live analog TV playback
Jonathan Lantzy
jlantzy at versatile.com
Tue Jan 29 21:15:09 CET 2013
I'm constantly running into an audio glitch with MPlayer while playing
analog television (composite input) through a Hauppauge WinTV-HVR-950Q
tuner. After letting it run for two or three hours, there is noticeable
stuttering in the audio feed. The status line shows a slow, but steady
increase in the 'audio codec CPU usage' percentage, which seem to correlate
with when the audio glitches occur.
Below are my hardware specifications:
* Intel Core 2 Duo CPU T5250 (1.50 Ghz)
* 4 GB of RAM
* NVIDIA ION (C79) Graphics Processor
* NVIDIA MCP79 Audio chipset
I'm running a custom build of Slackware 13.37 with the following: (also
tested with standard Ubuntu 12.20 installation)
* Linux 3.3.6 kernel
* libc-2.13 libraries
* GNU assembler 2.21.51
* Compiled version of MPlayer 1.1 official release (also have tried to
the latest subversion build, r35901)
The following is used to run MPlayer and watch analog TV over the composite
input of the HVR-950Q.
/usr/bin/mplayer -slave -quiet -idle -msglevel input=2:cplayer=6:global=6
-display :0 -tv
driver=v4l2:device=/dev/video0:norm=NTSC-M:chanlist=us-bcast:alsa=1:adevice=hw.1:audiorate=48000:immediatemode=0:amode=1
-framedrop -lavdopts fast:threads=2 -delay 0.25 -ao alsa tv:///1
Sample output can be found at the bottom of this message, with default
verbosity.
----
On to the details. After running analog television for an extended period
of time, I've noticed regular audio hiccups in playback. It's not
noticable at first, but after two to three hours, it's as if the audio is
skipping ahead to keep in sync with the video. When running with normal
logging verbosity, the status line shows the 'audio codec CPU usage' (as
defined in the FAQ:
http://www.mplayerhq.hu/DOCS/HTML/en/faq.html#idp11025504) slowly
increasing over time. I've run a clean X session with only a xterm and
mplayer, and the symptom still appears. When MPlayer first starts, the
audio CPU usage is around 0.1%. In a couple of hours, it's reaches 2 to
3%, and the audio hiccuping is very noticable.
*** Output example:
Starting playback...
A: 304.5 V: 304.5 A-V: 0.000 ct: 0.250 10028/10028 0% 6% 11.2% 0 0
What's unusual is that when I close MPlayer and restart the same command,
the audio CPU usage usually spikes by 4-8% from where it was previously.
So, if I closed MPlayer when the status line shows 1% audio CPU usage, when
I restart, it will immediately show something like 6% utilization.
I only see the CPU utilization reset when I restart the X server.
(Note: I have installed Ubuntu 12.20 with the recommended NVIDIA
proprietary drivers on my hardware, and I see similar symptoms. Audio CPU
utilization starts very high, but drops and stabilizes around 4%, then
slowly rises over time. However, if I restart MPlayer here, audio CPU
utilization resets without needing to restart the X server. Trying to
figure out why this is different from my Slackware build. I suspect ALSA
drivers might be involved.)
Any advice or suggestion would be helpful. I would be open to using a
third party to capture and playback audio while MPlayer handles the
video/tuning, as long as there's a reasonable way to keep things in sync.
Details on the WinTV HVR-950Q can be found here:
http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-950Q
----
*** Verbose output (terminated early)
MPlayer SVN-r35901-snapshot-4.5.2 (C) 2000-2013 MPlayer Team
CPU vendor name: GenuineIntel max cpuid level: 10
CPU: Intel(R) Core(TM)2 Duo CPU T5250 @ 1.50GHz (Family: 6, Model: 15,
Stepping: 13)
extended cpuid-level: 8
extended cache-info: 134242368
Detected cache-line size is 64 bytes
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSE3: 1
SSSE3: 1 SSE4: 0 SSE4.2: 0 AVX: 0
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2 SSE3 SSSE3 CMOV
get_path('codecs.conf') -> '//.mplayer/codecs.conf'
Reading optional codecs config file //.mplayer/codecs.conf: No such file or
directory
Reading optional codecs config file /usr/etc/mplayer/codecs.conf: No such
file or directory
Using built-in default codecs.conf.
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
get_path('fonts') -> '//.mplayer/fonts'
Configuration: --prefix=/usr
CommandLine: '-v' '-display' ':0' '-tv'
'driver=v4l2:device=/dev/video0:norm=NTSC-M:chanlist=us-bcast:alsa=1:adevice=hw.1:audiorate=48000:immediatemode=0:amode=1'
'-framedrop' '-lavdopts' 'fast:threads=2' '-delay' '0.25' '-ao' 'alsa'
'tv:///1'
Using nanosleep() timing
get_path('input.conf') -> '//.mplayer/input.conf'
Reading optional input config file //.mplayer/input.conf: No such file or
directory
Parsing input config file /usr/etc/mplayer/input.conf
Input config file /usr/etc/mplayer/input.conf parsed: 1 binds
get_path('1.conf') -> '//.mplayer/1.conf'
Playing tv:///1.
get_path('sub/') -> '//.mplayer/sub/'
STREAM: [tv] tv:///1
STREAM: Description: TV Input
STREAM: Author: Benjamin Zores, Albeu
STREAM: Comment:
TV file format detected.
Selected driver: v4l2
name: Video 4 Linux 2 input
author: Martin Olschewski <olschewski at zpr.uni-koeln.de>
comment: first try, more to come ;-)
Selected device: Hauppauge HVR950Q
Tuner cap: STEREO LANG1 LANG2
Tuner rxs: MONO
Capabilities: video capture VBI capture device tuner audio
read/write streaming
supported norms: 0 = NTSC-M;
inputs: 0 = Television; 1 = Composite; 2 = S-Video;
Current input: 1
Format UYVY (16 bits, Packed YUV2): Packed UYVY
Current format: UYVY
v4l2: setting audio mode
v4l2: current audio mode is : STEREO
v4l2: set format: YVU420
v4l2: ioctl set format failed: Invalid argument
v4l2: set format: YUV420
v4l2: ioctl set format failed: Invalid argument
v4l2: set format: UYVY
v4l2: set input: 1
Selected norm : NTSC-M
v4l2: set norm: NTSC-M
Selected channel list: us-bcast (including 82 channels)
Current frequency: 0 (0.000)
==> Found video stream: 0
v4l2: get format: UYVY
v4l2: get fps: 29.970030
v4l2: get width: 720
v4l2: get height: 480
Hardware PCM card 1 'HVR-950Q' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 48000
period_size : 12000
period_time : 250000
tstamp_mode : NONE
period_step : 1
avail_min : 12000
period_event : 0
start_threshold : 0
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0
v4l2: set audio samplerate: 48000
Hardware PCM card 1 'HVR-950Q' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 48000
period_size : 12000
period_time : 250000
tstamp_mode : NONE
period_step : 1
avail_min : 12000
period_event : 0
start_threshold : 0
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000
appl_ptr : 0
hw_ptr : 0
v4l2: get audio format: 9
==> Found audio stream: 0
v4l2: get audio samplerate: 48000
v4l2: get audio samplesize: 2
v4l2: get audio channels: 2
TV audio: 2 channels, 16 bits, 48000 Hz
Audio capture - buffer 256 blocks of 48000 bytes, skew average from 16 meas.
Using a ring buffer for maximum 1863 frames, 1228 MB total size.
v4l2: set Brightness: 109 [0, 255]
v4l2: set Hue: 0 [-32768, 32768]
v4l2: set Saturation: 128 [0, 255]
v4l2: set Contrast: 121 [0, 255]
[V] filefmt:9 fourcc:0x59565955 size:720x480 fps:29.970 ftime:=0.0334
get_path('sub/') -> '//.mplayer/sub/'
v4l2: going to capture
X11 opening display: :0
vo: X11 color mask: FFFFFF (R:FF0000 G:FF00 B:FF)
vo: X11 running at 1920x1080 with depth 24 and 32 bpp (":0" => local
display)
[x11] Unknown wm type...
[x11] Current fstype setting doesn't honour any X atoms
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 720 x 480 (preferred colorspace: Packed UYVY)
Trying filter chain: vo
VDec: using Packed UYVY as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO Config (720x480->720x480,flags=0,'MPlayer',0x59565955)
VO: [vdpau] 720x480 => 720x480 Packed UYVY
VO: Description: VDPAU with X11
VO: Author: Rajib Mahapatra <rmahapatra at nvidia.com> and others
[vdpau] Updating CSC matrix for BT.601
Selected video codec: [rawuyvy] vfm: raw (RAW UYVY)
==========================================================================
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
dec_audio: Allocating 2048 + 131072 = 133120 bytes for output buffer.
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Trying preferred audio driver 'alsa', options '[none]'
alsa-init: requested format: 48000 Hz, 2 channels, 9
alsa-init: using ALSA 1.0.24.1
alsa-init: setup for 1/2 channel(s)
alsa-init: using device default
alsa-init: opening device in blocking mode
alsa-init: device reopened in blocking mode
alsa-init: got buffersize=16384
alsa-init: got period size 1024
alsa: 48000 Hz/2 channels/4 bpf/16384 bytes buffer/Signed 16 bit Little
Endian
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
AO: Description: ALSA-0.9.x-1.x audio output
AO: Author: Alex Beregszaszi, Zsolt Barat <joy at streamminister.de>
AO: Comment: under development
Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
[dummy] Was reinitialized: 48000Hz/2ch/s16le
[dummy] Was reinitialized: 48000Hz/2ch/s16le
Starting playback...
Increasing filtered audio buffer size from 0 to 18432
*** [vo] Exporting mp_image_t, 720x480x16bpp YUV packed, 691200 bytes
Unicode font: 565 glyphs.
Unicode font: 565 glyphs.
MPlayer interrupted by signal 2 in module: sleep_timer
A: 8.1 V: 8.1 A-V: 0.000 ct: 0.250 241/241 0% 4% 0.1% 0 0
Uninit audio filters...
[libaf] Removing filter dummy
Uninit audio: pcm
Uninit video: raw
MPlayer interrupted by signal 2 in module: free_demuxer
Not enough audio samples!
More information about the MPlayer-users
mailing list