summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Sears <bsears@google.com>2015-04-01 05:24:58 +0000
committerBart Sears <bsears@google.com>2015-04-01 05:26:22 +0000
commit4de725a32a825bd26d9fc0ec6901ffffa92778e1 (patch)
treee948ba71284ce1b2d415c0e427d8d039af9786c3
parent148de97b1f497516cad2018af22b7a05a8be87c1 (diff)
downloadframeworks_av-4de725a32a825bd26d9fc0ec6901ffffa92778e1.zip
frameworks_av-4de725a32a825bd26d9fc0ec6901ffffa92778e1.tar.gz
frameworks_av-4de725a32a825bd26d9fc0ec6901ffffa92778e1.tar.bz2
Revert "mediaplayer: ensure secure decoders are instantiated before starting source"
Reverting a CL that auto-merged from lmp-mr1-dev This reverts commit 68fca636ac961c181ee71a49f151c71b564258d0. Change-Id: I797955c4745710452516b0d487529c95e2d1893e
-rw-r--r--media/libmediaplayerservice/nuplayer/GenericSource.cpp43
-rw-r--r--media/libmediaplayerservice/nuplayer/GenericSource.h4
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp74
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.h2
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerSource.h2
5 files changed, 14 insertions, 111 deletions
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index c234013..a040343 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -265,12 +265,6 @@ status_t NuPlayer::GenericSource::initFromDataSource() {
}
}
- mBitrate = totalBitrate;
-
- return OK;
-}
-
-status_t NuPlayer::GenericSource::startSources() {
// Start the selected A/V tracks now before we start buffering.
// Widevine sources might re-initialize crypto when starting, if we delay
// this to start(), all data buffered during prepare would be wasted.
@@ -285,6 +279,8 @@ status_t NuPlayer::GenericSource::startSources() {
return UNKNOWN_ERROR;
}
+ mBitrate = totalBitrate;
+
return OK;
}
@@ -419,32 +415,6 @@ void NuPlayer::GenericSource::onPrepareAsync() {
| FLAG_CAN_SEEK_FORWARD
| FLAG_CAN_SEEK);
- if (mIsSecure) {
- // secure decoders must be instantiated before starting widevine source
- sp<AMessage> reply = new AMessage(kWhatSecureDecodersInstantiated, id());
- notifyInstantiateSecureDecoders(reply);
- } else {
- finishPrepareAsync();
- }
-}
-
-void NuPlayer::GenericSource::onSecureDecodersInstantiated(status_t err) {
- if (err != OK) {
- ALOGE("Failed to instantiate secure decoders!");
- notifyPreparedAndCleanup(err);
- return;
- }
- finishPrepareAsync();
-}
-
-void NuPlayer::GenericSource::finishPrepareAsync() {
- status_t err = startSources();
- if (err != OK) {
- ALOGE("Failed to init start data source!");
- notifyPreparedAndCleanup(err);
- return;
- }
-
if (mIsStreaming) {
mPrepareBuffering = true;
@@ -460,7 +430,6 @@ void NuPlayer::GenericSource::notifyPreparedAndCleanup(status_t err) {
mDataSource.clear();
mCachedSource.clear();
mHttpSource.clear();
- mBitrate = -1;
cancelPollBuffering();
}
@@ -836,14 +805,6 @@ void NuPlayer::GenericSource::onMessageReceived(const sp<AMessage> &msg) {
break;
}
- case kWhatSecureDecodersInstantiated:
- {
- int32_t err;
- CHECK(msg->findInt32("err", &err));
- onSecureDecodersInstantiated(err);
- break;
- }
-
case kWhatStopWidevine:
{
// mStopRead is only used for Widevine to prevent the video source
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.h b/media/libmediaplayerservice/nuplayer/GenericSource.h
index 862ee5f..5fc41ec 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.h
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.h
@@ -96,7 +96,6 @@ private:
kWhatStopWidevine,
kWhatStart,
kWhatResume,
- kWhatSecureDecodersInstantiated,
};
struct Track {
@@ -159,9 +158,6 @@ private:
void setDrmPlaybackStatusIfNeeded(int playbackStatus, int64_t position);
void notifyPreparedAndCleanup(status_t err);
- void onSecureDecodersInstantiated(status_t err);
- void finishPrepareAsync();
- status_t startSources();
void onGetFormatMeta(sp<AMessage> msg) const;
sp<MetaData> doGetFormatMeta(bool audio) const;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index cfa5258..f4d3794 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1021,41 +1021,23 @@ void NuPlayer::onResume() {
}
}
-status_t NuPlayer::onInstantiateSecureDecoders() {
- status_t err;
- if (!(mSourceFlags & Source::FLAG_SECURE)) {
- return BAD_TYPE;
- }
-
- if (mRenderer != NULL) {
- ALOGE("renderer should not be set when instantiating secure decoders");
- return UNKNOWN_ERROR;
- }
-
- // TRICKY: We rely on mRenderer being null, so that decoder does not start requesting
- // data on instantiation.
- if (mNativeWindow != NULL) {
- err = instantiateDecoder(false, &mVideoDecoder);
- if (err != OK) {
- return err;
- }
- }
-
- if (mAudioSink != NULL) {
- err = instantiateDecoder(true, &mAudioDecoder);
- if (err != OK) {
- return err;
- }
- }
- return OK;
-}
-
void NuPlayer::onStart() {
mOffloadAudio = false;
mAudioEOS = false;
mVideoEOS = false;
mStarted = true;
+ /* instantiate decoders now for secure playback */
+ if (mSourceFlags & Source::FLAG_SECURE) {
+ if (mNativeWindow != NULL) {
+ instantiateDecoder(false, &mVideoDecoder);
+ }
+
+ if (mAudioSink != NULL) {
+ instantiateDecoder(true, &mAudioDecoder);
+ }
+ }
+
mSource->start();
uint32_t flags = 0;
@@ -1408,7 +1390,7 @@ void NuPlayer::flushDecoder(bool audio, bool needShutdown) {
FlushStatus newStatus =
needShutdown ? FLUSHING_DECODER_SHUTDOWN : FLUSHING_DECODER;
- mFlushComplete[audio][false /* isDecoder */] = (mRenderer == NULL);
+ mFlushComplete[audio][false /* isDecoder */] = false;
mFlushComplete[audio][true /* isDecoder */] = false;
if (audio) {
ALOGE_IF(mFlushingAudio != NONE,
@@ -1693,23 +1675,6 @@ void NuPlayer::onSourceNotify(const sp<AMessage> &msg) {
CHECK(msg->findInt32("what", &what));
switch (what) {
- case Source::kWhatInstantiateSecureDecoders:
- {
- if (mSource == NULL) {
- // This is a stale notification from a source that was
- // asynchronously preparing when the client called reset().
- // We handled the reset, the source is gone.
- break;
- }
-
- sp<AMessage> reply;
- CHECK(msg->findMessage("reply", &reply));
- status_t err = onInstantiateSecureDecoders();
- reply->setInt32("err", err);
- reply->post();
- break;
- }
-
case Source::kWhatPrepared:
{
if (mSource == NULL) {
@@ -1722,14 +1687,6 @@ void NuPlayer::onSourceNotify(const sp<AMessage> &msg) {
int32_t err;
CHECK(msg->findInt32("err", &err));
- if (err != OK) {
- // shut down potential secure codecs in case client never calls reset
- mDeferredActions.push_back(
- new FlushDecoderAction(FLUSH_CMD_SHUTDOWN /* audio */,
- FLUSH_CMD_SHUTDOWN /* video */));
- processDeferredActions();
- }
-
sp<NuPlayerDriver> driver = mDriver.promote();
if (driver != NULL) {
// notify duration first, so that it's definitely set when
@@ -2014,13 +1971,6 @@ void NuPlayer::Source::notifyPrepared(status_t err) {
notify->post();
}
-void NuPlayer::Source::notifyInstantiateSecureDecoders(const sp<AMessage> &reply) {
- sp<AMessage> notify = dupNotify();
- notify->setInt32("what", kWhatInstantiateSecureDecoders);
- notify->setMessage("reply", reply);
- notify->post();
-}
-
void NuPlayer::Source::onMessageReceived(const sp<AMessage> & /* msg */) {
TRESPASS();
}
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.h b/media/libmediaplayerservice/nuplayer/NuPlayer.h
index 2bc20d7..a2cb53e 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.h
@@ -204,8 +204,6 @@ private:
status_t instantiateDecoder(bool audio, sp<DecoderBase> *decoder);
- status_t onInstantiateSecureDecoders();
-
void updateVideoSize(
const sp<AMessage> &inputFormat,
const sp<AMessage> &outputFormat = NULL);
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
index d9f14a2..5a8beb1 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerSource.h
@@ -55,7 +55,6 @@ struct NuPlayer::Source : public AHandler {
kWhatTimedTextData,
kWhatQueueDecoderShutdown,
kWhatDrmNoLicense,
- kWhatInstantiateSecureDecoders,
};
// The provides message is used to notify the player about various
@@ -126,7 +125,6 @@ protected:
void notifyFlagsChanged(uint32_t flags);
void notifyVideoSizeChanged(const sp<AMessage> &format = NULL);
- void notifyInstantiateSecureDecoders(const sp<AMessage> &reply);
void notifyPrepared(status_t err = OK);
private: