merge in nyc-dr1-release history after reset to nyc-mr1-dev
diff --git a/include/media/IMediaExtractor.h b/include/media/IMediaExtractor.h
index d9fcd89..34b15e9 100644
--- a/include/media/IMediaExtractor.h
+++ b/include/media/IMediaExtractor.h
@@ -19,7 +19,7 @@
#define IMEDIA_EXTRACTOR_BASE_H_
#include <media/IMediaSource.h>
-#include <media/IDataSource.h>
+#include <media/stagefright/DataSource.h>
namespace android {
@@ -72,7 +72,7 @@
void registerMediaExtractor(
const sp<IMediaExtractor> &extractor,
- const sp<IDataSource> &source,
+ const sp<DataSource> &source,
const char *mime);
void registerMediaSource(
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index f6d5f12..d14bb7b 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -271,6 +271,7 @@
bool mFatalError;
bool mShutdownInProgress;
bool mExplicitShutdown;
+ bool mIsLegacyVP9Decoder;
// If "mKeepComponentAllocated" we only transition back to Loaded state
// and do not release the component instance.
diff --git a/media/libmedia/IMediaExtractor.cpp b/media/libmedia/IMediaExtractor.cpp
index f142ccc..e8ad75b 100644
--- a/media/libmedia/IMediaExtractor.cpp
+++ b/media/libmedia/IMediaExtractor.cpp
@@ -239,7 +239,7 @@
void registerMediaExtractor(
const sp<IMediaExtractor> &extractor,
- const sp<IDataSource> &source,
+ const sp<DataSource> &source,
const char *mime) {
ExtractorInstance ex;
ex.mime = mime == NULL ? "NULL" : mime;
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 7d3c671..35f439b 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -640,6 +640,28 @@
return p;
}
+MediaPlayerService::Client::ServiceDeathNotifier::ServiceDeathNotifier(
+ const sp<IBinder>& service,
+ const sp<MediaPlayerBase>& listener,
+ int which) {
+ mService = service;
+ mListener = listener;
+ mWhich = which;
+}
+
+MediaPlayerService::Client::ServiceDeathNotifier::~ServiceDeathNotifier() {
+ mService->unlinkToDeath(this);
+}
+
+void MediaPlayerService::Client::ServiceDeathNotifier::binderDied(const wp<IBinder>& /*who*/) {
+ sp<MediaPlayerBase> listener = mListener.promote();
+ if (listener != NULL) {
+ listener->sendEvent(MEDIA_ERROR, MEDIA_ERROR_SERVER_DIED, mWhich);
+ } else {
+ ALOGW("listener for process %d death is gone", mWhich);
+ }
+}
+
sp<MediaPlayerBase> MediaPlayerService::Client::setDataSource_pre(
player_type playerType)
{
@@ -651,6 +673,19 @@
return p;
}
+ sp<IServiceManager> sm = defaultServiceManager();
+ sp<IBinder> binder = sm->getService(String16("media.extractor"));
+ mExtractorDeathListener = new ServiceDeathNotifier(binder, p, MEDIAEXTRACTOR_PROCESS_DEATH);
+ binder->linkToDeath(mExtractorDeathListener);
+
+ binder = sm->getService(String16("media.codec"));
+ mCodecDeathListener = new ServiceDeathNotifier(binder, p, MEDIACODEC_PROCESS_DEATH);
+ binder->linkToDeath(mCodecDeathListener);
+
+ binder = sm->getService(String16("media.audio_flinger"));
+ mAudioDeathListener = new ServiceDeathNotifier(binder, p, AUDIO_PROCESS_DEATH);
+ binder->linkToDeath(mAudioDeathListener);
+
if (!p->hardwareOutput()) {
Mutex::Autolock l(mLock);
mAudioOutput = new AudioOutput(mAudioSessionId, IPCThreadState::self()->getCallingUid(),
diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h
index 1cf648e..0ecfdbc 100644
--- a/media/libmediaplayerservice/MediaPlayerService.h
+++ b/media/libmediaplayerservice/MediaPlayerService.h
@@ -227,6 +227,14 @@
void removeClient(wp<Client> client);
+ enum {
+ MEDIASERVER_PROCESS_DEATH = 0,
+ MEDIAEXTRACTOR_PROCESS_DEATH = 1,
+ MEDIACODEC_PROCESS_DEATH = 2,
+ AUDIO_PROCESS_DEATH = 3,
+ CAMERA_PROCESS_DEATH = 4
+ };
+
// For battery usage tracking purpose
struct BatteryUsageInfo {
// how many streams are being played by one UID
@@ -334,6 +342,22 @@
audio_session_t getAudioSessionId() { return mAudioSessionId; }
private:
+ class ServiceDeathNotifier: public IBinder::DeathRecipient
+ {
+ public:
+ ServiceDeathNotifier(
+ const sp<IBinder>& service,
+ const sp<MediaPlayerBase>& listener,
+ int which);
+ virtual ~ServiceDeathNotifier();
+ virtual void binderDied(const wp<IBinder>& who);
+
+ private:
+ int mWhich;
+ sp<IBinder> mService;
+ wp<MediaPlayerBase> mListener;
+ };
+
friend class MediaPlayerService;
Client( const sp<MediaPlayerService>& service,
pid_t pid,
@@ -393,6 +417,9 @@
// getMetadata clears this set.
media::Metadata::Filter mMetadataUpdated; // protected by mLock
+ sp<IBinder::DeathRecipient> mExtractorDeathListener;
+ sp<IBinder::DeathRecipient> mCodecDeathListener;
+ sp<IBinder::DeathRecipient> mAudioDeathListener;
#if CALLBACK_ANTAGONIZER
Antagonizer* mAntagonizer;
#endif
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index 3152e04..2832166 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -335,6 +335,28 @@
release();
}
+MediaRecorderClient::ServiceDeathNotifier::ServiceDeathNotifier(
+ const sp<IBinder>& service,
+ const sp<IMediaRecorderClient>& listener,
+ int which) {
+ mService = service;
+ mListener = listener;
+ mWhich = which;
+}
+
+MediaRecorderClient::ServiceDeathNotifier::~ServiceDeathNotifier() {
+ mService->unlinkToDeath(this);
+}
+
+void MediaRecorderClient::ServiceDeathNotifier::binderDied(const wp<IBinder>& /*who*/) {
+ sp<IMediaRecorderClient> listener = mListener.promote();
+ if (listener != NULL) {
+ listener->notify(MEDIA_ERROR, MEDIA_ERROR_SERVER_DIED, mWhich);
+ } else {
+ ALOGW("listener for process %d death is gone", mWhich);
+ }
+}
+
status_t MediaRecorderClient::setListener(const sp<IMediaRecorderClient>& listener)
{
ALOGV("setListener");
@@ -343,7 +365,25 @@
ALOGE("recorder is not initialized");
return NO_INIT;
}
- return mRecorder->setListener(listener);
+ mRecorder->setListener(listener);
+
+ sp<IServiceManager> sm = defaultServiceManager();
+ sp<IBinder> binder = sm->getService(String16("media.camera"));
+ mCameraDeathListener = new ServiceDeathNotifier(binder, listener,
+ MediaPlayerService::CAMERA_PROCESS_DEATH);
+ binder->linkToDeath(mCameraDeathListener);
+
+ binder = sm->getService(String16("media.codec"));
+ mCodecDeathListener = new ServiceDeathNotifier(binder, listener,
+ MediaPlayerService::MEDIACODEC_PROCESS_DEATH);
+ binder->linkToDeath(mCodecDeathListener);
+
+ binder = sm->getService(String16("media.audio_flinger"));
+ mAudioDeathListener = new ServiceDeathNotifier(binder, listener,
+ MediaPlayerService::AUDIO_PROCESS_DEATH);
+ binder->linkToDeath(mAudioDeathListener);
+
+ return OK;
}
status_t MediaRecorderClient::setClientName(const String16& clientName) {
diff --git a/media/libmediaplayerservice/MediaRecorderClient.h b/media/libmediaplayerservice/MediaRecorderClient.h
index 5a080df..6e70194 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.h
+++ b/media/libmediaplayerservice/MediaRecorderClient.h
@@ -29,6 +29,22 @@
class MediaRecorderClient : public BnMediaRecorder
{
+ class ServiceDeathNotifier: public IBinder::DeathRecipient
+ {
+ public:
+ ServiceDeathNotifier(
+ const sp<IBinder>& service,
+ const sp<IMediaRecorderClient>& listener,
+ int which);
+ virtual ~ServiceDeathNotifier();
+ virtual void binderDied(const wp<IBinder>& who);
+
+ private:
+ int mWhich;
+ sp<IBinder> mService;
+ wp<IMediaRecorderClient> mListener;
+ };
+
public:
virtual status_t setCamera(const sp<hardware::ICamera>& camera,
const sp<ICameraRecordingProxy>& proxy);
@@ -69,6 +85,10 @@
const String16& opPackageName);
virtual ~MediaRecorderClient();
+ sp<IBinder::DeathRecipient> mCameraDeathListener;
+ sp<IBinder::DeathRecipient> mCodecDeathListener;
+ sp<IBinder::DeathRecipient> mAudioDeathListener;
+
pid_t mPid;
Mutex mLock;
MediaRecorderBase *mRecorder;
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index f159882..b2b0879 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -503,6 +503,7 @@
mFatalError(false),
mShutdownInProgress(false),
mExplicitShutdown(false),
+ mIsLegacyVP9Decoder(false),
mEncoderDelay(0),
mEncoderPadding(0),
mRotationDegrees(0),
@@ -3133,6 +3134,20 @@
return err;
}
+ if (compressionFormat == OMX_VIDEO_CodingVP9) {
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE params;
+ InitOMXParams(¶ms);
+ params.nPortIndex = kPortIndexInput;
+ // Check if VP9 decoder advertises supported profiles.
+ params.nProfileIndex = 0;
+ status_t err = mOMX->getParameter(
+ mNode,
+ OMX_IndexParamVideoProfileLevelQuerySupported,
+ ¶ms,
+ sizeof(params));
+ mIsLegacyVP9Decoder = err != OK;
+ }
+
err = setVideoPortFormatType(
kPortIndexInput, compressionFormat, OMX_COLOR_FormatUnused);
@@ -5685,6 +5700,12 @@
int32_t isCSD;
if (buffer->meta()->findInt32("csd", &isCSD) && isCSD != 0) {
+ if (mCodec->mIsLegacyVP9Decoder) {
+ ALOGV("[%s] is legacy VP9 decoder. Ignore %u codec specific data",
+ mCodec->mComponentName.c_str(), bufferID);
+ postFillThisBuffer(info);
+ break;
+ }
flags |= OMX_BUFFERFLAG_CODECCONFIG;
}
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f5549e4..f296d9a 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1560,12 +1560,29 @@
// Calculate average frame rate.
if (!strncasecmp("video/", mime, 6)) {
size_t nSamples = mLastTrack->sampleTable->countSamples();
- int64_t durationUs;
- if (mLastTrack->meta->findInt64(kKeyDuration, &durationUs)) {
- if (durationUs > 0) {
- int32_t frameRate = (nSamples * 1000000LL +
- (durationUs >> 1)) / durationUs;
- mLastTrack->meta->setInt32(kKeyFrameRate, frameRate);
+ if (nSamples == 0) {
+ int32_t trackId;
+ if (mLastTrack->meta->findInt32(kKeyTrackID, &trackId)) {
+ for (size_t i = 0; i < mTrex.size(); i++) {
+ Trex *t = &mTrex.editItemAt(i);
+ if (t->track_ID == (uint32_t) trackId) {
+ if (t->default_sample_duration > 0) {
+ int32_t frameRate =
+ mLastTrack->timescale / t->default_sample_duration;
+ mLastTrack->meta->setInt32(kKeyFrameRate, frameRate);
+ }
+ break;
+ }
+ }
+ }
+ } else {
+ int64_t durationUs;
+ if (mLastTrack->meta->findInt64(kKeyDuration, &durationUs)) {
+ if (durationUs > 0) {
+ int32_t frameRate = (nSamples * 1000000LL +
+ (durationUs >> 1)) / durationUs;
+ mLastTrack->meta->setInt32(kKeyFrameRate, frameRate);
+ }
}
}
}
@@ -2929,7 +2946,7 @@
int32_t trackId;
if (track->meta->findInt32(kKeyTrackID, &trackId)) {
for (size_t i = 0; i < mTrex.size(); i++) {
- Trex *t = &mTrex.editItemAt(index);
+ Trex *t = &mTrex.editItemAt(i);
if (t->track_ID == (uint32_t) trackId) {
trex = t;
break;
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index ca1a0b7..1d575b3 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -2108,8 +2108,8 @@
audio_is_linear_pcm(config->format) &&
audio_is_linear_pcm(halconfig.format) &&
(halconfig.sample_rate <= AUDIO_RESAMPLER_DOWN_RATIO_MAX * config->sample_rate) &&
- (audio_channel_count_from_in_mask(halconfig.channel_mask) <= FCC_2) &&
- (audio_channel_count_from_in_mask(config->channel_mask) <= FCC_2)) {
+ (audio_channel_count_from_in_mask(halconfig.channel_mask) <= FCC_8) &&
+ (audio_channel_count_from_in_mask(config->channel_mask) <= FCC_8)) {
// FIXME describe the change proposed by HAL (save old values so we can log them here)
ALOGV("openInput_l() reopening with proposed sampling rate and channel mask");
inStream = NULL;
diff --git a/services/mediaextractor/MediaExtractorService.cpp b/services/mediaextractor/MediaExtractorService.cpp
index 0c93af1..4a80166 100644
--- a/services/mediaextractor/MediaExtractorService.cpp
+++ b/services/mediaextractor/MediaExtractorService.cpp
@@ -39,7 +39,7 @@
ret == NULL ? "" : ret->name());
if (ret != NULL) {
- registerMediaExtractor(ret, remoteSource, mime);
+ registerMediaExtractor(ret, localSource, mime);
}
return ret;