Bug 1313497 - Use InvokeAsync with Storages in TrackBuffersManager - r=jya
authorGerald Squelart <gsquelart@mozilla.com>
Sun, 13 Nov 2016 16:37:24 +1100
changeset 324380 2125fc90d9bcadbb1dc2f07ac34dc9017b9be650
parent 324379 23b59e8e7f71081cb92ae77d5a027af3f22df909
child 324381 40e0fe1aa9d92fab23ecc16ce13cbda452367c49
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjya
bugs1313497
milestone53.0a1
Bug 1313497 - Use InvokeAsync with Storages in TrackBuffersManager - r=jya MozReview-Commit-ID: IkpuSyFgPbP
dom/media/mediasource/TrackBuffersManager.cpp
dom/media/mediasource/TrackBuffersManager.h
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -116,26 +116,24 @@ RefPtr<TrackBuffersManager::AppendPromis
 TrackBuffersManager::AppendData(MediaByteBuffer* aData,
                                 const SourceBufferAttributes& aAttributes)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MSE_DEBUG("Appending %lld bytes", aData->Length());
 
   mEnded = false;
 
-  RefPtr<MediaByteBuffer> buffer = aData;
-
-  return InvokeAsync(GetTaskQueue(), this,
-                     __func__, &TrackBuffersManager::DoAppendData,
-                     buffer, aAttributes);
+  return InvokeAsync<RefPtr<MediaByteBuffer>, SourceBufferAttributes&&>(
+           GetTaskQueue(), this, __func__,
+           &TrackBuffersManager::DoAppendData, aData, aAttributes);
 }
 
 RefPtr<TrackBuffersManager::AppendPromise>
-TrackBuffersManager::DoAppendData(RefPtr<MediaByteBuffer> aData,
-                                  SourceBufferAttributes aAttributes)
+TrackBuffersManager::DoAppendData(MediaByteBuffer* aData,
+                                  const SourceBufferAttributes& aAttributes)
 {
   RefPtr<AppendBufferTask> task = new AppendBufferTask(aData, aAttributes);
   RefPtr<AppendPromise> p = task->mPromise.Ensure(__func__);
   QueueTask(task);
 
   return p;
 }
 
--- a/dom/media/mediasource/TrackBuffersManager.h
+++ b/dom/media/mediasource/TrackBuffersManager.h
@@ -168,18 +168,18 @@ public:
 
 private:
   typedef MozPromise<bool, MediaResult, /* IsExclusive = */ true> CodedFrameProcessingPromise;
 
   // for MediaSourceDemuxer::GetMozDebugReaderData
   friend class MediaSourceDemuxer;
   ~TrackBuffersManager();
   // All following functions run on the taskqueue.
-  RefPtr<AppendPromise> DoAppendData(RefPtr<MediaByteBuffer> aData,
-                                     SourceBufferAttributes aAttributes);
+  RefPtr<AppendPromise> DoAppendData(MediaByteBuffer* aData,
+                                     const SourceBufferAttributes& aAttributes);
   void ScheduleSegmentParserLoop();
   void SegmentParserLoop();
   void InitializationSegmentReceived();
   void ShutdownDemuxers();
   void CreateDemuxerforMIMEType();
   void ResetDemuxingState();
   void NeedMoreData();
   void RejectAppend(const MediaResult& aRejectValue, const char* aName);