Ticket #2287: multi-pip-dbg-only-v9.patch

File multi-pip-dbg-only-v9.patch, 10.6 KB (added by danielk, 15 years ago)

Debugging portion of multi-pip patch.. if you want to fix any of the problems, this is a good thing to apply first..

  • libs/libmythtv/avformatdecoder.cpp

     
    873873 *  \param novideo if true then no video is sought in ScanSreams.
    874874 *  \param testbuf this parameter is not used by AvFormatDecoder.
    875875 */
     876extern "C" {
     877#include "libavutil/crc.h"
     878}
    876879int AvFormatDecoder::OpenFile(RingBuffer *rbuffer, bool novideo,
    877880                              char testbuf[kDecoderProbeBufferSize],
    878881                              int testbufsize)
     
    899902        probe.buf_size = kDecoderProbeBufferSize - AVPROBE_PADDING_SIZE;
    900903
    901904    fmt = av_probe_input_format(&probe, true);
     905    uint checksum = av_crc(av_crc_get_table(AV_CRC_32_IEEE),
     906                           (uint32_t) -1,
     907                           (uint8_t*)testbuf, probe.buf_size - 1);
    902908    if (!fmt)
    903909    {
    904910        VERBOSE(VB_IMPORTANT, LOC_ERR +
    905                 QString("Probe failed for file: \"%1\".").arg(filename));
     911                QString("Probe failed for file: '%1' probe size %2 crc 0x%3")
     912                .arg(filename).arg(probe.buf_size).arg(checksum,0,16));
    906913        return -1;
    907914    }
     915    VERBOSE(VB_IMPORTANT, LOC +
     916            QString("Probe suceeded for file: '%1' probe size %2 crc 0x%3")
     917            .arg(filename).arg(probe.buf_size).arg(checksum,0,16));
    908918
    909919    fmt->flags |= AVFMT_NOFILE;
    910920
  • libs/libmythtv/tv_play.h

     
    291291
    292292    int  StartTimer(int interval, int line);
    293293    void KillTimer(int id);
    294     void ForceNextStateNone(PlayerContext*);
     294    void ForceNextStateNone(PlayerContext*, int line);
    295295    void ScheduleStateChange(PlayerContext*);
    296296    void SetErrored(PlayerContext*);
    297     void SetExitPlayer(bool set_it, bool wants_to) const;
     297    void SetExitPlayerReal(bool set_it, bool wants_to, int line) const;
    298298    void SetUpdateOSDPosition(bool set_it);
    299299
    300300    bool PxPHandleAction(PlayerContext*,const QStringList &actions);
  • libs/libmythtv/playercontext.cpp

     
    102102        newPlaygroup = playingInfo->playgroup;
    103103    }
    104104
    105     ChangeState(newState);
     105    ChangeState(newState, __LINE__);
    106106    SetPlayGroup(newPlaygroup);
    107107}
    108108
     
    589589/**
    590590*   \brief Puts a state change on the nextState queue.
    591591*/
    592 void PlayerContext::ChangeState(TVState newState)
     592void PlayerContext::ChangeState(TVState newState, int line)
    593593{
     594    VERBOSE(VB_IMPORTANT, QString("ChangeState(%1,%2)")
     595            .arg(StateToString(newState)).arg(line));
    594596    QMutexLocker locker(&stateLock);
    595597    nextState.enqueue(newState);
    596598}
     
    604606/**
    605607 * \brief Removes any pending state changes, and puts kState_None on the queue.
    606608 */
    607 void PlayerContext::ForceNextStateNone(void)
     609void PlayerContext::ForceNextStateNone(int line)
    608610{
     611    VERBOSE(VB_IMPORTANT, QString("ForceNextStateNone(%2)").arg(line));
    609612    QMutexLocker locker(&stateLock);
    610613    nextState.clear();
    611614    nextState.push_back(kState_None);
  • libs/libmythtv/tv_play.cpp

     
    6565
    6666#define GetPlayer(X,Y) GetPlayerHaveLock(X, Y, __FILE__ , __LINE__)
    6767#define GetOSDLock(X) GetOSDL(X, __FILE__, __LINE__)
     68#define SetExitPlayer(X,Y) SetExitPlayerReal(X,Y,__LINE__)
    6869
    6970const int  TV::kInitFFRWSpeed                = 0;
    7071const uint TV::kInputKeysMax                 = 6;
     
    178179            VERBOSE(VB_PLAYBACK, LOC + "tv->LiveTV() -- begin");
    179180            if (!tv->LiveTV(showDialogs, startInGuide))
    180181            {
    181                 tv->SetExitPlayer(true, true);
     182                tv->SetExitPlayerReal(true, true, __LINE__);
    182183                quitAll = true;
    183184            }
    184185            VERBOSE(VB_PLAYBACK, LOC + "tv->LiveTV() -- end");
     
    20662067    mctx = GetPlayerWriteLock(0, __FILE__, __LINE__);
    20672068    if (!mctx->IsErrored() && (GetState(mctx) != kState_None))
    20682069    {
    2069         mctx->ForceNextStateNone();
     2070        mctx->ForceNextStateNone(__LINE__);
    20702071        HandleStateChange(mctx, mctx);
    20712072        if (jumpToProgram)
    20722073            TeardownPlayer(mctx, mctx);
     
    23802381                jumpToProgram = false;
    23812382            }
    23822383            else
    2383                 ForceNextStateNone(mctx);
     2384                ForceNextStateNone(mctx, __LINE__);
    23842385        }
    23852386        else
    2386             ForceNextStateNone(mctx);
     2387            ForceNextStateNone(mctx, __LINE__);
    23872388
    23882389        ReturnPlayerLock(mctx);
    23892390
     
    25822583            (mctx->nvp && mctx->nvp->IsErrored()) || mctx->IsErrored())
    25832584        {
    25842585            SetExitPlayer(true, false);
    2585             ForceNextStateNone(mctx);
     2586            ForceNextStateNone(mctx, __LINE__);
    25862587            error = true;
    25872588        }
    25882589
     
    25902591        {
    25912592            PlayerContext *ctx = GetPlayer(mctx, i);
    25922593            if (error || ctx->IsErrored())
    2593                 ForceNextStateNone(ctx);
     2594                ForceNextStateNone(ctx, __LINE__);
    25942595        }
    25952596        ReturnPlayerLock(mctx);
    25962597
     
    27032704    QObject::killTimer(id);
    27042705}
    27052706
    2706 void TV::ForceNextStateNone(PlayerContext *ctx)
     2707void TV::ForceNextStateNone(PlayerContext *ctx, int line)
    27072708{
    2708     ctx->ForceNextStateNone();
     2709    ctx->ForceNextStateNone(line);
    27092710    ScheduleStateChange(ctx);
    27102711}
    27112712
     
    27232724    errorRecoveryTimerId = StartTimer(1, __LINE__);
    27242725}
    27252726
    2726 void TV::SetExitPlayer(bool set_it, bool wants_to) const
     2727void TV::SetExitPlayerReal(bool set_it, bool wants_to, int line) const
    27272728{
     2729    VERBOSE(VB_IMPORTANT,
     2730            LOC + "SetExitPlayer("<<set_it<<","<<wants_to<<","<<line<<")");
     2731
    27282732    QMutexLocker locker(&timerIdLock);
    27292733    if (set_it)
    27302734    {
     
    27802784            continue;
    27812785        }
    27822786
    2783         ForceNextStateNone(ctx);
     2787        ForceNextStateNone(ctx, __LINE__);
    27842788        if (mctx == ctx)
    27852789        {
    27862790            endOfRecording = true;
     
    39263930    }
    39273931    else if (has_action("ESCAPE", actions))
    39283932    {
     3933        VERBOSE(VB_IMPORTANT, LOC + "ESCAPE");
     3934
    39293935        osd = GetOSDLock(ctx);
    39303936        if (StateIsLiveTV(ctx->GetState()) &&
    39313937            (ctx->lastSignalMsgTime.elapsed() <
     
    45984604        swap(player[0],player[1]);
    45994605        player[0]->SetPIPState(kPIPOff);
    46004606        // End the old main context..
    4601         ForceNextStateNone(mctx);
     4607        ForceNextStateNone(mctx, __LINE__);
    46024608    }
    46034609
    46044610    VERBOSE(VB_PLAYBACK, LOC + "CreatePBP() -- end : "<<ok);
     
    46984704            return true;
    46994705        }
    47004706
    4701         ForceNextStateNone(ctx);
     4707        ForceNextStateNone(ctx, __LINE__);
    47024708        VERBOSE(VB_IMPORTANT, "StartPlayer PiP -- end : !ok");
    47034709        return false;
    47044710    }
     
    48554861    msg = (ctx1->isPIP()) ? tr("Stopping PIP") : tr("Stopping PBP");
    48564862    if (dctx)
    48574863    {
    4858         ForceNextStateNone(dctx);
     4864        ForceNextStateNone(dctx, __LINE__);
    48594865    }
    48604866    else
    48614867    {
     
    48664872        }
    48674873
    48684874        for (uint i = player.size() - 1; i > 0; i--)
    4869             ForceNextStateNone(GetPlayer(actx,i));
     4875            ForceNextStateNone(GetPlayer(actx,i), __LINE__);
    48704876    }
    48714877
    48724878    OSD *osd = GetOSDLock(mctx);
     
    50635069        return;
    50645070    }
    50655071
    5066     ForceNextStateNone(mctx);
     5072    ForceNextStateNone(mctx, __LINE__);
    50675073    VERBOSE(VB_PLAYBACK, LOC +
    50685074            "PBPRestartMainNVP -- end !ok NVP did not restart");
    50695075}
     
    50975103    {
    50985104        VERBOSE(VB_IMPORTANT, loc +
    50995105                "Failed to restart new main context (was pip context)");
    5100         ForceNextStateNone(mctx);
     5106        ForceNextStateNone(mctx, __LINE__);
    51015107        return;
    51025108    }
    51035109
     
    51225128        { // TODO print OSD informing user of Swap failure ?
    51235129            VERBOSE(VB_IMPORTANT, loc +
    51245130                    "Failed to restart new pip context (was main context)");
    5125             ForceNextStateNone(pipctx);
     5131            ForceNextStateNone(pipctx, __LINE__);
    51265132        }
    51275133    }
    51285134
     
    76287634                {
    76297635                    ctx->nvp->SetWatchingRecording(false);
    76307636                    ctx->nvp->SetLength(filelen);
    7631                     ctx->ChangeState(kState_WatchingPreRecorded);
     7637                    ctx->ChangeState(kState_WatchingPreRecorded, __LINE__);
    76327638                    ScheduleStateChange(ctx);
    76337639                }
    76347640            }
     
    1049610502{
    1049710503    playerLock.lockForWrite();
    1049810504
     10505    //VERBOSE(VB_IMPORTANT, LOC_WARN +
     10506    //        QString("GetPlayerWriteLock(%1,%2,%3) size(%4)")
     10507    //        .arg(which).arg(file).arg(location).arg(player.size()));
     10508
    1049910509    if ((which >= (int)player.size()))
    1050010510    {
    1050110511        VERBOSE(VB_IMPORTANT, LOC_WARN +
     
    1051110521{
    1051210522    playerLock.lockForRead();
    1051310523
     10524    //VERBOSE(VB_IMPORTANT, LOC_WARN +
     10525    //        QString("GetPlayerReadLock(%1,%2,%3) size(%4)")
     10526    //        .arg(which).arg(file).arg(location).arg(player.size()));
     10527
    1051410528    if ((which >= (int)player.size()))
    1051510529    {
    1051610530        VERBOSE(VB_IMPORTANT, LOC_WARN +
     
    1052710541{
    1052810542    playerLock.lockForRead();
    1052910543
     10544    //VERBOSE(VB_IMPORTANT, LOC_WARN +
     10545    //        QString("GetPlayerReadLock(%1,%2,%3) const size(%4)")
     10546    //        .arg(which).arg(file).arg(location).arg(player.size()));
     10547
    1053010548    if ((which >= (int)player.size()))
    1053110549    {
    1053210550        VERBOSE(VB_IMPORTANT, LOC_WARN +
     
    1057410592
    1057510593void TV::ReturnPlayerLock(PlayerContext *&ctx)
    1057610594{
     10595    //VERBOSE(VB_IMPORTANT, LOC_WARN +
     10596    //        QString("ReturnPlayerLock() size(%4)")
     10597    //        .arg(player.size()));
     10598
    1057710599    playerLock.unlock();
    1057810600    ctx = NULL;
    1057910601}
    1058010602
    1058110603void TV::ReturnPlayerLock(const PlayerContext *&ctx) const
    1058210604{
     10605    //VERBOSE(VB_IMPORTANT, LOC_WARN +
     10606    //        QString("ReturnPlayerLock() const size(%4)")
     10607    //        .arg(player.size()));
     10608
    1058310609    playerLock.unlock();
    1058410610    ctx = NULL;
    1058510611}
  • libs/libmythtv/playercontext.h

     
    8888    void LockState(void) const;
    8989    void UnlockState(void) const;
    9090    bool InStateChange(void) const;
    91     void ChangeState(TVState newState);
    92     void ForceNextStateNone(void);
     91    void ChangeState(TVState newState, int line);
     92    void ForceNextStateNone(int line);
    9393    TVState DequeueNextState(void);
    9494    TVState GetState(void) const;
    9595    /// This is set if the player encountered some irrecoverable error.