Loading media/libmediaplayerservice/nuplayer/NuPlayer.cpp +17 −7 Original line number Diff line number Diff line Loading @@ -1347,26 +1347,26 @@ void NuPlayer::onStart(int64_t startPositionUs, MediaPlayerSeekMode mode) { flags |= Renderer::FLAG_REAL_TIME; } sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */); sp<MetaData> videoMeta = mSource->getFormatMeta(false /* audio */); if (audioMeta == NULL && videoMeta == NULL) { bool hasAudio = (mSource->getFormat(true /* audio */) != NULL); bool hasVideo = (mSource->getFormat(false /* audio */) != NULL); if (!hasAudio && !hasVideo) { ALOGE("no metadata for either audio or video source"); mSource->stop(); mSourceStarted = false; notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_MALFORMED); return; } ALOGV_IF(audioMeta == NULL, "no metadata for audio source"); // video only stream ALOGV_IF(!hasAudio, "no metadata for audio source"); // video only stream sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */); audio_stream_type_t streamType = AUDIO_STREAM_MUSIC; if (mAudioSink != NULL) { streamType = mAudioSink->getAudioStreamType(); } sp<AMessage> videoFormat = mSource->getFormat(false /* audio */); mOffloadAudio = canOffloadStream(audioMeta, (videoFormat != NULL), mSource->isStreaming(), streamType) canOffloadStream(audioMeta, hasVideo, mSource->isStreaming(), streamType) && (mPlaybackSettings.mSpeed == 1.f && mPlaybackSettings.mPitch == 1.f); if (mOffloadAudio) { flags |= Renderer::FLAG_OFFLOAD_AUDIO; Loading Loading @@ -1714,6 +1714,16 @@ void NuPlayer::updateVideoSize( notifyListener(MEDIA_SET_VIDEO_SIZE, 0, 0); return; } int32_t err = OK; inputFormat->findInt32("err", &err); if (err == -EWOULDBLOCK) { ALOGW("Video meta is not available yet!"); return; } if (err != OK) { ALOGW("Something is wrong with video meta!"); return; } int32_t displayWidth, displayHeight; if (outputFormat != NULL) { Loading media/libmediaplayerservice/nuplayer/NuPlayerSource.h +4 −0 Original line number Diff line number Diff line Loading @@ -77,7 +77,11 @@ struct NuPlayer::Source : public AHandler { // an error or ERROR_END_OF_STREAM if not. virtual status_t feedMoreTSData() = 0; // Returns non-NULL format when the specified track exists. // When the format has "err" set to -EWOULDBLOCK, source needs more time to get valid meta data. // Returns NULL if the specified track doesn't exist or is invalid; virtual sp<AMessage> getFormat(bool audio); virtual sp<MetaData> getFormatMeta(bool /* audio */) { return NULL; } virtual sp<MetaData> getFileFormatMeta() const { return NULL; } Loading media/libmediaplayerservice/nuplayer/StreamingSource.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -234,8 +234,7 @@ sp<AMessage> NuPlayer::StreamingSource::getFormat(bool audio) { } status_t err = convertMetaDataToMessage(meta, &format); if (err != OK) { // format may have been cleared on error format = new AMessage; format->setInt32("err", err); return NULL; } return format; } Loading Loading
media/libmediaplayerservice/nuplayer/NuPlayer.cpp +17 −7 Original line number Diff line number Diff line Loading @@ -1347,26 +1347,26 @@ void NuPlayer::onStart(int64_t startPositionUs, MediaPlayerSeekMode mode) { flags |= Renderer::FLAG_REAL_TIME; } sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */); sp<MetaData> videoMeta = mSource->getFormatMeta(false /* audio */); if (audioMeta == NULL && videoMeta == NULL) { bool hasAudio = (mSource->getFormat(true /* audio */) != NULL); bool hasVideo = (mSource->getFormat(false /* audio */) != NULL); if (!hasAudio && !hasVideo) { ALOGE("no metadata for either audio or video source"); mSource->stop(); mSourceStarted = false; notifyListener(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_MALFORMED); return; } ALOGV_IF(audioMeta == NULL, "no metadata for audio source"); // video only stream ALOGV_IF(!hasAudio, "no metadata for audio source"); // video only stream sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */); audio_stream_type_t streamType = AUDIO_STREAM_MUSIC; if (mAudioSink != NULL) { streamType = mAudioSink->getAudioStreamType(); } sp<AMessage> videoFormat = mSource->getFormat(false /* audio */); mOffloadAudio = canOffloadStream(audioMeta, (videoFormat != NULL), mSource->isStreaming(), streamType) canOffloadStream(audioMeta, hasVideo, mSource->isStreaming(), streamType) && (mPlaybackSettings.mSpeed == 1.f && mPlaybackSettings.mPitch == 1.f); if (mOffloadAudio) { flags |= Renderer::FLAG_OFFLOAD_AUDIO; Loading Loading @@ -1714,6 +1714,16 @@ void NuPlayer::updateVideoSize( notifyListener(MEDIA_SET_VIDEO_SIZE, 0, 0); return; } int32_t err = OK; inputFormat->findInt32("err", &err); if (err == -EWOULDBLOCK) { ALOGW("Video meta is not available yet!"); return; } if (err != OK) { ALOGW("Something is wrong with video meta!"); return; } int32_t displayWidth, displayHeight; if (outputFormat != NULL) { Loading
media/libmediaplayerservice/nuplayer/NuPlayerSource.h +4 −0 Original line number Diff line number Diff line Loading @@ -77,7 +77,11 @@ struct NuPlayer::Source : public AHandler { // an error or ERROR_END_OF_STREAM if not. virtual status_t feedMoreTSData() = 0; // Returns non-NULL format when the specified track exists. // When the format has "err" set to -EWOULDBLOCK, source needs more time to get valid meta data. // Returns NULL if the specified track doesn't exist or is invalid; virtual sp<AMessage> getFormat(bool audio); virtual sp<MetaData> getFormatMeta(bool /* audio */) { return NULL; } virtual sp<MetaData> getFileFormatMeta() const { return NULL; } Loading
media/libmediaplayerservice/nuplayer/StreamingSource.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -234,8 +234,7 @@ sp<AMessage> NuPlayer::StreamingSource::getFormat(bool audio) { } status_t err = convertMetaDataToMessage(meta, &format); if (err != OK) { // format may have been cleared on error format = new AMessage; format->setInt32("err", err); return NULL; } return format; } Loading