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_RTP_SOURCE_H_ 18 19 #define A_RTP_SOURCE_H_ 20 21 #include <stdint.h> 22 23 #include <media/stagefright/foundation/ABase.h> 24 #include <utils/List.h> 25 #include <utils/RefBase.h> 26 27 namespace android { 28 29 struct ABuffer; 30 struct AMessage; 31 struct ARTPAssembler; 32 struct ASessionDescription; 33 34 struct ARTPSource : public RefBase { 35 ARTPSource( 36 uint32_t id, 37 const sp<ASessionDescription> &sessionDesc, size_t index, 38 const sp<AMessage> ¬ify); 39 40 void processRTPPacket(const sp<ABuffer> &buffer); 41 void timeUpdate(uint32_t rtpTime, uint64_t ntpTime); 42 void byeReceived(); 43 queueARTPSource44 List<sp<ABuffer> > *queue() { return &mQueue; } 45 46 void addReceiverReport(const sp<ABuffer> &buffer); 47 void addFIR(const sp<ABuffer> &buffer); 48 49 private: 50 uint32_t mID; 51 uint32_t mHighestSeqNumber; 52 uint32_t mPrevExpected; 53 uint32_t mBaseSeqNumber; 54 int32_t mNumBuffersReceived; 55 int32_t mPrevNumBuffersReceived; 56 57 List<sp<ABuffer> > mQueue; 58 sp<ARTPAssembler> mAssembler; 59 60 uint64_t mLastNTPTime; 61 int64_t mLastNTPTimeUpdateUs; 62 63 bool mIssueFIRRequests; 64 int64_t mLastFIRRequestUs; 65 uint8_t mNextFIRSeqNo; 66 67 sp<AMessage> mNotify; 68 69 bool queuePacket(const sp<ABuffer> &buffer); 70 71 DISALLOW_EVIL_CONSTRUCTORS(ARTPSource); 72 }; 73 74 } // namespace android 75 76 #endif // A_RTP_SOURCE_H_ 77