Bug 50951

Summary: (Passthrough?) playback asserts with s24le output
Product: PulseAudio Reporter: Arun Raghavan <arun>
Component: daemonAssignee: pulseaudio-bugs
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 50956    

Description Arun Raghavan 2012-06-11 00:01:53 UTC
SpmP on IRC reported an assert in pa_memblockq_drop() (backtrace below). Looking at the alsa-sink setup, looks like this happens because we're passing an s16le stream to an s24le sink without resampling. This should have been caught in format negotiation, but apparently wasn't. Further investigation into why that happened is required.

Filing this bug so it does not get forgotten.

----

    gdb pulseaudio
    run --system --daemonize=0 --high-priority
     
    E: [alsa-sink] memblockq.c: Assertion 'length % bq->base == 0' failed at pulsecore/memblockq.c:613, function pa_memblockq_drop(). Aborting.
     
    Program received signal SIGABRT, Aborted.
    [Switching to Thread 0xb2989b70 (LWP 23758)]
    0xb7fe2424 in ?? ()
    bt
    #0 0xb7fe2424 in ?? ()
    #1 0xb7c93d72 in *__GI_abort () at abort.c:92
    #2 0xb7eea88d in pa_memblockq_drop (bq=0x811ea08, length=5382)
    at pulsecore/memblockq.c:613
    #3 0xb116fc57 in sink_input_pop_cb (i=0x811bc90, nbytes=5382,
    chunk=0xb2986c98) at pulsecore/protocol-native.c:1613
    #4 0xb7f649f4 in pa_sink_input_peek (i=0x811bc90, slength=5382,
    chunk=chunk@entry=0xb2986eb0, volume=volume@entry=0xb2986ebc)
    at pulsecore/sink-input.c:836
    #5 0xb7f6cda8 in fill_mix_info (s=s@entry=0x806fc90,
    length=length@entry=0xb2986e1c, info=info@entry=0xb2986eb0, maxinfo=32)
    at pulsecore/sink.c:965
    #6 0xb7f6f3b2 in pa_sink_render_into (s=s@entry=0x806fc90,
    target=target@entry=0xb2989214) at pulsecore/sink.c:1204
    #7 0xb7f6fa10 in pa_sink_render_into_full (s=0x806fc90,
    target=target@entry=0xb29892f4) at pulsecore/sink.c:1288
    #8 0xb32c8519 in mmap_write (on_timeout=false, polled=false,
    sleep_usec=<synthetic pointer>, u=0x520) at modules/alsa/alsa-sink.c:633
    #9 thread_func (userdata=0x8082288) at modules/alsa/alsa-sink.c:1694
    #10 0xb7f042fa in internal_thread_func (userdata=0x8086930)
    at pulsecore/thread-posix.c:83
    #11 0xb7dc8c39 in start_thread (arg=0xb2989b70) at pthread_create.c:304
    #12 0xb7d3640e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
     
    up
    up
    p *bq
    $1 = {blocks = 0x8116670, blocks_tail = 0x8116650, current_read = 0x8116670,
    current_write = 0x8116650, n_blocks = 54, maxlength = 4194304,
    tlength = 46080, base = 4, prebuf = 0, minreq = 3840, maxrewind = 576000,
    read_index = 0, write_index = 331776, in_prebuf = false, silence = {
    memblock = 0xb33fb000, index = 0, length = 65496}, mcalign = 0x8116840,
    missing = 0, requested = -285696,
    name = 0x8119f10 "native protocol playback stream memblockq [3]",
    sample_spec = {format = PA_SAMPLE_S16LE, rate = 48000, channels = 2 '\002'}}

----



    p *(struct userdata *)userdata
    $3 = {core = 0x80637f0, module = 0x8068c68, sink = 0x806fc90,
    thread = 0x8086930, thread_mq = {mainloop = 0x80616d8, inq = 0x808eec8,
    outq = 0x811f310, read_event = 0x8087b20, write_event = 0x80872e0},
    rtpoll = 0x8086828, pcm_handle = 0x80f49a8, paths_dir = 0x0,
    mixer_fdl = 0x0, mixer_pd = 0x0, mixer_handle = 0x8117ae0,
    mixer_path_set = 0x80ef110, mixer_path = 0x80f3d28, hardware_volume = {
    channels = 2 '\002', values = {0 <repeats 32 times>}}, rates = 0x81263d8,
    frame_size = 6, fragment_size = 288000, hwbuf_size = 576000,
    tsched_watermark = 2880, tsched_watermark_ref = 5760,
    hwbuf_unused = 570240, min_sleep = 2880, min_wakeup = 1152,
    watermark_inc_step = 2880, watermark_dec_step = 1440,
    watermark_inc_threshold = 0, watermark_dec_threshold = 28800,
    rewind_safeguard = 378, watermark_dec_not_before = 0,
    min_latency_ref = 500, memchunk = {memblock = 0x0, index = 0, length = 0},
    device_name = 0x8116580 "iec958:1", control_device = 0x80d00b8 "hw:1",
    use_mmap = true, use_tsched = true, deferred_volume = true,
    fixed_latency_range = false, first = false, after_rewind = true,
    alsa_rtpoll_item = 0x8072590, smoother = 0x808c730, write_count = 472872,
    since_start = 478254, smoother_interval = 200000,
    last_smoother_update = 2790922706210, formats = 0x80755d8, reserve = 0x0,
    reserve_slot = 0x0, monitor = 0x0, monitor_slot = 0x0}

----

$4 = {parent = {parent = {_ref = {value = 4}, type_id = 0xb7fa74c8 "pa_sink",
free = 0xb7f6e0e0 <sink_free>,
check_type = 0xb7f6bf00 <pa_sink_check_type>},
process_msg = 0xb32c6e50 <sink_process_msg>}, index = 2,
core = 0x80637f0, state = PA_SINK_IDLE, flags = 422, suspend_cause = 0,
name = 0x8087330 "alsa_output.usb-Creative_Technology_SB_X-Fi_Surround_5.1-00-S51.iec958-stereo", driver = 0x81379d8 "module-alsa-card.c",
proplist = 0x80f4290, module = 0x8068c68, card = 0x806c668, sample_spec = {
format = PA_SAMPLE_S24LE, rate = 48000, channels = 2 '\002'},
channel_map = {channels = 2 '\002', map = {PA_CHANNEL_POSITION_FRONT_LEFT,
PA_CHANNEL_POSITION_FRONT_RIGHT,
PA_CHANNEL_POSITION_INVALID <repeats 30 times>}},
default_sample_rate = 48000, alternate_sample_rate = 0, inputs = 0x80763f8,
n_corked = 1, monitor_source = 0x808f0e0, input_to_master = 0x0,
base_volume = 65536, n_volume_steps = 65537, reference_volume = {
channels = 2 '\002', values = {65536, 65536, 3221221048, 3085810172, 28,
2, 2, 50281942, 134598720, 3086733300, 135380332, 3086733300,
135380464, 135380728, 3086733300, 3086280200, 134598720, 135380596,
135380728, 3, 135380112, 3086280171, 3086733300, 3086366328, 134598720,
3086021635, 103, 3085874061, 3086022352, 3086366299, 3086733300,
3086379228}}, real_volume = {channels = 2 '\002', values = {65536,
65536, 0 <repeats 30 times>}}, soft_volume = {channels = 2 '\002',
values = {65536, 65536, 0 <repeats 30 times>}}, muted = false,
---Type <return> to continue, or q <return> to quit---
refresh_volume = false, refresh_muted = false, save_port = true,
save_volume = true, save_muted = false, saved_volume = {
channels = 2 '\002', values = {65536, 65536, 0 <repeats 30 times>}},
saved_save_volume = true, asyncmsgq = 0x808eec8, silence = {
memblock = 0xb33fb000, index = 0, length = 65496}, ports = 0x80809b0,
active_port = 0x8091710, mixer_dirty = {value = 0}, priority = 9048,
set_state = 0xb32c8d70 <sink_set_state_cb>, get_volume = 0, set_volume = 0,
write_volume = 0, get_mute = 0, set_mute = 0, request_rewind = 0,
update_requested_latency = 0xb32c5e10 <sink_update_requested_latency_cb>,
set_port = 0xb32c38f0 <sink_set_port_cb>,
get_formats = 0xb32c69f0 <sink_get_formats>,
set_formats = 0xb32c6bf0 <sink_set_formats>, update_rate = 0,
thread_info = {state = PA_SINK_IDLE, inputs = 0x8116bf8,
rtpoll = 0x8086828, soft_volume = {channels = 2 '\002', values = {65536,
65536, 0 <repeats 30 times>}}, soft_muted = false,
requested_latency_valid = true, requested_latency = 20000,
max_rewind = 576000, max_request = 5760, rewind_nbytes = 0,
rewind_requested = false, min_latency = 500, max_latency = 2000000,
fixed_latency = 0, volume_changes = 0x0, volume_changes_tail = 0x0,
current_hw_volume = {channels = 2 '\002', values = {65536, 65536,
0 <repeats 29 times>, 1048}}, volume_change_safety_margin = 8000,
volume_change_extra_delay = 0}, userdata = 0x8082288}
Comment 1 Tanu Kaskinen 2012-06-11 02:01:49 UTC
Would be nice to fix for 3.0.
Comment 2 Arun Raghavan 2012-11-19 07:42:05 UTC
I've pushed a fix for this that makes sure we don't try to hook up a passthrough stream when sample specs don't match. Please reopen if you still see this with the next pre-release/release (when it's out).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.