Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDDA track change messages are displayed when the track is buffered, not when it is played. #6468

Closed
vext01 opened this issue Jan 26, 2019 · 3 comments

Comments

@vext01
Copy link

vext01 commented Jan 26, 2019

mpv version and platform

0.22.0 and master at least.

Reproduction steps

Play a cd, and observe erroneous track change messages.

Expected behavior

Display the track change messages as the listener hears the track change.

Actual behavior

The following output was collected playing track one from a CD:

fremen:edd> mpv cdda://
Playing: cdda://
[cdda] Switched to track 1
 (+) Audio --aid=1 (pcm_s16le)
AO: [sdl] 44100Hz stereo 2ch s16
A: 00:00:19 / 00:37:51 (0%) Cache:  9s+24MB
[cdda] Switched to track 2
A: 00:00:35 / 00:37:51 (1%) Cache:  9s+48MB
[cdda] Switched to track 3
A: 00:01:40 / 00:37:51 (4%) Cache: 10s+72MB
[cdda] Switched to track 4
A: 00:03:00 / 00:37:51 (7%) Cache: 10s+73MB

If you run with --no-cache the messages are printed at the correct time. If you have a cache, the messages are printed as the start sector of a track is buffered, which is confusing.

@vext01
Copy link
Author

vext01 commented Jan 26, 2019

You can see why this happens by looking at the buffering code in stream_cdda.c:

static int fill_buffer(stream_t *s, char *buffer, int max_len)
{
    cdda_priv *p = (cdda_priv *)s->priv;
    int16_t *buf;
    int i;

    if (max_len < CDIO_CD_FRAMESIZE_RAW)
        return -1;

    if ((p->sector < p->start_sector) || (p->sector > p->end_sector)) {
        return 0;
    }

    buf = paranoia_read(p->cdp, cdparanoia_callback);
    if (!buf)
        return 0;

    p->sector++;
    memcpy(buffer, buf, CDIO_CD_FRAMESIZE_RAW);

    for (i = 0; i < p->cd->tracks; i++) {
        if (p->cd->disc_toc[i].dwStartSector == p->sector - 1) {
            print_track_info(s, i + 1); <---------------- prints the track change message.
            break;
        }
    }

    return CDIO_CD_FRAMESIZE_RAW;
}

@sl1pkn07
Copy link

sl1pkn07 commented Mar 3, 2019

yep. i seen this yesterday when playing/test some CDs

thanks for report it

greetings

@ghost
Copy link

ghost commented Oct 25, 2019

That's just how the cache works. It could probably be fixed by exposing the current title as tag or something (emulating it with demux_disc maybe, or reusing the thing for ICY shoutcast metadata), but I don't think anyone has a large enough interest in this.

@ghost ghost closed this as completed Oct 25, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants