Backed out changeset 865a9cdfa7b1 (bug 1053682) for bustage ON A CLOSED TREE
authorNigel Babu <nigelbabu@gmail.com>
Fri, 15 Aug 2014 12:34:32 +0530
changeset 199687 094f51ffea60
parent 199686 02b9135f62de
child 199688 a7d98b35305f
push id47708
push usernigelbabu@gmail.com
push dateFri, 15 Aug 2014 07:05:24 +0000
treeherdermozilla-inbound@5b276b3d54dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1053682
milestone34.0a1
backs out865a9cdfa7b1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 865a9cdfa7b1 (bug 1053682) for bustage ON A CLOSED TREE
content/media/mediasource/SourceBufferResource.cpp
content/media/mediasource/SourceBufferResource.h
--- a/content/media/mediasource/SourceBufferResource.cpp
+++ b/content/media/mediasource/SourceBufferResource.cpp
@@ -82,71 +82,62 @@ SourceBufferResource::Read(char* aBuffer
 }
 
 nsresult
 SourceBufferResource::ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes)
 {
   SBR_DEBUG("SourceBufferResource(%p)::ReadAt(aOffset=%lld, aBuffer=%p, aCount=%u, aBytes=%p)",
             this, aOffset, aBytes, aCount, aBytes);
   ReentrantMonitorAutoEnter mon(mMonitor);
-  nsresult rv = SeekInternal(aOffset);
+  nsresult rv = Seek(nsISeekableStream::NS_SEEK_SET, aOffset);
   if (NS_FAILED(rv)) {
     return rv;
   }
   return Read(aBuffer, aCount, aBytes);
 }
 
 nsresult
 SourceBufferResource::Seek(int32_t aWhence, int64_t aOffset)
 {
   SBR_DEBUG("SourceBufferResource(%p)::Seek(aWhence=%d, aOffset=%lld)", this, aWhence, aOffset);
   ReentrantMonitorAutoEnter mon(mMonitor);
+  if (mClosed) {
+    return NS_ERROR_FAILURE;
+  }
 
   int64_t newOffset = mOffset;
   switch (aWhence) {
   case nsISeekableStream::NS_SEEK_END:
     newOffset = GetLength() - aOffset;
     break;
   case nsISeekableStream::NS_SEEK_CUR:
     newOffset += aOffset;
     break;
   case nsISeekableStream::NS_SEEK_SET:
     newOffset = aOffset;
     break;
   }
 
   SBR_DEBUGV("SourceBufferResource(%p)::Seek() newOffset=%lld GetOffset()=%llu GetLength()=%llu)",
              this, newOffset, mInputBuffer.GetOffset(), GetLength());
-  nsresult rv = SeekInternal(newOffset);
-  mon.NotifyAll();
-  return rv;
-}
-
-nsresult
-SourceBufferResource::SeekInternal(int64_t aOffset)
-{
-  mMonitor.AssertCurrentThreadIn();
-
-  if (mClosed ||
-      aOffset < 0 ||
-      uint64_t(aOffset) < mInputBuffer.GetOffset() ||
-      aOffset > GetLength()) {
+  if (newOffset < 0 || uint64_t(newOffset) < mInputBuffer.GetOffset() || newOffset > GetLength()) {
     return NS_ERROR_FAILURE;
   }
 
-  mOffset = aOffset;
+  mOffset = newOffset;
+  mon.NotifyAll();
+
   return NS_OK;
 }
 
 nsresult
 SourceBufferResource::ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount)
 {
   SBR_DEBUG("SourceBufferResource(%p)::ReadFromCache(aBuffer=%p, aOffset=%lld, aCount=%u)",
             this, aBuffer, aOffset, aCount);
-  ReentrantMonitorAutoEnter mon(mMonitor);
   int64_t oldOffset = mOffset;
   nsresult rv = ReadAt(aOffset, aBuffer, aCount, nullptr);
   mOffset = oldOffset;
   return rv;
 }
 
 bool
 SourceBufferResource::EvictData(uint32_t aThreshold)
--- a/content/media/mediasource/SourceBufferResource.h
+++ b/content/media/mediasource/SourceBufferResource.h
@@ -268,18 +268,16 @@ public:
   // Remove data from resource if it holds more than the threshold
   // number of bytes. Returns true if some data was evicted.
   bool EvictData(uint32_t aThreshold);
 
   // Remove data from resource before the given offset.
   void EvictBefore(uint64_t aOffset);
 
 private:
-  nsresult SeekInternal(int64_t aOffset);
-
   nsCOMPtr<nsIPrincipal> mPrincipal;
   const nsCString mType;
 
   // Provides synchronization between SourceBuffers and InputAdapters.
   // Protects all of the member variables below.  Read() will await a
   // Notify() (from Seek, AppendData, Ended, or Close) when insufficient
   // data is available in mData.
   mutable ReentrantMonitor mMonitor;