Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean updates from CM #3

Open
wants to merge 23 commits into
base: kk4.4-caf
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
43cffaf
effects: miscellaneous fixes
Sep 26, 2014
7910aa7
libstagefright: Handle INFO_FORMAT_CHANGED for dolby clips
Aug 11, 2014
ca1d49d
libstagefright: extend the interface to switch rtp transport
Jul 22, 2014
44a6edf
Support MPEG4 and H263 FourCC types in Matroska files
Aug 17, 2012
b428fc0
stagefright: Fix crash if PCM offload gets a null source
hyperb1iss Oct 20, 2014
ea5d683
media: Cleanup some unnecessary old code
hyperb1iss Oct 20, 2014
d523069
Remove potential cause of underrun.
Apr 29, 2014
fc4d726
Revert "libmedia: Add flag for non-native FAST tracks."
hyperb1iss Oct 20, 2014
c7ea3d0
Revert "stagefright: Disable HSR for now"
hyperb1iss Oct 22, 2014
869cfa7
libstagefright: HSR: Read framerate from HSR key
Mar 6, 2014
d480ab0
libstagefright: use appropriate hevc decoder on 8916 and 8939
Jun 20, 2014
7c84b93
camera: Always enable preview metadata
hyperb1iss Oct 27, 2014
9a1c61c
stagefright: Avoid querying time from AudioPlayer after audio EOS
Oct 16, 2014
9a0de06
surfacemediasource: Do not assume that onBuffersReleased means EOS
defer Oct 8, 2014
85f55f6
audio: handle events properly in AudioOutput::CallbackWrapper()
Jun 12, 2014
e305b6e
camera: Allow hardware/camera.h header to be overridden
intervigilium Oct 31, 2014
0c0ab80
libstagefright: Wrapper for FLAC CSIM decoder
Jan 10, 2014
7babd71
stagefright: Don't expose QTIFLAC definition unless enabled
hyperb1iss Nov 2, 2014
2698376
NuPlayer: use video hardware codec only
Sep 26, 2014
c3a33d9
stagefright: add an extra buffer to ANW's BUfferQueue
Nov 22, 2013
d7165d7
Solved problem with hanging decode call
Jan 30, 2014
c4a1f51
stagefright: Query PCM output format and fix bugs
hyperb1iss Oct 24, 2014
e31c44f
av: Various fixes and cleanups
arco Oct 25, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/media/stagefright/ExtendedCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ struct ExtendedCodec {
kPortIndexInput = 0,
kPortIndexOutput = 1
};

enum kHEVCCodecType{
kCodecType_None,
kCodecType_SWHEVC,
kCodecType_HWHEVC
};
static status_t convertMetaDataToMessage(
const sp<MetaData> &meta, sp<AMessage> *format);

Expand Down Expand Up @@ -145,6 +151,8 @@ struct ExtendedCodec {

static bool useHWAACDecoder(const char *mime, int channelCount);

static kHEVCCodecType useHEVCDecoder(const char *mime);

static bool isSourcePauseRequired(const char *componentName);

#if defined(ENABLE_AV_ENHANCEMENTS) || defined(ENABLE_OFFLOAD_ENHANCEMENTS)
Expand Down
2 changes: 2 additions & 0 deletions include/media/stagefright/OMXCodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ struct OMXCodec : public MediaSource,
status_t setDTSFormat(const sp<MetaData> &inputFormat);
status_t setFFmpegAudioFormat(const sp<MetaData> &inputFormat);

status_t getPCMOutputFormat(const sp<MetaData> &meta);

status_t allocateBuffers();
status_t allocateBuffersOnPort(OMX_U32 portIndex);
#ifdef USE_SAMSUNG_COLORFORMAT
Expand Down
11 changes: 10 additions & 1 deletion media/libeffects/factory/EffectsFactory.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ int addSubEffect(cnode *root)
return -EINVAL;
}
d = malloc(sizeof(effect_descriptor_t));
if (!d) {
ALOGE("failed to allocate effect descriptor");
return -EINVAL;
}

if (l->desc->get_descriptor(&uuid, d) != 0) {
char s[40];
uuidToString(&uuid, s, 40);
Expand Down Expand Up @@ -692,8 +697,12 @@ int loadEffect(cnode *root)
ALOGW("loadEffect() invalid uuid %s", node->value);
return -EINVAL;
}

d = malloc(sizeof(effect_descriptor_t));
if (!d) {
ALOGE("failed to allocate effect descriptor");
return -EINVAL;
}

if (l->desc->get_descriptor(&uuid, d) != 0) {
char s[40];
uuidToString(&uuid, s, 40);
Expand Down
6 changes: 1 addition & 5 deletions media/libmedia/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
endif
endif

ifneq ($(AUDIO_FEATURE_ENABLED_ULTRA_LOW_LATENCY),true)
LOCAL_CFLAGS += -DNATIVE_FAST_TRACKS_ONLY
endif

# for <cutils/atomic-inline.h>
LOCAL_CFLAGS += -DANDROID_SMP=$(if $(findstring true,$(TARGET_CPU_SMP)),1,0)
LOCAL_SRC_FILES += SingleStateQueue.cpp
Expand All @@ -101,7 +97,7 @@ endif #TARGET_ENABLE_AV_ENHANCEMENTS

#QTI Resampler
ifeq ($(call is-vendor-board-platform,QCOM),true)
ifeq ($(strip $(BOARD_USES_QCOM_RESAMPLER)),true)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXTN_RESAMPLER)),true)
LOCAL_CFLAGS += -DQTI_RESAMPLER
endif
endif
Expand Down
13 changes: 6 additions & 7 deletions media/libmedia/AudioRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,21 @@ status_t AudioRecord::set(
ALOGE("Invalid format %d", format);
return BAD_VALUE;
}
#ifdef QCOM_HARDWARE
#if defined(QCOM_HARDWARE) && !defined(QCOM_DIRECTTRACK)
if (format != AUDIO_FORMAT_PCM_16_BIT &&
!audio_is_compress_voip_format(format) &&
!audio_is_compress_capture_format(format)) {
#else
#ifndef QCOM_DIRECTTRACK
// Temporary restriction: AudioFlinger currently supports 16-bit PCM only
if (format != AUDIO_FORMAT_PCM_16_BIT) {
#endif
#endif
#ifndef QCOM_DIRECTTRACK
ALOGE("Format %d is not supported", format);
return BAD_VALUE;
}
#endif

mFormat = format;

Expand All @@ -222,12 +226,7 @@ status_t AudioRecord::set(
return BAD_VALUE;
}
mChannelMask = channelMask;
uint32_t channelCount = popcount(channelMask
#ifdef QCOM_HARDWARE
&(AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_5POINT1));
#else
);
#endif
uint32_t channelCount = popcount(channelMask);
mChannelCount = channelCount;

#ifdef QCOM_DIRECTTRACK
Expand Down
24 changes: 2 additions & 22 deletions media/libmedia/AudioTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ AudioTrack::~AudioTrack()
mAudioTrack.clear();
IPCThreadState::self()->flushCommands();
AudioSystem::releaseAudioSessionId(mSessionId);
if (isOffloaded()) {
char propValue[PROPERTY_VALUE_MAX];
bool prop_enabled = false;

if (property_get("audio.offload.multiple.enabled", propValue, NULL))
prop_enabled = atoi(propValue) || !strncmp("true", propValue, 4);

if (prop_enabled)
AudioSystem::releaseOutput(mOutput);
}
#endif
}
}
Expand Down Expand Up @@ -420,13 +410,15 @@ status_t AudioTrack::set(
}
#endif

#ifndef QCOM_DIRECTTRACK
if (audio_is_linear_pcm(format)) {
mFrameSize = channelCount * audio_bytes_per_sample(format);
mFrameSizeAF = channelCount * sizeof(int16_t);
} else {
mFrameSize = sizeof(uint8_t);
mFrameSizeAF = sizeof(uint8_t);
}
#endif

audio_io_handle_t output = AudioSystem::getOutput(
streamType,
Expand Down Expand Up @@ -1145,13 +1137,11 @@ status_t AudioTrack::createTrack_l(
}
ALOGV("createTrack_l() output %d afLatency %d", output, afLatency);

#ifdef NATIVE_FAST_TRACKS_ONLY
if ((flags & AUDIO_OUTPUT_FLAG_FAST) && sampleRate != afSampleRate) {
ALOGW("AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate (%d vs %d)",
sampleRate, afSampleRate);
flags = (audio_output_flags_t) (flags & ~AUDIO_OUTPUT_FLAG_FAST);
}
#endif

// The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where
// n = 1 fast track with single buffering; nBuffering is ignored
Expand Down Expand Up @@ -1892,16 +1882,6 @@ nsecs_t AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread)
return NS_NEVER;
}

if (mRetryOnPartialBuffer && !isOffloaded()) {
mRetryOnPartialBuffer = false;
if (avail < mRemainingFrames) {
int64_t myns = ((mRemainingFrames - avail) * 1100000000LL) / sampleRate;
if (ns < 0 || myns < ns) {
ns = myns;
}
return ns;
}
}

// Divide buffer size by 2 to take into account the expansion
// due to 8 to 16 bit conversion: the callback must fill only half
Expand Down
135 changes: 33 additions & 102 deletions media/libmediaplayerservice/MediaPlayerService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@ status_t MediaPlayerService::decode(const char* url, uint32_t *pSampleRate, int*
ALOGV("decode(%s)", url);
sp<MediaPlayerBase> player;
status_t status = BAD_VALUE;
status_t err = OK;

// Protect our precious, precious DRMd ringtones by only allowing
// decoding of http, but not filesystem paths or content Uris.
Expand Down Expand Up @@ -1246,7 +1247,11 @@ status_t MediaPlayerService::decode(const char* url, uint32_t *pSampleRate, int*
if (cache->wait() != NO_ERROR) goto Exit;

ALOGV("start");
player->start();
err = player->start();
if (err != NO_ERROR) {
ALOGE("Error: %d Starting player in decode", err);
goto Exit;
}

ALOGV("wait for playback complete");
cache->wait();
Expand Down Expand Up @@ -1276,6 +1281,7 @@ status_t MediaPlayerService::decode(int fd, int64_t offset, int64_t length,
ALOGV("decode(%d, %lld, %lld)", fd, offset, length);
sp<MediaPlayerBase> player;
status_t status = BAD_VALUE;
status_t err = OK;

player_type playerType = MediaPlayerFactory::getPlayerType(NULL /* client */,
fd,
Expand All @@ -1301,7 +1307,11 @@ status_t MediaPlayerService::decode(int fd, int64_t offset, int64_t length,
if (cache->wait() != NO_ERROR) goto Exit;

ALOGV("start");
player->start();
err = player->start();
if (err != NO_ERROR) {
ALOGE("Error: %d Starting player in decode", err);
goto Exit;
}

ALOGV("wait for playback complete");
cache->wait();
Expand Down Expand Up @@ -1852,102 +1862,6 @@ status_t MediaPlayerService::AudioOutput::attachAuxEffect(int effectId)
}

// static
#ifdef QCOM_DIRECTTRACK
void MediaPlayerService::AudioOutput::CallbackWrapper(
int event, void *cookie, void *info) {
//ALOGV("callbackwrapper");
if (event == AudioTrack::EVENT_UNDERRUN) {
ALOGW("Event underrun");
CallbackData *data = (CallbackData*)cookie;
data->lock();
AudioOutput *me = data->getOutput();
if (me == NULL) {
// no output set, likely because the track was scheduled to be reused
// by another player, but the format turned out to be incompatible.
data->unlock();
return;
}
ALOGD("Callback!!!");
(*me->mCallback)(
me, NULL, (size_t)AudioTrack::EVENT_UNDERRUN, me->mCallbackCookie, CB_EVENT_UNDERRUN);
data->unlock();
return;
}
if (event == AudioTrack::EVENT_HW_FAIL) {
ALOGW("Event hardware failure");
CallbackData *data = (CallbackData*)cookie;
if (data != NULL) {
data->lock();
AudioOutput *me = data->getOutput();
if (me == NULL) {
// no output set, likely because the track was
// scheduled to be reused
// by another player, but the format turned out
// to be incompatible.
data->unlock();
return;
}
ALOGV("Callback!!!");
(*me->mCallback)(me, NULL, (size_t)AudioTrack::EVENT_HW_FAIL,
me->mCallbackCookie, CB_EVENT_HW_FAIL);
data->unlock();
}
return;
}
if (event == AudioTrack::EVENT_MORE_DATA) {
CallbackData *data = (CallbackData*)cookie;
data->lock();
AudioOutput *me = data->getOutput();
AudioTrack::Buffer *buffer = (AudioTrack::Buffer *)info;
if (me == NULL) {
// no output set, likely because the track was scheduled to be reused
// by another player, but the format turned out to be incompatible.
data->unlock();
if (buffer != NULL) {
buffer->size = 0;
}
return;
}

switch(event) {
case AudioTrack::EVENT_MORE_DATA: {
size_t actualSize = (*me->mCallback)(
me, buffer->raw, buffer->size, me->mCallbackCookie,
CB_EVENT_FILL_BUFFER);

if (actualSize == 0 && buffer->size > 0 && me->mNextOutput == NULL) {
// We've reached EOS but the audio track is not stopped yet,
// keep playing silence.

memset(buffer->raw, 0, buffer->size);
actualSize = buffer->size;
}

buffer->size = actualSize;
} break;


case AudioTrack::EVENT_STREAM_END:
ALOGV("callbackwrapper: deliver EVENT_STREAM_END");
(*me->mCallback)(me, NULL /* buffer */, 0 /* size */,
me->mCallbackCookie, CB_EVENT_STREAM_END);
break;

case AudioTrack::EVENT_NEW_IAUDIOTRACK :
ALOGV("callbackwrapper: deliver EVENT_TEAR_DOWN");
(*me->mCallback)(me, NULL /* buffer */, 0 /* size */,
me->mCallbackCookie, CB_EVENT_TEAR_DOWN);
break;

default:
ALOGE("received unknown event type: %d inside CallbackWrapper !", event);
}

data->unlock();
}
return;
}
#else
void MediaPlayerService::AudioOutput::CallbackWrapper(
int event, void *cookie, void *info) {
//ALOGV("callbackwrapper");
Expand All @@ -1966,13 +1880,31 @@ void MediaPlayerService::AudioOutput::CallbackWrapper(
}

switch(event) {
#ifdef QCOM_DIRECTTRACK
case AudioTrack::EVENT_UNDERRUN:
ALOGW("Event underrun");
(*me->mCallback)(
me, NULL, (size_t)AudioTrack::EVENT_UNDERRUN, me->mCallbackCookie, CB_EVENT_UNDERRUN);
break;

case AudioTrack::EVENT_HW_FAIL:
ALOGW("Event hardware failure");
(*me->mCallback)(me, NULL, (size_t)AudioTrack::EVENT_HW_FAIL,
me->mCallbackCookie, CB_EVENT_HW_FAIL);
break;
#endif

case AudioTrack::EVENT_MORE_DATA: {
size_t actualSize = (*me->mCallback)(
me, buffer->raw, buffer->size, me->mCallbackCookie,
CB_EVENT_FILL_BUFFER);

if (actualSize == 0 && buffer->size > 0 && me->mNextOutput == NULL &&
(me->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) {
if (actualSize == 0 && buffer->size > 0 && me->mNextOutput == NULL
#ifndef QCOM_DIRECTTRACK
&& (me->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) {
#else
) {
#endif
// We've reached EOS but the audio track is not stopped yet,
// keep playing silence.

Expand All @@ -1989,7 +1921,7 @@ void MediaPlayerService::AudioOutput::CallbackWrapper(
me->mCallbackCookie, CB_EVENT_STREAM_END);
break;

case AudioTrack::EVENT_NEW_IAUDIOTRACK :
case AudioTrack::EVENT_NEW_IAUDIOTRACK:
ALOGV("callbackwrapper: deliver EVENT_TEAR_DOWN");
(*me->mCallback)(me, NULL /* buffer */, 0 /* size */,
me->mCallbackCookie, CB_EVENT_TEAR_DOWN);
Expand All @@ -2001,7 +1933,6 @@ void MediaPlayerService::AudioOutput::CallbackWrapper(

data->unlock();
}
#endif

int MediaPlayerService::AudioOutput::getSessionId() const
{
Expand Down
Loading