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 44 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 int32_t mNumBuffersReceived; 53 54 List<sp<ABuffer> > mQueue; 55 sp<ARTPAssembler> mAssembler; 56 57 uint64_t mLastNTPTime; 58 int64_t mLastNTPTimeUpdateUs; 59 60 bool mIssueFIRRequests; 61 int64_t mLastFIRRequestUs; 62 uint8_t mNextFIRSeqNo; 63 64 sp<AMessage> mNotify; 65 66 bool queuePacket(const sp<ABuffer> &buffer); 67 68 DISALLOW_EVIL_CONSTRUCTORS(ARTPSource); 69 }; 70 71 } // namespace android 72 73 #endif // A_RTP_SOURCE_H_ 74