Loading media/libstagefright/MediaCodecSource.cpp +20 −7 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder struct MediaCodecSource::Puller : public AHandler { Puller(const sp<MediaSource> &source); void interruptSource(); status_t start(const sp<MetaData> &meta, const sp<AMessage> ¬ify); void stop(); void stopSource(); Loading Loading @@ -186,14 +187,19 @@ void MediaCodecSource::Puller::stop() { } if (interrupt) { interruptSource(); } } void MediaCodecSource::Puller::interruptSource() { // call source->stop if read has been pending for over a second // TODO: we should really call this if kWhatStop has not returned for more than a second. // We have to call this outside the looper as looper is pending on the read. mSource->stop(); } } void MediaCodecSource::Puller::stopSource() { (new AMessage(kWhatStop, this))->post(); sp<AMessage> msg = new AMessage(kWhatStop, this); (void)postSynchronouslyAndReturnError(msg); } void MediaCodecSource::Puller::pause() { Loading Loading @@ -247,6 +253,13 @@ void MediaCodecSource::Puller::onMessageReceived(const sp<AMessage> &msg) { case kWhatStop: { mSource->stop(); sp<AMessage> response = new AMessage; response->setInt32("err", OK); sp<AReplyToken> replyID; CHECK(msg->senderAwaitsResponse(&replyID)); response->postReply(replyID); break; } Loading Loading @@ -915,7 +928,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { if (!(mFlags & FLAG_USE_SURFACE_INPUT)) { ALOGV("source (%s) stopping", mIsVideo ? "video" : "audio"); mPuller->stopSource(); mPuller->interruptSource(); ALOGV("source (%s) stopped", mIsVideo ? "video" : "audio"); } signalEOS(); Loading Loading
media/libstagefright/MediaCodecSource.cpp +20 −7 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ const int kStopTimeoutUs = 300000; // allow 1 sec for shutting down encoder struct MediaCodecSource::Puller : public AHandler { Puller(const sp<MediaSource> &source); void interruptSource(); status_t start(const sp<MetaData> &meta, const sp<AMessage> ¬ify); void stop(); void stopSource(); Loading Loading @@ -186,14 +187,19 @@ void MediaCodecSource::Puller::stop() { } if (interrupt) { interruptSource(); } } void MediaCodecSource::Puller::interruptSource() { // call source->stop if read has been pending for over a second // TODO: we should really call this if kWhatStop has not returned for more than a second. // We have to call this outside the looper as looper is pending on the read. mSource->stop(); } } void MediaCodecSource::Puller::stopSource() { (new AMessage(kWhatStop, this))->post(); sp<AMessage> msg = new AMessage(kWhatStop, this); (void)postSynchronouslyAndReturnError(msg); } void MediaCodecSource::Puller::pause() { Loading Loading @@ -247,6 +253,13 @@ void MediaCodecSource::Puller::onMessageReceived(const sp<AMessage> &msg) { case kWhatStop: { mSource->stop(); sp<AMessage> response = new AMessage; response->setInt32("err", OK); sp<AReplyToken> replyID; CHECK(msg->senderAwaitsResponse(&replyID)); response->postReply(replyID); break; } Loading Loading @@ -915,7 +928,7 @@ void MediaCodecSource::onMessageReceived(const sp<AMessage> &msg) { if (!(mFlags & FLAG_USE_SURFACE_INPUT)) { ALOGV("source (%s) stopping", mIsVideo ? "video" : "audio"); mPuller->stopSource(); mPuller->interruptSource(); ALOGV("source (%s) stopped", mIsVideo ? "video" : "audio"); } signalEOS(); Loading