Loading media/libstagefright/wifi-display/source/Converter.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -301,8 +301,6 @@ status_t Converter::feedEncoderInputBuffers() { if (buffer != NULL) { CHECK(buffer->meta()->findInt64("timeUs", &timeUs)); ALOGV("in: %s timeUs = %lld us", mIsVideo ? "video" : "audio", timeUs); memcpy(mEncoderInputBuffers.itemAt(bufferIndex)->data(), buffer->data(), buffer->size()); Loading Loading @@ -353,8 +351,6 @@ status_t Converter::doMoreWork() { notify->setInt32("what", kWhatEOS); notify->post(); } else { ALOGV("out: %s timeUs = %lld us", mIsVideo ? "video" : "audio", timeUs); sp<ABuffer> buffer = new ABuffer(size); buffer->meta()->setInt64("timeUs", timeUs); Loading media/libstagefright/wifi-display/source/PlaybackSession.cpp +21 −17 Original line number Diff line number Diff line Loading @@ -75,8 +75,6 @@ struct WifiDisplaySource::PlaybackSession::Track : public AHandler { status_t start(); void stopAsync(); bool isStopped() const { return !mStarted; } void queueAccessUnit(const sp<ABuffer> &accessUnit); sp<ABuffer> dequeueAccessUnit(); Loading Loading @@ -200,6 +198,8 @@ void WifiDisplaySource::PlaybackSession::Track::onMessageReceived( sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatStopped); notify->post(); ALOGI("kWhatStopped %s posted", mIsAudio ? "audio" : "video"); break; } Loading Loading @@ -267,9 +267,11 @@ WifiDisplaySource::PlaybackSession::PlaybackSession( mNumRTPOctetsSent(0), mNumSRsSent(0), mSendSRPending(false), mFirstPacketTimeUs(-1ll), mHistoryLength(0), mTotalBytesSent(0ll) mHistoryLength(0) #if TRACK_BANDWIDTH ,mFirstPacketTimeUs(-1ll), ,mTotalBytesSent(0ll) #endif #if LOG_TRANSPORT_STREAM ,mLogFile(NULL) #endif Loading Loading @@ -747,21 +749,18 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( CHECK(msg->findSize("trackIndex", &trackIndex)); if (what == Track::kWhatStopped) { bool allTracksAreStopped = true; for (size_t i = 0; i < mTracks.size(); ++i) { const sp<Track> &track = mTracks.valueAt(i); if (!track->isStopped()) { allTracksAreStopped = false; break; } } ALOGI("Track %d stopped", trackIndex); sp<Track> track = mTracks.valueFor(trackIndex); looper()->unregisterHandler(track->id()); mTracks.removeItem(trackIndex); track.clear(); if (!allTracksAreStopped) { if (!mTracks.isEmpty()) { ALOGI("not all tracks are stopped yet"); break; } mTracks.clear(); mPacketizer.clear(); #if ENABLE_RETRANSMISSION Loading Loading @@ -1074,12 +1073,15 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( // flush int64_t nowUs = ALooper::GetNowUs(); #if TRACK_BANDWIDTH if (mFirstPacketTimeUs < 0ll) { mFirstPacketTimeUs = nowUs; } #endif // 90kHz time scale uint32_t rtpTime = ((nowUs - mFirstPacketTimeUs) * 9ll) / 100ll; uint32_t rtpTime = (nowUs * 9ll) / 100ll; uint8_t *rtp = mTSQueue->data(); rtp[0] = 0x80; Loading Loading @@ -1115,6 +1117,7 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( } else { sendPacket(mRTPSessionID, rtp, mTSQueue->size()); #if TRACK_BANDWIDTH mTotalBytesSent += mTSQueue->size(); int64_t delayUs = ALooper::GetNowUs() - mFirstPacketTimeUs; Loading @@ -1122,6 +1125,7 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( ALOGV("approx. net bandwidth used: %.2f Mbit/sec", mTotalBytesSent * 8.0 / delayUs); } #endif } mTSQueue->setInt32Data(mRTPSeqNo - 1); Loading media/libstagefright/wifi-display/source/PlaybackSession.h +4 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ struct TSPacketizer; #define LOG_TRANSPORT_STREAM 0 #define ENABLE_RETRANSMISSION 0 #define TRACK_BANDWIDTH 0 // Encapsulates the state of an RTP/RTCP session in the context of wifi // display. Loading Loading @@ -160,12 +161,13 @@ private: bool mSendSRPending; int64_t mFirstPacketTimeUs; List<sp<ABuffer> > mHistory; size_t mHistoryLength; #if TRACK_BANDWIDTH int64_t mFirstPacketTimeUs; uint64_t mTotalBytesSent; #endif #if LOG_TRANSPORT_STREAM FILE *mLogFile; Loading media/libstagefright/wifi-display/source/RepeaterSource.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,8 @@ namespace android { RepeaterSource::RepeaterSource(const sp<MediaSource> &source, double rateHz) : mSource(source), : mStarted(false), mSource(source), mRateHz(rateHz), mBuffer(NULL), mResult(OK), Loading @@ -22,10 +23,12 @@ RepeaterSource::RepeaterSource(const sp<MediaSource> &source, double rateHz) } RepeaterSource::~RepeaterSource() { stop(); CHECK(!mStarted); } status_t RepeaterSource::start(MetaData *params) { CHECK(!mStarted); status_t err = mSource->start(params); if (err != OK) { Loading @@ -46,10 +49,14 @@ status_t RepeaterSource::start(MetaData *params) { postRead(); mStarted = true; return OK; } status_t RepeaterSource::stop() { CHECK(mStarted); ALOGV("stopping"); if (mLooper != NULL) { Loading @@ -69,6 +76,8 @@ status_t RepeaterSource::stop() { ALOGV("stopped"); mStarted = false; return err; } Loading media/libstagefright/wifi-display/source/RepeaterSource.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ private: Mutex mLock; Condition mCondition; bool mStarted; sp<MediaSource> mSource; double mRateHz; Loading Loading
media/libstagefright/wifi-display/source/Converter.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -301,8 +301,6 @@ status_t Converter::feedEncoderInputBuffers() { if (buffer != NULL) { CHECK(buffer->meta()->findInt64("timeUs", &timeUs)); ALOGV("in: %s timeUs = %lld us", mIsVideo ? "video" : "audio", timeUs); memcpy(mEncoderInputBuffers.itemAt(bufferIndex)->data(), buffer->data(), buffer->size()); Loading Loading @@ -353,8 +351,6 @@ status_t Converter::doMoreWork() { notify->setInt32("what", kWhatEOS); notify->post(); } else { ALOGV("out: %s timeUs = %lld us", mIsVideo ? "video" : "audio", timeUs); sp<ABuffer> buffer = new ABuffer(size); buffer->meta()->setInt64("timeUs", timeUs); Loading
media/libstagefright/wifi-display/source/PlaybackSession.cpp +21 −17 Original line number Diff line number Diff line Loading @@ -75,8 +75,6 @@ struct WifiDisplaySource::PlaybackSession::Track : public AHandler { status_t start(); void stopAsync(); bool isStopped() const { return !mStarted; } void queueAccessUnit(const sp<ABuffer> &accessUnit); sp<ABuffer> dequeueAccessUnit(); Loading Loading @@ -200,6 +198,8 @@ void WifiDisplaySource::PlaybackSession::Track::onMessageReceived( sp<AMessage> notify = mNotify->dup(); notify->setInt32("what", kWhatStopped); notify->post(); ALOGI("kWhatStopped %s posted", mIsAudio ? "audio" : "video"); break; } Loading Loading @@ -267,9 +267,11 @@ WifiDisplaySource::PlaybackSession::PlaybackSession( mNumRTPOctetsSent(0), mNumSRsSent(0), mSendSRPending(false), mFirstPacketTimeUs(-1ll), mHistoryLength(0), mTotalBytesSent(0ll) mHistoryLength(0) #if TRACK_BANDWIDTH ,mFirstPacketTimeUs(-1ll), ,mTotalBytesSent(0ll) #endif #if LOG_TRANSPORT_STREAM ,mLogFile(NULL) #endif Loading Loading @@ -747,21 +749,18 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( CHECK(msg->findSize("trackIndex", &trackIndex)); if (what == Track::kWhatStopped) { bool allTracksAreStopped = true; for (size_t i = 0; i < mTracks.size(); ++i) { const sp<Track> &track = mTracks.valueAt(i); if (!track->isStopped()) { allTracksAreStopped = false; break; } } ALOGI("Track %d stopped", trackIndex); sp<Track> track = mTracks.valueFor(trackIndex); looper()->unregisterHandler(track->id()); mTracks.removeItem(trackIndex); track.clear(); if (!allTracksAreStopped) { if (!mTracks.isEmpty()) { ALOGI("not all tracks are stopped yet"); break; } mTracks.clear(); mPacketizer.clear(); #if ENABLE_RETRANSMISSION Loading Loading @@ -1074,12 +1073,15 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( // flush int64_t nowUs = ALooper::GetNowUs(); #if TRACK_BANDWIDTH if (mFirstPacketTimeUs < 0ll) { mFirstPacketTimeUs = nowUs; } #endif // 90kHz time scale uint32_t rtpTime = ((nowUs - mFirstPacketTimeUs) * 9ll) / 100ll; uint32_t rtpTime = (nowUs * 9ll) / 100ll; uint8_t *rtp = mTSQueue->data(); rtp[0] = 0x80; Loading Loading @@ -1115,6 +1117,7 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( } else { sendPacket(mRTPSessionID, rtp, mTSQueue->size()); #if TRACK_BANDWIDTH mTotalBytesSent += mTSQueue->size(); int64_t delayUs = ALooper::GetNowUs() - mFirstPacketTimeUs; Loading @@ -1122,6 +1125,7 @@ ssize_t WifiDisplaySource::PlaybackSession::appendTSData( ALOGV("approx. net bandwidth used: %.2f Mbit/sec", mTotalBytesSent * 8.0 / delayUs); } #endif } mTSQueue->setInt32Data(mRTPSeqNo - 1); Loading
media/libstagefright/wifi-display/source/PlaybackSession.h +4 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ struct TSPacketizer; #define LOG_TRANSPORT_STREAM 0 #define ENABLE_RETRANSMISSION 0 #define TRACK_BANDWIDTH 0 // Encapsulates the state of an RTP/RTCP session in the context of wifi // display. Loading Loading @@ -160,12 +161,13 @@ private: bool mSendSRPending; int64_t mFirstPacketTimeUs; List<sp<ABuffer> > mHistory; size_t mHistoryLength; #if TRACK_BANDWIDTH int64_t mFirstPacketTimeUs; uint64_t mTotalBytesSent; #endif #if LOG_TRANSPORT_STREAM FILE *mLogFile; Loading
media/libstagefright/wifi-display/source/RepeaterSource.cpp +11 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,8 @@ namespace android { RepeaterSource::RepeaterSource(const sp<MediaSource> &source, double rateHz) : mSource(source), : mStarted(false), mSource(source), mRateHz(rateHz), mBuffer(NULL), mResult(OK), Loading @@ -22,10 +23,12 @@ RepeaterSource::RepeaterSource(const sp<MediaSource> &source, double rateHz) } RepeaterSource::~RepeaterSource() { stop(); CHECK(!mStarted); } status_t RepeaterSource::start(MetaData *params) { CHECK(!mStarted); status_t err = mSource->start(params); if (err != OK) { Loading @@ -46,10 +49,14 @@ status_t RepeaterSource::start(MetaData *params) { postRead(); mStarted = true; return OK; } status_t RepeaterSource::stop() { CHECK(mStarted); ALOGV("stopping"); if (mLooper != NULL) { Loading @@ -69,6 +76,8 @@ status_t RepeaterSource::stop() { ALOGV("stopped"); mStarted = false; return err; } Loading
media/libstagefright/wifi-display/source/RepeaterSource.h +2 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,8 @@ private: Mutex mLock; Condition mCondition; bool mStarted; sp<MediaSource> mSource; double mRateHz; Loading