Bug 1273397. Part 1 - rename some functions to be consistent with other MediaDataDecoder sub-classes. r=jya. draft 1273405_VorbisDataDecoder_Flush
authorJW Wang <jwwang@mozilla.com>
Fri, 20 May 2016 15:48:09 +0800
branch1273405_VorbisDataDecoder_Flush
changeset 370010 faeb512c425aea098dbf2a4c5e4fe571ec66f4e0
parent 370009 c4c918c98ed9acfdef410d5ad5ecd0c0008eb0f4
child 370011 b5f185ab7e2ebd5b9ecb784306fa1be6ff7fcbdc
push id18977
push userjwwang@mozilla.com
push dateTue, 24 May 2016 03:49:46 +0000
reviewersjya
bugs1273397
milestone49.0a1
Bug 1273397. Part 1 - rename some functions to be consistent with other MediaDataDecoder sub-classes. r=jya. MozReview-Commit-ID: 27yUz02gs4n
dom/media/platforms/agnostic/VPXDecoder.cpp
dom/media/platforms/agnostic/VPXDecoder.h
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp
+++ b/dom/media/platforms/agnostic/VPXDecoder.cpp
@@ -85,17 +85,17 @@ VPXDecoder::Init()
 nsresult
 VPXDecoder::Flush()
 {
   mTaskQueue->Flush();
   return NS_OK;
 }
 
 int
-VPXDecoder::DoDecodeFrame(MediaRawData* aSample)
+VPXDecoder::DoDecode(MediaRawData* aSample)
 {
 #if defined(DEBUG)
   vpx_codec_stream_info_t si;
   PodZero(&si);
   si.sz = sizeof(si);
   if (mCodec == Codec::VP8) {
     vpx_codec_peek_stream_info(vpx_codec_vp8_dx(), aSample->Data(), aSample->Size(), &si);
   } else if (mCodec == Codec::VP9) {
@@ -169,45 +169,44 @@ VPXDecoder::DoDecodeFrame(MediaRawData* 
       return -1;
     }
     mCallback->Output(v);
   }
   return 0;
 }
 
 void
-VPXDecoder::DecodeFrame(MediaRawData* aSample)
+VPXDecoder::ProcessDecode(MediaRawData* aSample)
 {
-  if (DoDecodeFrame(aSample) == -1) {
+  if (DoDecode(aSample) == -1) {
     mCallback->Error();
   } else if (mTaskQueue->IsEmpty()) {
     mCallback->InputExhausted();
   }
 }
 
 nsresult
 VPXDecoder::Input(MediaRawData* aSample)
 {
   mTaskQueue->Dispatch(NewRunnableMethod<RefPtr<MediaRawData>>(
-                         this, &VPXDecoder::DecodeFrame,
-                         RefPtr<MediaRawData>(aSample)));
+                       this, &VPXDecoder::ProcessDecode, aSample));
 
   return NS_OK;
 }
 
 void
-VPXDecoder::DoDrain()
+VPXDecoder::ProcessDrain()
 {
   mCallback->DrainComplete();
 }
 
 nsresult
 VPXDecoder::Drain()
 {
-  mTaskQueue->Dispatch(NewRunnableMethod(this, &VPXDecoder::DoDrain));
+  mTaskQueue->Dispatch(NewRunnableMethod(this, &VPXDecoder::ProcessDrain));
 
   return NS_OK;
 }
 
 /* static */
 bool
 VPXDecoder::IsVPX(const nsACString& aMimeType, uint8_t aCodecMask)
 {
--- a/dom/media/platforms/agnostic/VPXDecoder.h
+++ b/dom/media/platforms/agnostic/VPXDecoder.h
@@ -11,17 +11,17 @@
 #include <stdint.h>
 #define VPX_DONT_DEFINE_STDINT_TYPES
 #include "vpx/vp8dx.h"
 #include "vpx/vpx_codec.h"
 #include "vpx/vpx_decoder.h"
 
 namespace mozilla {
 
-  using namespace layers;
+using namespace layers;
 
 class VPXDecoder : public MediaDataDecoder
 {
 public:
   VPXDecoder(const VideoInfo& aConfig,
              ImageContainer* aImageContainer,
              FlushableTaskQueue* aTaskQueue,
              MediaDataDecoderCallback* aCallback);
@@ -42,20 +42,19 @@ public:
     VP8 = 1 << 0,
     VP9 = 1 << 1
   };
 
   // Return true if mimetype is a VPX codec of given types.
   static bool IsVPX(const nsACString& aMimeType, uint8_t aCodecMask=VP8|VP9);
 
 private:
-  void DecodeFrame (MediaRawData* aSample);
-  int DoDecodeFrame (MediaRawData* aSample);
-  void DoDrain ();
-  void OutputDelayedFrames ();
+  void ProcessDecode(MediaRawData* aSample);
+  int DoDecode(MediaRawData* aSample);
+  void ProcessDrain();
 
   RefPtr<ImageContainer> mImageContainer;
   RefPtr<FlushableTaskQueue> mTaskQueue;
   MediaDataDecoderCallback* mCallback;
 
   // VPx decoder state
   vpx_codec_ctx_t mVPX;