LCOV - code coverage report
Current view: top level - dom/media/platforms/agnostic - OpusDecoder.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 2 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : #if !defined(OpusDecoder_h_)
       7             : #define OpusDecoder_h_
       8             : 
       9             : #include "PlatformDecoderModule.h"
      10             : 
      11             : #include "mozilla/Maybe.h"
      12             : #include "nsAutoPtr.h"
      13             : 
      14             : struct OpusMSDecoder;
      15             : 
      16             : namespace mozilla {
      17             : 
      18             : class OpusParser;
      19             : 
      20             : class OpusDataDecoder : public MediaDataDecoder
      21             : {
      22             : public:
      23             :   explicit OpusDataDecoder(const CreateDecoderParams& aParams);
      24             :   ~OpusDataDecoder();
      25             : 
      26             :   RefPtr<InitPromise> Init() override;
      27             :   RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
      28             :   RefPtr<DecodePromise> Drain() override;
      29             :   RefPtr<FlushPromise> Flush() override;
      30             :   RefPtr<ShutdownPromise> Shutdown() override;
      31           0 :   const char* GetDescriptionName() const override
      32             :   {
      33           0 :     return "opus audio decoder";
      34             :   }
      35             : 
      36             :   // Return true if mimetype is Opus
      37             :   static bool IsOpus(const nsACString& aMimeType);
      38             : 
      39             :   // Pack pre-skip/CodecDelay, given in microseconds, into a
      40             :   // MediaByteBuffer. The decoder expects this value to come
      41             :   // from the container (if any) and to precede the OpusHead
      42             :   // block in the CodecSpecificConfig buffer to verify the
      43             :   // values match.
      44             :   static void AppendCodecDelay(MediaByteBuffer* config, uint64_t codecDelayUS);
      45             : 
      46             : private:
      47             :   nsresult DecodeHeader(const unsigned char* aData, size_t aLength);
      48             : 
      49             :   RefPtr<DecodePromise> ProcessDecode(MediaRawData* aSample);
      50             : 
      51             :   const AudioInfo& mInfo;
      52             :   const RefPtr<TaskQueue> mTaskQueue;
      53             : 
      54             :   // Opus decoder state
      55             :   nsAutoPtr<OpusParser> mOpusParser;
      56             :   OpusMSDecoder* mOpusDecoder;
      57             : 
      58             :   uint16_t mSkip;        // Samples left to trim before playback.
      59             :   bool mDecodedHeader;
      60             : 
      61             :   // Opus padding should only be discarded on the final packet.  Once this
      62             :   // is set to true, if the reader attempts to decode any further packets it
      63             :   // will raise an error so we can indicate that the file is invalid.
      64             :   bool mPaddingDiscarded;
      65             :   int64_t mFrames;
      66             :   Maybe<int64_t> mLastFrameTime;
      67             :   uint8_t mMappingTable[MAX_AUDIO_CHANNELS]; // Channel mapping table.
      68             : };
      69             : 
      70             : } // namespace mozilla
      71             : #endif

Generated by: LCOV version 1.13