Ticket #892: eitratelimit_#892_8612.patch
File eitratelimit_#892_8612.patch, 5.4 KB (added by , 20 years ago) |
---|
-
libs/libmythtv/eithelper.h
20 20 { 21 21 Q_OBJECT 22 22 public: 23 EITHelper() : QObject(NULL, "EITHelper") { ; } 23 EITHelper() : QObject(NULL, "EITHelper") 24 { 25 events_full = false; 26 } 24 27 25 28 void ClearList(void); 26 29 uint GetListSize(void) const; … … 28 31 29 32 public slots: 30 33 void HandleEITs(QMap_Events* events); 34 signals: 35 void StopParsing(bool); 31 36 32 37 private: 33 38 int GetChanID(int tid_db, const Event &event) const; … … 39 44 40 45 /// Maximum number of DB inserts per ProcessEvents call. 41 46 static const uint kChunkSize; 47 48 // Max event list size before we stop parsing incoming events 49 // allowing us to try and catchup. 50 static const uint kMAXChunkSize; 51 52 bool events_full; 42 53 }; 43 54 44 55 #endif // USING_DVB -
libs/libmythtv/siparser.cpp
64 64 ParserInReset(false), standardChange(false), 65 65 PrivateTypesLoaded(false) 66 66 { 67 events_full = false; 68 67 69 /* Set the PrivateTypes to default values */ 68 70 PrivateTypes.reset(); 69 71 … … 515 517 (void) pid; 516 518 #endif 517 519 520 if (events_full) 521 { 522 pmap_lock.unlock(); 523 return; 524 } 525 518 526 if (!(buffer[1] & 0x80)) 519 527 { 520 528 VERBOSE(VB_SIPARSER, LOC + -
libs/libmythtv/eithelper.cpp
4 4 #include "eithelper.h" 5 5 #include "mythdbcon.h" 6 6 7 8 // TODO: Should these be configurable values based on how much ram a 9 // backend has available? 7 10 const uint EITHelper::kChunkSize = 20; 11 const uint EITHelper::kMAXChunkSize = 2000; 8 12 9 13 static int get_chan_id_from_db(int tid_db, const Event&); 10 14 static uint update_eit_in_db(MSqlQuery&, MSqlQuery&, int, const Event&); … … 75 79 if (!eitList.size()) 76 80 return 0; 77 81 82 //VERBOSE(VB_EIT,QString("EITHelper::ProcessEvents: Events: %1/%2") 83 // .arg(eitList.size()).arg(eitList.front()->size())); 84 78 85 uint insertCount = 0; 79 if (eitList.front()->size() <= kChunkSize) 86 87 QList_Events subset; 88 while (subset.size() < kChunkSize && eitList.size()) 80 89 { 81 90 QList_Events *events = eitList.front(); 82 eitList.pop_front(); 91 while (subset.size() < kChunkSize && events->size()) 92 { 93 subset.push_back(events->front()); 94 events->pop_front(); 95 } 96 if (! events->size()) 97 { 98 eitList.pop_front(); 99 delete events; 100 } 101 } 83 102 84 85 insertCount += UpdateEITList(mplexid, *events);86 QList_Events::iterator it = events->begin();87 for (; it != events->end(); ++it)88 89 delete events;90 eitList_lock.lock(); 91 }92 else103 eitList_lock.unlock(); 104 insertCount += UpdateEITList(mplexid, subset); 105 QList_Events::iterator it = subset.begin(); 106 for (; it != subset.end(); ++it) 107 delete *it; 108 eitList_lock.lock(); 109 110 if (((eitList.size() <= kChunkSize) && events_full) 111 || ((eitList.size() > kMAXChunkSize) && !events_full)) 93 112 { 94 QList_Events *events = eitList.front(); 95 QList_Events subset; 113 int size = eitList.size(); 114 VERBOSE(VB_GENERAL, QString ("EITHelper: ToggleParsing EIT (%1)") 115 .arg(size)); 96 116 97 QList_Events::iterator subset_end = events->begin(); 98 for (uint i = 0; i < kChunkSize; ++i) ++subset_end; 99 subset.insert(subset.end(), events->begin(), subset_end); 100 events->erase(events->begin(), subset_end); 101 117 events_full = (size > kMAXChunkSize); 118 102 119 eitList_lock.unlock(); 103 insertCount += UpdateEITList(mplexid, subset); 104 QList_Events::iterator it = subset.begin(); 105 for (; it != subset.end(); ++it) 106 delete *it; 120 emit(StopParsing(events_full)); 107 121 eitList_lock.lock(); 108 122 } 109 123 -
libs/libmythtv/eitscanner.cpp
176 176 eitHelper, SLOT(HandleEITs(QMap_Events*))); 177 177 connect(channel, SIGNAL(UpdatePMTObject(const PMTObject *)), 178 178 this, SLOT(SetPMTObject(const PMTObject *))); 179 connect(eitHelper, SIGNAL(StopParsing(bool)), 180 parser, SLOT(StopParsing(bool))); 179 181 } 180 182 181 183 /** \fn EITScanner::StopPassiveScan(void) -
libs/libmythtv/siparser.h
111 111 112 112 public slots: 113 113 virtual void deleteLater(void); 114 void StopParsing(bool stop) 115 { pmap_lock.lock(); events_full = stop; pmap_lock.unlock(); } 114 116 115 117 signals: 116 118 void FindTransportsComplete(void); … … 279 281 // statistics 280 282 QMap<uint,uint> descCount; 281 283 mutable QMutex descLock; 284 285 bool events_full; 282 286 }; 283 287 284 288 #endif // SIPARSER_H