ARTPSource.h revision 57648e4eec7dd2593af467877bc7cce4aa654759
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 27namespace android { 28 29struct ABuffer; 30struct AMessage; 31struct ARTPAssembler; 32struct ASessionDescription; 33 34struct 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 49private: 50 uint32_t mID; 51 uint32_t mHighestSeqNumber; 52 int32_t mNumBuffersReceived; 53 54 List<sp<ABuffer> > mQueue; 55 sp<ARTPAssembler> mAssembler; 56 57 size_t mNumTimes; 58 uint64_t mNTPTime[2]; 59 uint32_t mRTPTime[2]; 60 61 uint64_t mLastNTPTime; 62 int64_t mLastNTPTimeUpdateUs; 63 64 bool mIssueFIRRequests; 65 int64_t mLastFIRRequestUs; 66 uint8_t mNextFIRSeqNo; 67 68 uint64_t RTP2NTP(uint32_t rtpTime) const; 69 70 bool queuePacket(const sp<ABuffer> &buffer); 71 void dump() const; 72 73 DISALLOW_EVIL_CONSTRUCTORS(ARTPSource); 74}; 75 76} // namespace android 77 78#endif // A_RTP_SOURCE_H_ 79