diff options
Diffstat (limited to 'media')
| -rw-r--r-- | media/libavextensions/stagefright/AVUtils.cpp | 6 | ||||
| -rw-r--r-- | media/libmedia/ICrypto.cpp | 4 | ||||
| -rw-r--r-- | media/libmedia/ToneGenerator.cpp | 6 | ||||
| -rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 17 | ||||
| -rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 7 | ||||
| -rw-r--r-- | media/libstagefright/ACodec.cpp | 22 | ||||
| -rw-r--r-- | media/libstagefright/CameraSource.cpp | 12 | ||||
| -rw-r--r-- | media/libstagefright/MediaCodec.cpp | 2 | ||||
| -rw-r--r-- | media/libstagefright/StagefrightMetadataRetriever.cpp | 3 | ||||
| -rw-r--r-- | media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp | 9 | ||||
| -rw-r--r-- | media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp | 9 | 
11 files changed, 73 insertions, 24 deletions
diff --git a/media/libavextensions/stagefright/AVUtils.cpp b/media/libavextensions/stagefright/AVUtils.cpp index bdf5eb6..413026b 100644 --- a/media/libavextensions/stagefright/AVUtils.cpp +++ b/media/libavextensions/stagefright/AVUtils.cpp @@ -448,7 +448,7 @@ status_t AVUtils::HEVCMuxer::makeHEVCCodecSpecificData(      List<HEVCParamSet> picParamSets;      if ((*codecSpecificDataSize = parseHEVCCodecSpecificData(data, size, -                                   vidParamSets, seqParamSets, picParamSets)) <= 0) { +                                   vidParamSets, seqParamSets, picParamSets)) == 0) {          ALOGE("cannot parser codec specific data, bailing out");          return ERROR_MALFORMED;      } @@ -885,12 +885,12 @@ size_t AVUtils::HEVCMuxer::parseHEVCCodecSpecificData(              }          } else {              ALOGE("Only VPS, SPS and PPS Nal units are expected"); -            return ERROR_MALFORMED; +            return 0;          }          if (nextStartCode == NULL) {              ALOGE("Next start code is NULL"); -            return ERROR_MALFORMED; +            return 0;          }          // Move on to find the next parameter set diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp index 5d822cf..bc696ca 100644 --- a/media/libmedia/ICrypto.cpp +++ b/media/libmedia/ICrypto.cpp @@ -325,7 +325,9 @@ status_t BnCrypto::onTransact(              if (overflow || sumSubsampleSizes != totalSize) {                  result = -EINVAL; -            } else if (offset + totalSize > sharedBuffer->size()) { +            } else if (totalSize > sharedBuffer->size()) { +                result = -EINVAL; +            } else if ((size_t)offset > sharedBuffer->size() - totalSize) {                  result = -EINVAL;              } else {                  result = decrypt( diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp index d738ea7..af75e0f 100644 --- a/media/libmedia/ToneGenerator.cpp +++ b/media/libmedia/ToneGenerator.cpp @@ -698,7 +698,11 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = {            { .segments = { { .duration = 0, .waveFreq = { 0 }, 0, 0 }},            .repeatCnt = 0,            .repeatSegment = 0 },                            // TONE_CDMA_SIGNAL_OFF - +        { .segments = { { .duration = 15000, .waveFreq = { 0 }, 0, 0 }, +                      { .duration = 500, .waveFreq = { 450, 0 }, 0, 0 }, +                      { .duration = 0 , .waveFreq = { 0 }, 0, 0}}, +          .repeatCnt = ToneGenerator::TONEGEN_INF, +          .repeatSegment = 0 },                              // TONE_HOLD_RECALL          { .segments = { { .duration = ToneGenerator::TONEGEN_INF, .waveFreq = { 350, 440, 0 }, 0, 0 },                          { .duration = 0 , .waveFreq = { 0 }, 0, 0}},            .repeatCnt = ToneGenerator::TONEGEN_INF, diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index 7c71e4e..4383fce 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -750,12 +750,19 @@ void NuPlayerDriver::notifyListener_l(                      }                  }                  if (mLooping || mAutoLoop) { -                    mPlayer->seekToAsync(0); -                    if (mAudioSink != NULL) { -                        // The renderer has stopped the sink at the end in order to play out -                        // the last little bit of audio. If we're looping, we need to restart it. -                        mAudioSink->start(); +                    if (mState == STATE_RUNNING) { +                        mPlayer->seekToAsync(0); +                        if (mAudioSink != NULL) { +                            // The renderer has stopped the sink at the end in order to play out +                            // the last little bit of audio. If we're looping, we need to restart it. +                            mAudioSink->start(); +                        } +                    } else { +                        mPlayer->pause(); +                        mState = STATE_PAUSED; +                        mAtEOS = true;                      } +                      // don't send completion event when looping                      return;                  } diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index d959e62..2336eb7 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -1590,6 +1590,13 @@ void NuPlayer::Renderer::onResume() {              ALOGD("received error :%d on resume for offload track posting TEAR_DOWN event",status);              notifyAudioTearDown();          } +        //Update anchor time after resuming playback. +        if (offloadingAudio()) { +            int64_t nowUs = ALooper::GetNowUs(); +            int64_t nowMediaUs = +                mAudioFirstAnchorTimeMediaUs + getPlayedOutAudioDurationUs(nowUs); +            mMediaClock->updateAnchor(nowMediaUs, nowUs, INT64_MAX); +        }      }      { diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index ad4676f..4807b65 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -925,7 +925,7 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(  #endif      ALOGV("gralloc usage: %#x(OMX) => %#x(ACodec)", omxUsage, usage); -    return setNativeWindowSizeFormatAndUsage( +    err = setNativeWindowSizeFormatAndUsage(              nativeWindow,              def.format.video.nFrameWidth,              def.format.video.nFrameHeight, @@ -936,6 +936,26 @@ status_t ACodec::setupNativeWindowSizeFormatAndUsage(  #endif              mRotationDegrees,              usage); +#ifdef QCOM_HARDWARE +    if (err == OK) { +        OMX_CONFIG_RECTTYPE rect; +        InitOMXParams(&rect); +        rect.nPortIndex = kPortIndexOutput; +        err = mOMX->getConfig( +                mNode, OMX_IndexConfigCommonOutputCrop, &rect, sizeof(rect)); +        if (err == OK) { +            ALOGV("rect size = %d, %d, %d, %d", rect.nLeft, rect.nTop, rect.nWidth, rect.nHeight); +            android_native_rect_t crop; +            crop.left = rect.nLeft; +            crop.top = rect.nTop; +            crop.right = rect.nLeft + rect.nWidth - 1; +            crop.bottom = rect.nTop + rect.nHeight - 1; +            ALOGV("crop update (%d, %d), (%d, %d)", crop.left, crop.top, crop.right, crop.bottom); +            err = native_window_set_crop(nativeWindow, &crop); +        } +    } +#endif +    return err;  }  status_t ACodec::configureOutputBuffersFromNativeWindow( diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 4ee878a..e2ad924 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -325,12 +325,6 @@ status_t CameraSource::isCameraColorFormatSupported(      return OK;  } -static int32_t getHighSpeedFrameRate(const CameraParameters& params) { -    const char* hsr = params.get("video-hsr"); -    int32_t rate = (hsr != NULL && strncmp(hsr, "off", 3)) ? atoi(hsr) : 0; -    return rate > 240 ? 240 : rate; -} -  /*   * Configure the camera to use the requested video size   * (width and height) and/or frame rate. If both width and @@ -383,10 +377,6 @@ status_t CameraSource::configureCamera(                  params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);          CHECK(supportedFrameRates != NULL);          ALOGV("Supported frame rates: %s", supportedFrameRates); -        if (getHighSpeedFrameRate(*params)) { -            ALOGI("Use default 30fps for HighSpeed %dfps", frameRate); -            frameRate = 30; -        }          char buf[4];          snprintf(buf, 4, "%d", frameRate);          if (strstr(supportedFrameRates, buf) == NULL) { @@ -488,8 +478,6 @@ status_t CameraSource::checkFrameRate(          ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);          return UNKNOWN_ERROR;      } -    int32_t highSpeedRate = getHighSpeedFrameRate(params); -    frameRateActual = highSpeedRate ? highSpeedRate : frameRateActual;      // Check the actual video frame rate against the target/requested      // video frame rate. diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp index 54c57ee..5e0ee55 100644 --- a/media/libstagefright/MediaCodec.cpp +++ b/media/libstagefright/MediaCodec.cpp @@ -2575,7 +2575,7 @@ ssize_t MediaCodec::dequeuePortBuffer(int32_t portIndex) {          info->mOwnedByClient = true;          // set image-data -        if (info->mFormat != NULL) { +        if (info->mFormat != NULL && mIsVideo) {              sp<ABuffer> imageData;              if (info->mFormat->findBuffer("image-data", &imageData)) {                  info->mData->meta()->setBuffer("image-data", imageData); diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 5b96040..d39f34b 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -273,6 +273,9 @@ static VideoFrame *extractVideoFrame(              if (err != OK) {                  ALOGW("Input Error or EOS");                  haveMoreInputs = false; +                //correct the status to continue to get output from decoder +                err = OK; +                inputIndex = -1;                  break;              } diff --git a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp index 8240f83..f2a4e65 100644 --- a/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp +++ b/media/libstagefright/codecs/m4v_h263/enc/SoftMPEG4Encoder.cpp @@ -37,6 +37,10 @@  #include <inttypes.h> +#ifndef INT32_MAX +#define INT32_MAX   2147483647 +#endif +  namespace android {  template<class T> @@ -137,6 +141,11 @@ OMX_ERRORTYPE SoftMPEG4Encoder::initEncParams() {      if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {          // Color conversion is needed.          free(mInputFrameData); +        mInputFrameData = NULL; +        if (((uint64_t)mWidth * mHeight) > ((uint64_t)INT32_MAX / 3)) { +            ALOGE("b/25812794, Buffer size is too big."); +            return OMX_ErrorBadParameter; +        }          mInputFrameData =              (uint8_t *) malloc((mWidth * mHeight * 3 ) >> 1);          CHECK(mInputFrameData != NULL); diff --git a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp index e654843..410f9d0 100644 --- a/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp +++ b/media/libstagefright/codecs/on2/enc/SoftVPXEncoder.cpp @@ -26,6 +26,10 @@  #include <media/stagefright/foundation/ADebug.h>  #include <media/stagefright/MediaDefs.h> +#ifndef INT32_MAX +#define INT32_MAX   2147483647 +#endif +  namespace android {  template<class T> @@ -315,6 +319,11 @@ status_t SoftVPXEncoder::initEncoder() {      if (mColorFormat != OMX_COLOR_FormatYUV420Planar || mInputDataIsMeta) {          free(mConversionBuffer); +        mConversionBuffer = NULL; +        if (((uint64_t)mWidth * mHeight) > ((uint64_t)INT32_MAX / 3)) { +            ALOGE("b/25812794, Buffer size is too big."); +            return UNKNOWN_ERROR; +        }          mConversionBuffer = (uint8_t *)malloc(mWidth * mHeight * 3 / 2);          if (mConversionBuffer == NULL) {              ALOGE("Allocating conversion buffer failed.");  | 
