From 45d76bb6c8f15335f89c287dbae04cc38f79d0a8 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Thu, 20 Sep 2012 16:00:17 -0700 Subject: Remove legacy code and APIs in wifi display related code. Change-Id: Ia010e7a00534f9356b3247369d0ffd65591d91aa --- media/libmedia/IMediaPlayerService.cpp | 25 -- media/libmediaplayerservice/MediaPlayerService.cpp | 25 -- media/libmediaplayerservice/MediaPlayerService.h | 4 - media/libstagefright/wifi-display/Android.mk | 1 - .../wifi-display/source/PlaybackSession.cpp | 168 +--------- .../wifi-display/source/PlaybackSession.h | 9 +- .../wifi-display/source/Serializer.cpp | 370 --------------------- .../wifi-display/source/Serializer.h | 84 ----- .../wifi-display/source/WifiDisplaySource.cpp | 1 - media/libstagefright/wifi-display/wfd.cpp | 32 +- 10 files changed, 9 insertions(+), 710 deletions(-) delete mode 100644 media/libstagefright/wifi-display/source/Serializer.cpp delete mode 100644 media/libstagefright/wifi-display/source/Serializer.h (limited to 'media') diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp index c702d76..c0a0260 100644 --- a/media/libmedia/IMediaPlayerService.cpp +++ b/media/libmedia/IMediaPlayerService.cpp @@ -43,7 +43,6 @@ enum { GET_OMX, MAKE_CRYPTO, MAKE_HDCP, - ENABLE_REMOTE_DISPLAY, ADD_BATTERY_DATA, PULL_BATTERY_DATA, LISTEN_FOR_REMOTE_DISPLAY, @@ -134,21 +133,6 @@ public: return interface_cast(reply.readStrongBinder()); } - virtual status_t enableRemoteDisplay(const char *iface) { - Parcel data, reply; - data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - - if (iface != NULL) { - data.writeInt32(1); - data.writeCString(iface); - } else { - data.writeInt32(0); - } - - remote()->transact(ENABLE_REMOTE_DISPLAY, data, &reply); - return reply.readInt32(); - } - virtual void addBatteryData(uint32_t params) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); @@ -252,15 +236,6 @@ status_t BnMediaPlayerService::onTransact( reply->writeStrongBinder(hdcp->asBinder()); return NO_ERROR; } break; - case ENABLE_REMOTE_DISPLAY: { - CHECK_INTERFACE(IMediaPlayerService, data, reply); - const char *iface = NULL; - if (data.readInt32()) { - iface = data.readCString(); - } - reply->writeInt32(enableRemoteDisplay(iface)); - return NO_ERROR; - } break; case ADD_BATTERY_DATA: { CHECK_INTERFACE(IMediaPlayerService, data, reply); uint32_t params = data.readInt32(); diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index eaa44e2..9bedff1 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -295,31 +295,6 @@ sp MediaPlayerService::listenForRemoteDisplay( return new RemoteDisplay(client, iface.string()); } -// TODO: delete this method -status_t MediaPlayerService::enableRemoteDisplay(const char *iface) { - if (!checkPermission("android.permission.CONTROL_WIFI_DISPLAY")) { - return PERMISSION_DENIED; - } - - Mutex::Autolock autoLock(mLock); - - if (iface != NULL) { - if (mRemoteDisplay != NULL) { - return INVALID_OPERATION; - } - - mRemoteDisplay = new RemoteDisplay(NULL /* client */, iface); - return OK; - } - - if (mRemoteDisplay != NULL) { - mRemoteDisplay->dispose(); - mRemoteDisplay.clear(); - } - - return OK; -} - status_t MediaPlayerService::AudioCache::dump(int fd, const Vector& args) const { const size_t SIZE = 256; diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h index 6105ce4..fd648df 100644 --- a/media/libmediaplayerservice/MediaPlayerService.h +++ b/media/libmediaplayerservice/MediaPlayerService.h @@ -44,7 +44,6 @@ class IOMX; class IRemoteDisplay; class IRemoteDisplayClient; class MediaRecorderClient; -struct RemoteDisplay; #define CALLBACK_ANTAGONIZER 0 #if CALLBACK_ANTAGONIZER @@ -254,8 +253,6 @@ public: virtual sp listenForRemoteDisplay(const sp& client, const String8& iface); - virtual status_t enableRemoteDisplay(const char *iface); - virtual status_t dump(int fd, const Vector& args); void removeClient(wp client); @@ -431,7 +428,6 @@ private: int32_t mNextConnId; sp mOMX; sp mCrypto; - sp mRemoteDisplay; }; // ---------------------------------------------------------------------------- diff --git a/media/libstagefright/wifi-display/Android.mk b/media/libstagefright/wifi-display/Android.mk index a392532..f8e4219 100644 --- a/media/libstagefright/wifi-display/Android.mk +++ b/media/libstagefright/wifi-display/Android.mk @@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \ source/MediaPuller.cpp \ source/PlaybackSession.cpp \ source/RepeaterSource.cpp \ - source/Serializer.cpp \ source/TSPacketizer.cpp \ source/WifiDisplaySource.cpp \ diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.cpp b/media/libstagefright/wifi-display/source/PlaybackSession.cpp index 5f40406..24f33df 100644 --- a/media/libstagefright/wifi-display/source/PlaybackSession.cpp +++ b/media/libstagefright/wifi-display/source/PlaybackSession.cpp @@ -23,7 +23,6 @@ #include "Converter.h" #include "MediaPuller.h" #include "RepeaterSource.h" -#include "Serializer.h" #include "TSPacketizer.h" #include @@ -47,9 +46,6 @@ #include -//#define FAKE_VIDEO 1 -#define USE_SERIALIZER 0 - namespace android { static size_t kMaxRTPPacketSize = 1500; @@ -192,12 +188,10 @@ WifiDisplaySource::PlaybackSession::PlaybackSession( const sp &netSession, const sp ¬ify, const in_addr &interfaceAddr, - bool legacyMode, const sp &hdcp) : mNetSession(netSession), mNotify(notify), mInterfaceAddr(interfaceAddr), - mLegacyMode(legacyMode), mHDCP(hdcp), mLastLifesignUs(), mVideoTrackIndex(-1), @@ -457,10 +451,6 @@ status_t WifiDisplaySource::PlaybackSession::onFinishPlay2() { scheduleSendSR(); } - if (mSerializer != NULL) { - return mSerializer->start(); - } - for (size_t i = 0; i < mTracks.size(); ++i) { status_t err = mTracks.editValueAt(i)->start(); @@ -491,29 +481,8 @@ status_t WifiDisplaySource::PlaybackSession::destroy() { mPacketizer.clear(); - if (mSerializer != NULL) { - mSerializer->stop(); - - looper()->unregisterHandler(mSerializer->id()); - mSerializer.clear(); - } - mTracks.clear(); - if (mSerializerLooper != NULL) { - mSerializerLooper->stop(); - mSerializerLooper.clear(); - } - - if (mLegacyMode) { - sp sm = defaultServiceManager(); - sp binder = sm->getService(String16("SurfaceFlinger")); - sp service = interface_cast(binder); - CHECK(service != NULL); - - service->connectDisplay(NULL); - } - #if ENABLE_RETRANSMISSION if (mRTCPRetransmissionSessionID != 0) { mNetSession->destroySession(mRTCPRetransmissionSessionID); @@ -669,26 +638,19 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( break; } - case kWhatSerializerNotify: + case kWhatMediaPullerNotify: { int32_t what; CHECK(msg->findInt32("what", &what)); - if (what == Serializer::kWhatEOS) { + if (what == MediaPuller::kWhatEOS) { ALOGI("input eos"); for (size_t i = 0; i < mTracks.size(); ++i) { -#if FAKE_VIDEO - sp msg = new AMessage(kWhatConverterNotify, id()); - msg->setInt32("what", Converter::kWhatEOS); - msg->setSize("trackIndex", i); - msg->post(); -#else mTracks.valueAt(i)->converter()->signalEOS(); -#endif } } else { - CHECK_EQ(what, Serializer::kWhatAccessUnit); + CHECK_EQ(what, MediaPuller::kWhatAccessUnit); size_t trackIndex; CHECK(msg->findSize("trackIndex", &trackIndex)); @@ -696,25 +658,8 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( sp accessUnit; CHECK(msg->findBuffer("accessUnit", &accessUnit)); -#if FAKE_VIDEO - int64_t timeUs; - CHECK(accessUnit->meta()->findInt64("timeUs", &timeUs)); - - void *mbuf; - CHECK(accessUnit->meta()->findPointer("mediaBuffer", &mbuf)); - - ((MediaBuffer *)mbuf)->release(); - mbuf = NULL; - - sp msg = new AMessage(kWhatConverterNotify, id()); - msg->setInt32("what", Converter::kWhatAccessUnit); - msg->setSize("trackIndex", trackIndex); - msg->setBuffer("accessUnit", accessUnit); - msg->post(); -#else mTracks.valueFor(trackIndex)->converter() ->feedAccessUnit(accessUnit); -#endif } break; } @@ -861,11 +806,9 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( ssize_t index = mTracks.indexOfKey(trackIndex); CHECK_GE(index, 0); -#if !FAKE_VIDEO const sp &converter = mTracks.valueAt(index)->converter(); looper()->unregisterHandler(converter->id()); -#endif mTracks.removeItemsAt(index); @@ -895,13 +838,8 @@ void WifiDisplaySource::PlaybackSession::onMessageReceived( } status_t WifiDisplaySource::PlaybackSession::setupPacketizer() { - sp msg = new AMessage(kWhatSerializerNotify, id()); - mPacketizer = new TSPacketizer; -#if FAKE_VIDEO - return addFakeSources(); -#else status_t err = addVideoSource(); if (err != OK) { @@ -909,85 +847,10 @@ status_t WifiDisplaySource::PlaybackSession::setupPacketizer() { } return addAudioSource(); -#endif -} - -status_t WifiDisplaySource::PlaybackSession::addFakeSources() { -#if FAKE_VIDEO - mSerializerLooper = new ALooper; - mSerializerLooper->setName("serializer_looper"); - mSerializerLooper->start(); - - sp msg = new AMessage(kWhatSerializerNotify, id()); - mSerializer = new Serializer( - true /* throttled */, msg); - - mSerializerLooper->registerHandler(mSerializer); - - DataSource::RegisterDefaultSniffers(); - - sp dataSource = - DataSource::CreateFromURI( - "/system/etc/inception_1500.mp4"); - - CHECK(dataSource != NULL); - - sp extractor = MediaExtractor::Create(dataSource); - CHECK(extractor != NULL); - - bool haveAudio = false; - bool haveVideo = false; - for (size_t i = 0; i < extractor->countTracks(); ++i) { - sp meta = extractor->getTrackMetaData(i); - - const char *mime; - CHECK(meta->findCString(kKeyMIMEType, &mime)); - - bool useTrack = false; - if (!strncasecmp(mime, "audio/", 6) && !haveAudio) { - useTrack = true; - haveAudio = true; - } else if (!strncasecmp(mime, "video/", 6) && !haveVideo) { - useTrack = true; - haveVideo = true; - } - - if (!useTrack) { - continue; - } - - sp source = extractor->getTrack(i); - - ssize_t index = mSerializer->addSource(source); - CHECK_GE(index, 0); - - sp format; - status_t err = convertMetaDataToMessage(source->getFormat(), &format); - CHECK_EQ(err, (status_t)OK); - - mTracks.add(index, new Track(format)); - } - CHECK(haveAudio || haveVideo); -#endif - - return OK; } status_t WifiDisplaySource::PlaybackSession::addSource( bool isVideo, const sp &source, size_t *numInputBuffers) { -#if USE_SERIALIZER - if (mSerializer == NULL) { - mSerializerLooper = new ALooper; - mSerializerLooper->setName("serializer_looper"); - mSerializerLooper->start(); - - sp msg = new AMessage(kWhatSerializerNotify, id()); - mSerializer = new Serializer( - false /* throttled */, msg); - - mSerializerLooper->registerHandler(mSerializer); - } -#else sp pullLooper = new ALooper; pullLooper->setName("pull_looper"); @@ -995,7 +858,6 @@ status_t WifiDisplaySource::PlaybackSession::addSource( false /* runOnCallingThread */, false /* canCallJava */, PRIORITY_DEFAULT); -#endif sp codecLooper = new ALooper; codecLooper->setName("codec_looper"); @@ -1009,16 +871,12 @@ status_t WifiDisplaySource::PlaybackSession::addSource( sp notify; -#if USE_SERIALIZER - trackIndex = mSerializer->addSource(source); -#else trackIndex = mTracks.size(); - notify = new AMessage(kWhatSerializerNotify, id()); + notify = new AMessage(kWhatMediaPullerNotify, id()); notify->setSize("trackIndex", trackIndex); sp puller = new MediaPuller(source, notify); pullLooper->registerHandler(puller); -#endif sp format; status_t err = convertMetaDataToMessage(source->getFormat(), &format); @@ -1044,11 +902,7 @@ status_t WifiDisplaySource::PlaybackSession::addSource( *numInputBuffers = converter->getInputBufferCount(); } -#if USE_SERIALIZER - mTracks.add(trackIndex, new Track(NULL, codecLooper, NULL, converter)); -#else mTracks.add(trackIndex, new Track(pullLooper, codecLooper, puller, converter)); -#endif if (isVideo) { mVideoTrackIndex = trackIndex; @@ -1070,21 +924,11 @@ status_t WifiDisplaySource::PlaybackSession::addVideoSource() { return err; } - // Add one reference to account for the serializer. err = source->setMaxAcquiredBufferCount(numInputBuffers); CHECK_EQ(err, (status_t)OK); mBufferQueue = source->getBufferQueue(); - if (mLegacyMode) { - sp sm = defaultServiceManager(); - sp binder = sm->getService(String16("SurfaceFlinger")); - sp service = interface_cast(binder); - CHECK(service != NULL); - - service->connectDisplay(mBufferQueue); - } - return OK; } @@ -1111,11 +955,11 @@ sp WifiDisplaySource::PlaybackSession::getSurfaceTexture() { } int32_t WifiDisplaySource::PlaybackSession::width() const { - return mLegacyMode ? 720 : 1280; + return 1280; } int32_t WifiDisplaySource::PlaybackSession::height() const { - return mLegacyMode ? 1280 : 720; + return 720; } void WifiDisplaySource::PlaybackSession::scheduleSendSR() { diff --git a/media/libstagefright/wifi-display/source/PlaybackSession.h b/media/libstagefright/wifi-display/source/PlaybackSession.h index 6ab3f84..f2090b4 100644 --- a/media/libstagefright/wifi-display/source/PlaybackSession.h +++ b/media/libstagefright/wifi-display/source/PlaybackSession.h @@ -28,7 +28,6 @@ struct IHDCP; struct ISurfaceTexture; struct MediaPuller; struct MediaSource; -struct Serializer; struct TSPacketizer; #define LOG_TRANSPORT_STREAM 0 @@ -41,7 +40,6 @@ struct WifiDisplaySource::PlaybackSession : public AHandler { const sp &netSession, const sp ¬ify, const struct in_addr &interfaceAddr, - bool legacyMode, const sp &hdcp); enum TransportMode { @@ -91,7 +89,7 @@ private: kWhatRTPRetransmissionNotify, kWhatRTCPRetransmissionNotify, #endif - kWhatSerializerNotify, + kWhatMediaPullerNotify, kWhatConverterNotify, kWhatUpdateSurface, kWhatFinishPlay, @@ -108,13 +106,10 @@ private: sp mNetSession; sp mNotify; in_addr mInterfaceAddr; - bool mLegacyMode; sp mHDCP; int64_t mLastLifesignUs; - sp mSerializerLooper; - sp mSerializer; sp mPacketizer; sp mBufferQueue; @@ -178,8 +173,6 @@ private: status_t setupPacketizer(); - status_t addFakeSources(); - status_t addSource( bool isVideo, const sp &source, diff --git a/media/libstagefright/wifi-display/source/Serializer.cpp b/media/libstagefright/wifi-display/source/Serializer.cpp deleted file mode 100644 index 598fd3e..0000000 --- a/media/libstagefright/wifi-display/source/Serializer.cpp +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright 2012, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "Serializer" -#include - -#include "Serializer.h" - -#include -#include -#include -#include -#include -#include - -namespace android { - -struct Serializer::Track : public RefBase { - Track(const sp &source); - - status_t start(); - status_t stop(); - - void readBufferIfNecessary(); - - bool reachedEOS() const; - int64_t bufferTimeUs() const; - - sp drainBuffer(); - -protected: - virtual ~Track(); - -private: - sp mSource; - AString mMIME; - - bool mStarted; - status_t mFinalResult; - MediaBuffer *mBuffer; - int64_t mBufferTimeUs; - - DISALLOW_EVIL_CONSTRUCTORS(Track); -}; - -Serializer::Track::Track(const sp &source) - : mSource(source), - mStarted(false), - mFinalResult(OK), - mBuffer(NULL), - mBufferTimeUs(-1ll) { - const char *mime; - sp meta = mSource->getFormat(); - CHECK(meta->findCString(kKeyMIMEType, &mime)); - - mMIME = mime; -} - -Serializer::Track::~Track() { - stop(); -} - -status_t Serializer::Track::start() { - if (mStarted) { - return OK; - } - - status_t err = mSource->start(); - - if (err == OK) { - mStarted = true; - } - - return err; -} - -status_t Serializer::Track::stop() { - if (!mStarted) { - return OK; - } - - if (mBuffer != NULL) { - mBuffer->release(); - mBuffer = NULL; - - mBufferTimeUs = -1ll; - } - - status_t err = mSource->stop(); - - mStarted = false; - - return err; -} - -void Serializer::Track::readBufferIfNecessary() { - if (mBuffer != NULL) { - return; - } - - int64_t nowUs = ALooper::GetNowUs(); - mFinalResult = mSource->read(&mBuffer); - int64_t delayUs = ALooper::GetNowUs() - nowUs; - - ALOGV("read on track %s took %lld us, got %d bytes", - mMIME.c_str(), delayUs, mBuffer->range_length()); - - if (mFinalResult != OK) { - ALOGI("read failed w/ err %d", mFinalResult); - return; - } - - CHECK(mBuffer->meta_data()->findInt64(kKeyTime, &mBufferTimeUs)); -} - -bool Serializer::Track::reachedEOS() const { - return mFinalResult != OK; -} - -int64_t Serializer::Track::bufferTimeUs() const { - return mBufferTimeUs; -} - -sp Serializer::Track::drainBuffer() { - sp accessUnit = new ABuffer(mBuffer->range_length()); - - memcpy(accessUnit->data(), - (const uint8_t *)mBuffer->data() + mBuffer->range_offset(), - mBuffer->range_length()); - - accessUnit->meta()->setInt64("timeUs", mBufferTimeUs); - accessUnit->meta()->setPointer("mediaBuffer", mBuffer); - - mBuffer = NULL; - mBufferTimeUs = -1ll; - - return accessUnit; -} - -//////////////////////////////////////////////////////////////////////////////// - -Serializer::Serializer(bool throttle, const sp ¬ify) - : mThrottle(throttle), - mNotify(notify), - mPollGeneration(0), - mStartTimeUs(-1ll) { -} - -Serializer::~Serializer() { -} - -status_t Serializer::postSynchronouslyAndReturnError( - const sp &msg) { - sp response; - status_t err = msg->postAndAwaitResponse(&response); - - if (err != OK) { - return err; - } - - if (!response->findInt32("err", &err)) { - err = OK; - } - - return err; -} - -ssize_t Serializer::addSource(const sp &source) { - sp msg = new AMessage(kWhatAddSource, id()); - msg->setPointer("source", source.get()); - - sp response; - status_t err = msg->postAndAwaitResponse(&response); - - if (err != OK) { - return err; - } - - if (!response->findInt32("err", &err)) { - size_t index; - CHECK(response->findSize("index", &index)); - - return index; - } - - return err; -} - -status_t Serializer::start() { - return postSynchronouslyAndReturnError(new AMessage(kWhatStart, id())); -} - -status_t Serializer::stop() { - return postSynchronouslyAndReturnError(new AMessage(kWhatStop, id())); -} - -void Serializer::onMessageReceived(const sp &msg) { - switch (msg->what()) { - case kWhatAddSource: - { - ssize_t index = onAddSource(msg); - - sp response = new AMessage; - - if (index < 0) { - response->setInt32("err", index); - } else { - response->setSize("index", index); - } - - uint32_t replyID; - CHECK(msg->senderAwaitsResponse(&replyID)); - - response->postReply(replyID); - break; - } - - case kWhatStart: - case kWhatStop: - { - status_t err = (msg->what() == kWhatStart) ? onStart() : onStop(); - - sp response = new AMessage; - response->setInt32("err", err); - - uint32_t replyID; - CHECK(msg->senderAwaitsResponse(&replyID)); - - response->postReply(replyID); - break; - } - - case kWhatPoll: - { - int32_t generation; - CHECK(msg->findInt32("generation", &generation)); - - if (generation != mPollGeneration) { - break; - } - - int64_t delayUs = onPoll(); - if (delayUs >= 0ll) { - schedulePoll(delayUs); - } - break; - } - - default: - TRESPASS(); - } -} - -ssize_t Serializer::onAddSource(const sp &msg) { - void *obj; - CHECK(msg->findPointer("source", &obj)); - - sp source = static_cast(obj); - - sp track = new Track(source); - return mTracks.add(track); -} - -status_t Serializer::onStart() { - status_t err = OK; - for (size_t i = 0; i < mTracks.size(); ++i) { - err = mTracks.itemAt(i)->start(); - - if (err != OK) { - break; - } - } - - if (err == OK) { - schedulePoll(); - } - - return err; -} - -status_t Serializer::onStop() { - for (size_t i = 0; i < mTracks.size(); ++i) { - mTracks.itemAt(i)->stop(); - } - - cancelPoll(); - - return OK; -} - -int64_t Serializer::onPoll() { - int64_t minTimeUs = -1ll; - ssize_t minTrackIndex = -1; - - for (size_t i = 0; i < mTracks.size(); ++i) { - const sp &track = mTracks.itemAt(i); - - track->readBufferIfNecessary(); - - if (!track->reachedEOS()) { - int64_t timeUs = track->bufferTimeUs(); - - if (minTrackIndex < 0 || timeUs < minTimeUs) { - minTimeUs = timeUs; - minTrackIndex = i; - } - } - } - - if (minTrackIndex < 0) { - sp notify = mNotify->dup(); - notify->setInt32("what", kWhatEOS); - notify->post(); - - return -1ll; - } - - if (mThrottle) { - int64_t nowUs = ALooper::GetNowUs(); - - if (mStartTimeUs < 0ll) { - mStartTimeUs = nowUs; - } - - int64_t lateByUs = nowUs - (minTimeUs + mStartTimeUs); - - if (lateByUs < 0ll) { - // Too early - return -lateByUs; - } - } - - sp notify = mNotify->dup(); - - notify->setInt32("what", kWhatAccessUnit); - notify->setSize("trackIndex", minTrackIndex); - - notify->setBuffer( - "accessUnit", mTracks.itemAt(minTrackIndex)->drainBuffer()); - - notify->post(); - - return 0ll; -} - -void Serializer::schedulePoll(int64_t delayUs) { - sp msg = new AMessage(kWhatPoll, id()); - msg->setInt32("generation", mPollGeneration); - msg->post(delayUs); -} - -void Serializer::cancelPoll() { - ++mPollGeneration; -} - -} // namespace android diff --git a/media/libstagefright/wifi-display/source/Serializer.h b/media/libstagefright/wifi-display/source/Serializer.h deleted file mode 100644 index 07950fa..0000000 --- a/media/libstagefright/wifi-display/source/Serializer.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SERIALIZER_H_ - -#define SERIALIZER_H_ - -#include -#include - -namespace android { - -struct AMessage; -struct MediaSource; - -// After adding a number of MediaSource objects and starting the Serializer, -// it'll emit their access units in order of increasing timestamps. -struct Serializer : public AHandler { - enum { - kWhatEOS, - kWhatAccessUnit - }; - - // In throttled operation, data is emitted at a pace corresponding - // to the incoming media timestamps. - Serializer(bool throttle, const sp ¬ify); - - ssize_t addSource(const sp &source); - - status_t start(); - status_t stop(); - -protected: - virtual void onMessageReceived(const sp &what); - virtual ~Serializer(); - -private: - enum { - kWhatAddSource, - kWhatStart, - kWhatStop, - kWhatPoll - }; - - struct Track; - - bool mThrottle; - sp mNotify; - Vector > mTracks; - - int32_t mPollGeneration; - - int64_t mStartTimeUs; - - status_t postSynchronouslyAndReturnError(const sp &msg); - - ssize_t onAddSource(const sp &msg); - status_t onStart(); - status_t onStop(); - int64_t onPoll(); - - void schedulePoll(int64_t delayUs = 0ll); - void cancelPoll(); - - DISALLOW_EVIL_CONSTRUCTORS(Serializer); -}; - -} // namespace android - -#endif // SERIALIZER_H_ - diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp index 1e0b6e2..9ad978f 100644 --- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp +++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp @@ -898,7 +898,6 @@ status_t WifiDisplaySource::onSetupRequest( sp playbackSession = new PlaybackSession( mNetSession, notify, mInterfaceAddr, - mClient == NULL, /* legacyMode */ #if REQUIRE_HDCP mHDCP #else diff --git a/media/libstagefright/wifi-display/wfd.cpp b/media/libstagefright/wifi-display/wfd.cpp index d886f14..011edab 100644 --- a/media/libstagefright/wifi-display/wfd.cpp +++ b/media/libstagefright/wifi-display/wfd.cpp @@ -29,27 +29,13 @@ namespace android { -static void enableDisableRemoteDisplay(const char *iface) { - sp sm = defaultServiceManager(); - sp binder = sm->getService(String16("media.player")); - - sp service = - interface_cast(binder); - - CHECK(service.get() != NULL); - - service->enableRemoteDisplay(iface); -} - } // namespace android static void usage(const char *me) { fprintf(stderr, "usage:\n" " %s -c host[:port]\tconnect to wifi source\n" - " -u uri \tconnect to an rtsp uri\n" - " -e ip[:port] \tenable remote display\n" - " -d \tdisable remote display\n", + " -u uri \tconnect to an rtsp uri\n", me); } @@ -65,7 +51,7 @@ int main(int argc, char **argv) { AString uri; int res; - while ((res = getopt(argc, argv, "hc:l:u:e:d")) >= 0) { + while ((res = getopt(argc, argv, "hc:l:u:")) >= 0) { switch (res) { case 'c': { @@ -95,20 +81,6 @@ int main(int argc, char **argv) { break; } - case 'e': - { - enableDisableRemoteDisplay(optarg); - exit(0); - break; - } - - case 'd': - { - enableDisableRemoteDisplay(NULL); - exit(0); - break; - } - case '?': case 'h': default: -- cgit v1.1