jyavenard

Untitled

May 3rd, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
  2. index 7a5f744..0062c42 100644
  3. --- a/mythtv/libs/libmythtv/ringbuffer.cpp
  4. +++ b/mythtv/libs/libmythtv/ringbuffer.cpp
  5. @@ -504,15 +504,15 @@ long long RingBuffer::Seek(long long pos, int whence, bool has_lock)
  6. ((SEEK_CUR==whence)?"SEEK_CUR":"SEEK_END"))
  7. .arg(has_lock?"locked":"unlocked"));
  8.  
  9. - if (!has_lock)
  10. - {
  11. - rwlock.lockForWrite();
  12. - }
  13. -
  14. long long ret;
  15.  
  16. - if (readInternalMode)
  17. + if (readInternalMode) // reading readInternal is atomic, so no need for locking
  18. {
  19. + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("internal readmode active"));
  20. + if (!has_lock)
  21. + {
  22. + rwlock.lockForWrite();
  23. + }
  24. poslock.lockForWrite();
  25. // only valid for SEEK_SET & SEEK_CUR
  26. switch (whence)
  27. @@ -533,6 +533,19 @@ long long RingBuffer::Seek(long long pos, int whence, bool has_lock)
  28. }
  29. else
  30. {
  31. + LOG(VB_PLAYBACK, LOG_ERR, LOC + QString("internal readmode inactive"));
  32. + if (dynamic_cast<FileRingBuffer*>(this))
  33. + {
  34. + StopReads();
  35. + }
  36. + if (!has_lock)
  37. + {
  38. + rwlock.lockForWrite();
  39. + }
  40. + if (dynamic_cast<FileRingBuffer*>(this))
  41. + {
  42. + StartReads();
  43. + }
  44. ret = SeekInternal(pos, whence);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment