[mythtv] "The fallacy that is: spawning a decoder thread will always result in playing" or "Hurry up and wait"

Anduin Withers awithers at anduin.com
Thu Aug 7 17:35:46 EDT 2003


I'm not including a patch. My quick attempt at fixing the problem caused
another. I'm hoping that someone more familiar with the code will see a
better solution than what didn't work for me.

Intro done, on to the problem: When a decoder thread is spawned (tv_play.cpp
SpawnDecoder) it is assumed that at some point the decoder thread will start
playing.

Actual code:

        pthread_create(&decode, NULL, SpawnDecode, nvp);

        while (!nvp->IsPlaying())
            usleep(50);

Normally this is true... unless NuppelVideoPlayer::StartPlaying can't open
the file:

    if (OpenFile() < 0)
        return;

The file open check happens a full 20 lines or so before setting:

    playing = true;

and with the IsPlaying() function doing nothing more than returning
'playing', well you see the problem.

PlaybackBox seems to work around this by introducing a timeout waiting for
the decoder thread to start playing. I don't know if that is the right
solution, it wasn't the one I tried.

--
Anduin Withers




More information about the mythtv-dev mailing list