1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef A_HEVC_ASSEMBLER_H_ 18 19 #define A_HEVC_ASSEMBLER_H_ 20 21 #include "ARTPAssembler.h" 22 23 #include <utils/List.h> 24 #include <utils/RefBase.h> 25 #include <utils/String8.h> 26 27 namespace android { 28 29 struct ABuffer; 30 struct AMessage; 31 32 struct AHEVCAssembler : public ARTPAssembler { 33 AHEVCAssembler(const sp<AMessage> ¬ify); 34 35 typedef List<sp<ABuffer> > Queue; 36 37 protected: 38 virtual ~AHEVCAssembler(); 39 40 virtual AssemblyStatus assembleMore(const sp<ARTPSource> &source); 41 virtual void onByeReceived(); 42 virtual void packetLost(); 43 44 private: 45 sp<AMessage> mNotifyMsg; 46 47 uint32_t mAccessUnitRTPTime; 48 bool mNextExpectedSeqNoValid; 49 uint32_t mNextExpectedSeqNo; 50 bool mAccessUnitDamaged; 51 bool mFirstIFrameProvided; 52 int32_t mLastCvo; 53 uint64_t mLastIFrameProvidedAtMs; 54 int64_t mLastRtpTimeJitterDataUs; 55 int32_t mWidth; 56 int32_t mHeight; 57 List<sp<ABuffer> > mNALUnits; 58 59 int32_t addNack(const sp<ARTPSource> &source); 60 void checkSpsUpdated(const sp<ABuffer> &buffer); 61 void checkIFrameProvided(const sp<ABuffer> &buffer); 62 bool dropFramesUntilIframe(const sp<ABuffer> &buffer); 63 AssemblyStatus addNALUnit(const sp<ARTPSource> &source); 64 void addSingleNALUnit(const sp<ABuffer> &buffer); 65 AssemblyStatus addFragmentedNALUnit(List<sp<ABuffer> > *queue); 66 bool addSingleTimeAggregationPacket(const sp<ABuffer> &buffer); 67 68 void submitAccessUnit(); 69 70 int32_t pickStartSeq(const Queue *q, uint32_t first, int64_t play, int64_t jit); 71 int32_t deleteUnitUnderSeq(Queue *queue, uint32_t seq); 72 73 DISALLOW_EVIL_CONSTRUCTORS(AHEVCAssembler); 74 }; 75 76 } // namespace android 77 78 #endif // A_HEVC_ASSEMBLER_H_ 79