Ticket #1564: pnum_lock.patch
File pnum_lock.patch, 5.1 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/siparser.cpp
57 57 atsc_stream_data(NULL), dvb_stream_data(NULL), 58 58 // Mutex Locks 59 59 pmap_lock(false), 60 pnum_lock(false), 60 61 // State variables 61 62 ThreadRunning(false), exitParserThread(false), 62 63 standardChange(false), … … 172 173 // for MPEG PAT 173 174 AddPid(MPEG_PAT_PID, 0xFF, TableID::PAT, true, 10 /*bufferFactor*/); 174 175 // for MPEG PMT 175 if (!pnum_pid.empty())176 176 { 177 uint pnum = 0xFFFFFFFF; 178 if (SI_STANDARD_ATSC == table_standard) 179 pnum = atsc_stream_data->DesiredProgram(); 180 if (SI_STANDARD_DVB == table_standard) 181 pnum = dvb_stream_data->DesiredProgram(); 177 QMutexLocker lock (&pnum_lock); 178 if (!pnum_pid.empty()) 179 { 180 uint pnum = 0xFFFFFFFF; 181 if (SI_STANDARD_ATSC == table_standard) 182 pnum = atsc_stream_data->DesiredProgram(); 183 if (SI_STANDARD_DVB == table_standard) 184 pnum = dvb_stream_data->DesiredProgram(); 182 185 183 pnum_pid_map_t::const_iterator it = pnum_pid.begin(); 184 for (; it != pnum_pid.end(); ++it) 185 { 186 if (it.key() == pnum) 187 AddPid(*it, 0xFF, TableID::PMT, true, 10 /*bufferFactor*/); 186 pnum_pid_map_t::const_iterator it = pnum_pid.begin(); 187 for (; it != pnum_pid.end(); ++it) 188 { 189 if (it.key() == pnum) 190 AddPid(*it, 0xFF, TableID::PMT, true, 10 /*bufferFactor*/); 191 } 192 //pnum_pid.clear(); 188 193 } 189 //pnum_pid.clear();190 194 } 191 195 // for DVB NIT 192 196 if (SI_STANDARD_DVB == table_standard && need_nit) … … 688 692 .arg(pat->Version()).arg(pat->TransportStreamID())); 689 693 690 694 PrivateTypes.CurrentTransportID = pat->TransportStreamID(); 691 pnum_pid.clear();692 for (uint i = 0; i < pat->ProgramCount(); ++i)693 695 { 694 // DVB Program 0 in the PAT represents the location of the NIT 695 if (0 == pat->ProgramNumber(i) && SI_STANDARD_ATSC != table_standard) 696 QMutexLocker lock(&pnum_lock); 697 pnum_pid.clear(); 698 for (uint i = 0; i < pat->ProgramCount(); ++i) 696 699 { 697 VERBOSE(VB_SIPARSER, LOC + "NIT Present on this transport " + 698 QString(" on PID 0x%1").arg(NITPID,0,16)); 700 // DVB Program 0 in the PAT represents the location of the NIT 701 if (0 == pat->ProgramNumber(i) && SI_STANDARD_ATSC != table_standard) 702 { 703 VERBOSE(VB_SIPARSER, LOC + "NIT Present on this transport " + 704 QString(" on PID 0x%1").arg(NITPID,0,16)); 699 705 700 NITPID = pat->ProgramPID(i); 701 continue; 706 NITPID = pat->ProgramPID(i); 707 continue; 708 } 709 710 pnum_pid[pat->ProgramNumber(i)] = pat->ProgramPID(i); 702 711 } 703 704 pnum_pid[pat->ProgramNumber(i)] = pat->ProgramPID(i);705 712 } 706 713 } 707 714 … … 728 735 // to retune to correct transport or send an error tuning the channel 729 736 void SIParser::HandlePMT(uint pnum, const ProgramMapTable *pmt) 730 737 { 731 VERBOSE(VB_SIPARSER, LOC + QString( 732 "PMT pn(%1) version(%2) cnt(%3) pid(0x%4)") 733 .arg(pnum).arg(pmt->Version()).arg(pmt->StreamCount()) 734 .arg(pnum_pid[pmt->ProgramNumber()],0,16)); 738 { 739 QMutexLocker lock(&pnum_lock); 740 VERBOSE(VB_SIPARSER, LOC + QString( 741 "PMT pn(%1) version(%2) cnt(%3) pid(0x%4)") 742 .arg(pnum).arg(pmt->Version()).arg(pmt->StreamCount()) 743 .arg(pnum_pid[pmt->ProgramNumber()],0,16)); 735 744 736 if (SI_STANDARD_ATSC == table_standard) 737 { 738 if ((int)pmt->ProgramNumber() == atsc_stream_data->DesiredProgram()) 739 emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt); 745 if (SI_STANDARD_ATSC == table_standard) 746 { 747 if ((int)pmt->ProgramNumber() == atsc_stream_data->DesiredProgram()) 748 emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt); 749 } 750 if (SI_STANDARD_DVB == table_standard) 751 { 752 if ((int)pmt->ProgramNumber() == dvb_stream_data->DesiredProgram()) 753 emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt); 754 } 740 755 } 741 if (SI_STANDARD_DVB == table_standard)742 {743 if ((int)pmt->ProgramNumber() == dvb_stream_data->DesiredProgram())744 emit UpdatePMT(pnum_pid[pmt->ProgramNumber()], pmt);745 }746 756 } 747 757 748 758 /*------------------------------------------------------------------------ -
libs/libmythtv/siparser.h
219 219 // Mutex Locks 220 220 // TODO: Lock Events, and Services, Transports, etc 221 221 QMutex pmap_lock; 222 QMutex pnum_lock; 222 223 pnum_pid_map_t pnum_pid; 223 224 dvb_srv_eit_on_t dvb_srv_collect_eit; 224 225 atsc_eit_pid_map_t atsc_eit_pid;