diff -u -r -p mythtv.102/libs/libmythtv/fileringbuffer.cpp mythtv/libs/libmythtv/fileringbuffer.cpp
|
old
|
new
|
bool FileRingBuffer::OpenFile(const QStr
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | | setswitchtonext = false; |
| 353 | 352 | ateof = false; |
| 354 | 353 | commserror = false; |
| 355 | 354 | numfailures = 0; |
diff -u -r -p mythtv.102/libs/libmythtv/mythplayer.cpp mythtv/libs/libmythtv/mythplayer.cpp
|
old
|
new
|
void MythPlayer::SwitchToProgram(void)
|
| 2271 | 2271 | |
| 2272 | 2272 | bool newIsDummy = player_ctx->tvchain->GetCardType(newid) == "DUMMY"; |
| 2273 | 2273 | |
| | 2274 | if (!newIsDummy) |
| | 2275 | { |
| | 2276 | player_ctx->buffer->OpenFile( |
| | 2277 | pginfo->GetPlaybackURL(), RingBuffer::kDefaultOpenTimeout); |
| | 2278 | } |
| 2274 | 2279 | SetPlayingInfo(*pginfo); |
| 2275 | 2280 | Pause(); |
| 2276 | 2281 | ChangeSpeed(); |
| … |
… |
void MythPlayer::SwitchToProgram(void)
|
| 2284 | 2289 | return; |
| 2285 | 2290 | } |
| 2286 | 2291 | |
| 2287 | | player_ctx->buffer->OpenFile( |
| 2288 | | pginfo->GetPlaybackURL(), RingBuffer::kDefaultOpenTimeout); |
| 2289 | | |
| 2290 | 2292 | if (!player_ctx->buffer->IsOpen()) |
| 2291 | 2293 | { |
| 2292 | 2294 | VERBOSE(VB_IMPORTANT, LOC_ERR + "SwitchToProgram's OpenFile failed " + |
diff -u -r -p mythtv.102/libs/libmythtv/ringbuffer.cpp mythtv/libs/libmythtv/ringbuffer.cpp
|
old
|
new
|
void RingBuffer::ResetReadAhead(long lon
|
| 450 | 450 | internalreadpos = newinternal; |
| 451 | 451 | ateof = false; |
| 452 | 452 | readsallowed = false; |
| 453 | | setswitchtonext = false; |
| 454 | 453 | generalWait.wakeAll(); |
| 455 | 454 | |
| 456 | 455 | rbwlock.unlock(); |
| … |
… |
void RingBuffer::run(void)
|
| 698 | 697 | |
| 699 | 698 | // These are conditions where we want to sleep to allow |
| 700 | 699 | // other threads to do stuff. |
| 701 | | if (setswitchtonext || (ateof && readsallowed)) |
| | 700 | if (ateof && readsallowed) |
| 702 | 701 | { |
| 703 | 702 | ignore_for_read_timing = true; |
| 704 | 703 | generalWait.wait(&rwlock, 1000); |
| … |
… |
void RingBuffer::run(void)
|
| 706 | 705 | } |
| 707 | 706 | |
| 708 | 707 | int read_return = -1; |
| 709 | | if (totfree >= readblocksize && !commserror && |
| 710 | | !ateof && !setswitchtonext) |
| | 708 | if (totfree >= readblocksize && !commserror && !ateof) |
| 711 | 709 | { |
| 712 | 710 | // limit the read size |
| 713 | 711 | totfree = readblocksize; |
| … |
… |
void RingBuffer::run(void)
|
| 842 | 840 | |
| 843 | 841 | VERBOSE(VB_FILE|VB_EXTRA, LOC + "@ end of read ahead loop"); |
| 844 | 842 | |
| 845 | | if (readsallowed || commserror || ateof || setswitchtonext || |
| | 843 | if (readsallowed || commserror || ateof || |
| 846 | 844 | (wanttoread <= used && wanttoread > 0)) |
| 847 | 845 | { |
| 848 | 846 | // To give other threads a good chance to handle these |
| … |
… |
void RingBuffer::run(void)
|
| 851 | 849 | generalWait.wakeAll(); |
| 852 | 850 | rwlock.unlock(); |
| 853 | 851 | usleep(5 * 1000); |
| 854 | | rwlock.lockForRead(); |
| | 852 | rwlock.lockForRead(); |
| 855 | 853 | } |
| 856 | 854 | else |
| 857 | 855 | { |
| 858 | 856 | // yield if we have nothing to do... |
| 859 | 857 | if (!request_pause && |
| 860 | | (used >= fill_threshold || ateof || setswitchtonext)) |
| | 858 | (used >= fill_threshold || ateof)) |
| 861 | 859 | { |
| 862 | 860 | generalWait.wait(&rwlock, 1000); |
| 863 | 861 | } |
| … |
… |
bool RingBuffer::WaitForAvail(int count)
|
| 945 | 943 | generalWait.wait(&rwlock, 250); |
| 946 | 944 | avail = ReadBufAvail(); |
| 947 | 945 | |
| 948 | | if ((ateof || setswitchtonext) && avail < count) |
| | 946 | if (ateof && avail < count) |
| 949 | 947 | count = avail; |
| 950 | 948 | |
| 951 | 949 | if (avail < count) |
| … |
… |
bool RingBuffer::WaitForAvail(int count)
|
| 972 | 970 | } |
| 973 | 971 | } |
| 974 | 972 | |
| 975 | | bool quit = livetvchain && (livetvchain->NeedsToSwitch() || |
| 976 | | livetvchain->NeedsToJump() || |
| 977 | | setswitchtonext); |
| 978 | | |
| 979 | | if (elapsed > 16000 || quit) |
| | 973 | if (elapsed > 16000) |
| 980 | 974 | { |
| 981 | | if (!quit) |
| 982 | | VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " + |
| | 975 | VERBOSE(VB_IMPORTANT, LOC_ERR + "Waited " + |
| 983 | 976 | QString("%1").arg(elapsed/1000) + |
| 984 | 977 | " seconds for data, aborting."); |
| 985 | | else |
| 986 | | VERBOSE(VB_IMPORTANT, LOC + "Timing out wait due to " |
| 987 | | "impending livetv switch."); |
| 988 | | |
| 989 | 978 | return false; |
| 990 | 979 | } |
| 991 | 980 | } |