From e563c2ecc48a677c1e985281c6c100bbbcdb6b9f Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 17 Apr 2011 17:36:48 +0000 Subject: [PATCH] sectionsd: simplify DMX::getSection code git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1408 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/sectionsd/dmx.cpp | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/sectionsd/dmx.cpp b/src/sectionsd/dmx.cpp index 56b7ac5ca..c35940dc9 100644 --- a/src/sectionsd/dmx.cpp +++ b/src/sectionsd/dmx.cpp @@ -384,13 +384,14 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts) return rc; } + // the current section + sections_id_t s_id = create_sections_id(initial_header->table_id, + eh_tbl_extension_id, + extended_header->section_number, + current_onid, + current_tsid); //find current section in list - MyDMXOrderUniqueKey::iterator di = myDMXOrderUniqueKey.find(create_sections_id( - initial_header->table_id, - eh_tbl_extension_id, - extended_header->section_number, - current_onid, - current_tsid)); + MyDMXOrderUniqueKey::iterator di = myDMXOrderUniqueKey.find(s_id); if (di != myDMXOrderUniqueKey.end()) { //the current section was read before @@ -404,22 +405,12 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts) //the version number is still up2date if (first_skipped == 0) { //the last section was new - this is the 1st dup - first_skipped = create_sections_id( - initial_header->table_id, - eh_tbl_extension_id, - extended_header->section_number, - current_onid, - current_tsid); + first_skipped = s_id; } else { //this is not the 1st new - check if it's the last //or to be more precise only dups occured since - if (first_skipped == create_sections_id( - initial_header->table_id, - eh_tbl_extension_id, - extended_header->section_number, - current_onid, - current_tsid)) + if (first_skipped == s_id) timeouts = -1; } //since version is still up2date, check if table complete @@ -453,13 +444,7 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts) extended_header->section_number); #endif //section was not read before - insert in list - myDMXOrderUniqueKey.insert(std::make_pair(create_sections_id( - initial_header->table_id, - eh_tbl_extension_id, - extended_header->section_number, - current_onid, - current_tsid), - extended_header->version_number)); + myDMXOrderUniqueKey.insert(std::make_pair(s_id, extended_header->version_number)); //check if table is now complete if (check_complete(initial_header->table_id, eh_tbl_extension_id,