a/src/avtransport.cxx b/src/avtransport.cxx
...
...
392
        LOGERR("set(Next)AVTransportURI: unsupported format: uri " << uri <<
392
        LOGERR("set(Next)AVTransportURI: unsupported format: uri " << uri <<
393
               " metadata " << metadata);
393
               " metadata " << metadata);
394
        return UPNP_E_INVALID_PARAM;
394
        return UPNP_E_INVALID_PARAM;
395
    }
395
    }
396
396
397
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
398
        // If we own the queue, just clear it before setting the
399
        // track.  Else it's difficult to impossible to prevent it
400
        // from growing if upmpdcli restarts. If the option is not set, the
401
        // user prefers to live with the issue.
402
        m_dev->m_mpdcli->clearQueue();
403
    }
404
405
    bool is_song = (st == MpdStatus::MPDS_PLAY) ||
397
    bool is_song = (st == MpdStatus::MPDS_PLAY) ||
406
    (st == MpdStatus::MPDS_PAUSE);
398
    (st == MpdStatus::MPDS_PAUSE);
407
    UPMPD_UNUSED(is_song);
399
    UPMPD_UNUSED(is_song);
408
    int curpos = mpds.songpos;
400
    int curpos = mpds.songpos;
409
    LOGDEB1("UpMpdAVTransport::set" << (setnext?"Next":"") << 
401
    LOGDEB1("UpMpdAVTransport::set" << (setnext?"Next":"") << 
410
            "AVTransportURI: curpos: " <<
402
            "AVTransportURI: curpos: " <<
411
            curpos << " is_song " << is_song << " qlen " << mpds.qlen << endl);
403
            curpos << " is_song " << is_song << " qlen " << mpds.qlen << endl);
404
405
    if ((m_dev->m_options & UpMpd::upmpdOwnQueue) && !setnext) {
406
        // If we own the queue, just clear it before setting the
407
        // track.  Else it's difficult to impossible to prevent it
408
        // from growing if upmpdcli restarts. If the option is not set, the
409
        // user prefers to live with the issue.
410
        m_dev->m_mpdcli->clearQueue();
411
        // mpds is now invalid!
412
        curpos = -1;
413
    }
412
414
413
    // curpos == -1 means that the playlist was cleared or we just started. A
415
    // curpos == -1 means that the playlist was cleared or we just started. A
414
    // play will use position 0, so it's actually equivalent to curpos == 0
416
    // play will use position 0, so it's actually equivalent to curpos == 0
415
    if (curpos == -1) {
417
    if (curpos == -1) {
416
        curpos = 0;
418
        curpos = 0;