Ticket #3786: mythtv_tsreset.2.patch
File mythtv_tsreset.2.patch, 7.0 KB (added by , 17 years ago) |
---|
-
libs/libmyth/remotefile.h
22 22 23 23 int Read(void *data, int size); 24 24 void Reset(void); 25 int GetStarvedCount() const { return starvedCount; }; 25 26 26 27 bool SaveAs(QByteArray &data); 27 28 … … 47 48 bool timeoutisfast; 48 49 long long readposition; 49 50 int recordernum; 51 int starvedCount; 50 52 51 53 mutable QMutex lock; 52 54 MythSocket *controlSock; -
libs/libmyth/remotefile.cpp
224 224 strlist << QString::number(size); 225 225 controlSock->writeStringList(strlist); 226 226 227 starvedCount = 0; 227 228 sent = size; 228 229 229 230 while (recv < sent && !error && zerocnt++ < 50) … … 235 236 { 236 237 recv += ret; 237 238 } 239 else if (ret == 0) 240 { 241 starvedCount++; 242 } 238 243 else if (sock->error() != MythSocket::NoError) 239 244 { 240 245 VERBOSE(VB_IMPORTANT, "RemoteFile::Read(): socket error"); -
libs/libmythtv/RingBuffer.h
57 57 bool toAdjust = false, 58 58 bool resetInternal = false); 59 59 60 int GetStarvedCount() const { return starvedCount; } 61 60 62 // Seeks 61 63 long long Seek(long long pos, int whence); 62 64 … … 172 174 LiveTVChain *livetvchain; 173 175 bool ignoreliveeof; 174 176 177 int starvedCount; 178 175 179 long long readAdjust; 176 180 177 181 /// Condition to signal that the read ahead thread is running -
libs/libmythtv/RingBuffer.cpp
100 100 numfailures(0), commserror(false), 101 101 dvdPriv(NULL), oldfile(false), 102 102 livetvchain(NULL), ignoreliveeof(false), 103 starvedCount(0), 103 104 readAdjust(0) 104 105 { 105 106 pthread_rwlock_init(&rwlock, NULL); … … 396 397 unsigned errcnt = 0; 397 398 unsigned zerocnt = 0; 398 399 400 if (!readaheadrunning) 401 starvedCount = 0; 402 399 403 if (fd < 0) 400 404 { 401 405 VERBOSE(VB_IMPORTANT, LOC_ERR + … … 446 450 if (tot < sz) 447 451 usleep(60000); 448 452 } 453 if (!readaheadrunning) 454 starvedCount = zerocnt; 455 449 456 return tot; 450 457 } 451 458 … … 461 468 { 462 469 int ret = 0; 463 470 471 if (!readaheadrunning) 472 starvedCount = 0; 473 464 474 ret = rf->Read(data, sz); 465 475 if (ret < 0) 466 476 { … … 471 481 ret = 0; 472 482 numfailures++; 473 483 } 484 if (!readaheadrunning) 485 starvedCount = rf->GetStarvedCount(); 474 486 475 487 return ret; 476 488 } … … 935 947 bool readone = false; 936 948 int readErr = 0; 937 949 950 starvedCount = 0; 951 938 952 if (readaheadpaused && stopreads) 939 953 { 940 954 readone = true; … … 1021 1035 availWaitMutex.unlock(); 1022 1036 return 0; 1023 1037 } 1038 starvedCount++; 1024 1039 } 1025 1040 1026 1041 wanttoread = 0; -
libs/libmythtv/decoderbase.h
123 123 bool GetWaitForChange(void); 124 124 void SetReadAdjust(long long adjust); 125 125 126 int GetStarvedCount() const { return starvedCount; } 127 126 128 // DVD public stuff 127 129 void ChangeDVDTrack(bool ffw); 128 130 long long DVDFindPosition(long long desiredFrame); … … 213 215 bool getrawframes; 214 216 bool getrawvideo; 215 217 218 int starvedCount; 219 216 220 bool errored; 217 221 218 222 bool waitingForChange; -
libs/libmythtv/decoderbase.cpp
39 39 40 40 hasKeyFrameAdjustTable(false), lowbuffers(false), 41 41 getrawframes(false), getrawvideo(false), 42 starvedCount(0), 42 43 errored(false), waitingForChange(false), readAdjust(0), 43 44 justAfterChange(false), 44 45 // language preference -
libs/libmythtv/avformatdecoder.cpp
2835 2835 delete pkt; 2836 2836 return false; 2837 2837 } 2838 starvedCount = avfRingBuffer->GetRingBuffer()->GetStarvedCount(); 2839 #if 1 2840 // for debugging 2841 if (starvedCount > 0) 2842 { 2843 VERBOSE(VB_PLAYBACK, LOC_ERR + QString("AVF Starved %1").arg(starvedCount)); 2844 } 2845 #endif 2838 2846 2839 2847 if (waitingForChange && pkt->pos >= readAdjust) 2840 2848 FileChanged(); -
libs/libmythtv/nuppeldecoder.cpp
988 988 int seeklen = 0; 989 989 990 990 decoded_video_frame = NULL; 991 starvedCount = 0; 991 992 992 993 while (!gotvideo) 993 994 { … … 1005 1006 return false; 1006 1007 } 1007 1008 1009 starvedCount += ringBuffer->GetStarvedCount(); 1008 1010 1009 1011 if (!ringBuffer->LiveMode() && 1010 1012 ((frameheader.frametype == 'Q') || (frameheader.frametype == 'K'))) … … 1031 1033 GetNVP()->SetEof(); 1032 1034 return false; 1033 1035 } 1036 starvedCount += ringBuffer->GetStarvedCount(); 1034 1037 seeklen = 1; 1035 1038 } 1036 1039 … … 1046 1049 GetNVP()->SetEof(); 1047 1050 return false; 1048 1051 } 1052 starvedCount += ringBuffer->GetStarvedCount(); 1049 1053 1050 1054 delete [] dummy; 1051 1055 continue; … … 1115 1119 GetNVP()->SetEof(); 1116 1120 return false; 1117 1121 } 1122 starvedCount += ringBuffer->GetStarvedCount(); 1118 1123 } 1119 1124 else 1120 1125 continue; -
libs/libmythtv/NuppelVideoPlayer.cpp
1265 1265 CheckPrebuffering(); 1266 1266 1267 1267 if ((play_speed > 1.01f) && (audio_stretchfactor > 1.01f) && 1268 livetv && IsNearEnd()) 1268 (livetv || (watchingrecording && nvr_enc && nvr_enc->IsValidRecorder())) 1269 && (IsNearEnd() || GetDecoder()->GetStarvedCount()>0)) 1269 1270 { 1270 1271 VERBOSE(VB_PLAYBACK, LOC + "Near end, Slowing down playback."); 1271 1272 Play(1.0f, true, true);