Ticket #743: find-correct-pat-in-400ms-v3.diff
File find-correct-pat-in-400ms-v3.diff, 3.2 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/mpeg/mpegstreamdata.cpp
old new 24 24 _cached_pat(NULL), _desired_program(desiredProgram), 25 25 _pmt_single_program_num_video(1), 26 26 _pmt_single_program_num_audio(0), 27 _pat_single_program(NULL), _pmt_single_program(NULL) 27 _pat_single_program(NULL), _pmt_single_program(NULL), 28 _invalid_pat_seen(false) 28 29 { 29 30 AddListeningPID(MPEG_PAT_PID); 30 31 … … 46 47 void MPEGStreamData::Reset(int desiredProgram) 47 48 { 48 49 _desired_program = desiredProgram; 50 _invalid_pat_seen = false; 49 51 50 52 SetPATSingleProgram(0); 51 53 SetPMTSingleProgram(0); … … 406 408 407 409 void MPEGStreamData::ProcessPAT(const ProgramAssociationTable *pat) 408 410 { 409 emit UpdatePAT(pat); 410 if ((_desired_program >= 0) && CreatePATSingleProgram(*pat)) 411 emit UpdatePATSingleProgram(PATSingleProgram()); 411 bool foundProgram = pat->FindPID(_desired_program); 412 413 if (_desired_program < 0) 414 emit UpdatePAT(pat); 415 if (_desired_program >= 0) 416 { 417 if (!_invalid_pat_seen && !foundProgram) 418 { 419 _invalid_pat_seen = true; 420 _invalid_pat_timer.start(); 421 VERBOSE(VB_IMPORTANT, "ProcesPAT -> PAT is missing program, setting timeout"); 422 } 423 else if (_invalid_pat_seen && (_invalid_pat_timer.elapsed() > 400)) 424 { 425 // After 400ms emit error if we haven't found correct PAT. 426 VERBOSE(VB_IMPORTANT, "Program not found in PAT. Rescan your transports."); 427 // This will trigger debug PAT print 428 emit UpdatePAT(pat); 429 if (CreatePATSingleProgram(*pat)) 430 emit UpdatePATSingleProgram(PATSingleProgram()); 431 _invalid_pat_seen = false; 432 } 433 else if (foundProgram) 434 { 435 if (_invalid_pat_seen) 436 { 437 _invalid_pat_seen = false; 438 VERBOSE(VB_IMPORTANT, "ProcesPAT -> PAT updated"); 439 } 440 emit UpdatePAT(pat); 441 if (CreatePATSingleProgram(*pat)) 442 emit UpdatePATSingleProgram(PATSingleProgram()); 443 } 444 } 412 445 } 413 446 414 447 void MPEGStreamData::ProcessPMT(const uint pid, const ProgramMapTable *pmt) -
libs/libmythtv/mpeg/mpegstreamdata.h
old new 8 8 9 9 #include <qmap.h> 10 10 #include "tspacket.h" 11 #include "util.h" 11 12 12 13 class ProgramAssociationTable; 13 14 class ProgramMapTable; … … 179 180 uint _pmt_single_program_num_audio; 180 181 ProgramAssociationTable *_pat_single_program; 181 182 ProgramMapTable *_pmt_single_program; 183 184 // PAT Timeout handling. 185 private: 186 bool _invalid_pat_seen; 187 MythTimer _invalid_pat_timer; 182 188 }; 183 189 184 190 #include "mpegtables.h"