diff options
author | James Dong <jdong@google.com> | 2012-10-11 20:28:50 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2012-10-11 20:28:50 -0700 |
commit | 6ebb67493075ecc817207bc0ca0305cde64b5c3b (patch) | |
tree | 919f267f8e904017ce955424832d29ea4c586e11 /media/libmediaplayerservice | |
parent | 411ddcc42a17abf4173345a992e4cd6575751739 (diff) | |
download | frameworks_av-6ebb67493075ecc817207bc0ca0305cde64b5c3b.zip frameworks_av-6ebb67493075ecc817207bc0ca0305cde64b5c3b.tar.gz frameworks_av-6ebb67493075ecc817207bc0ca0305cde64b5c3b.tar.bz2 |
Fix some missing checks against missing codecs
o related-to-bug: 6971073
Change-Id: Ia6d926663231f9a9ef31c82c85c70595c4a30ebe
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/StagefrightRecorder.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp index e49c218..57b0ec2 100644 --- a/media/libmediaplayerservice/StagefrightRecorder.cpp +++ b/media/libmediaplayerservice/StagefrightRecorder.cpp @@ -1035,11 +1035,11 @@ void StagefrightRecorder::clipVideoFrameRate() { "enc.vid.fps.min", mVideoEncoder); int maxFrameRate = mEncoderProfiles->getVideoEncoderParamByName( "enc.vid.fps.max", mVideoEncoder); - if (mFrameRate < minFrameRate && mFrameRate != -1) { + if (mFrameRate < minFrameRate && minFrameRate != -1) { ALOGW("Intended video encoding frame rate (%d fps) is too small" " and will be set to (%d fps)", mFrameRate, minFrameRate); mFrameRate = minFrameRate; - } else if (mFrameRate > maxFrameRate) { + } else if (mFrameRate > maxFrameRate && maxFrameRate != -1) { ALOGW("Intended video encoding frame rate (%d fps) is too large" " and will be set to (%d fps)", mFrameRate, maxFrameRate); mFrameRate = maxFrameRate; @@ -1052,11 +1052,11 @@ void StagefrightRecorder::clipVideoBitRate() { "enc.vid.bps.min", mVideoEncoder); int maxBitRate = mEncoderProfiles->getVideoEncoderParamByName( "enc.vid.bps.max", mVideoEncoder); - if (mVideoBitRate < minBitRate) { + if (mVideoBitRate < minBitRate && minBitRate != -1) { ALOGW("Intended video encoding bit rate (%d bps) is too small" " and will be set to (%d bps)", mVideoBitRate, minBitRate); mVideoBitRate = minBitRate; - } else if (mVideoBitRate > maxBitRate) { + } else if (mVideoBitRate > maxBitRate && maxBitRate != -1) { ALOGW("Intended video encoding bit rate (%d bps) is too large" " and will be set to (%d bps)", mVideoBitRate, maxBitRate); mVideoBitRate = maxBitRate; @@ -1069,11 +1069,11 @@ void StagefrightRecorder::clipVideoFrameWidth() { "enc.vid.width.min", mVideoEncoder); int maxFrameWidth = mEncoderProfiles->getVideoEncoderParamByName( "enc.vid.width.max", mVideoEncoder); - if (mVideoWidth < minFrameWidth) { + if (mVideoWidth < minFrameWidth && minFrameWidth != -1) { ALOGW("Intended video encoding frame width (%d) is too small" " and will be set to (%d)", mVideoWidth, minFrameWidth); mVideoWidth = minFrameWidth; - } else if (mVideoWidth > maxFrameWidth) { + } else if (mVideoWidth > maxFrameWidth && maxFrameWidth != -1) { ALOGW("Intended video encoding frame width (%d) is too large" " and will be set to (%d)", mVideoWidth, maxFrameWidth); mVideoWidth = maxFrameWidth; @@ -1164,7 +1164,7 @@ void StagefrightRecorder::clipAudioBitRate() { int minAudioBitRate = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.bps.min", mAudioEncoder); - if (mAudioBitRate < minAudioBitRate) { + if (minAudioBitRate != -1 && mAudioBitRate < minAudioBitRate) { ALOGW("Intended audio encoding bit rate (%d) is too small" " and will be set to (%d)", mAudioBitRate, minAudioBitRate); mAudioBitRate = minAudioBitRate; @@ -1173,7 +1173,7 @@ void StagefrightRecorder::clipAudioBitRate() { int maxAudioBitRate = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.bps.max", mAudioEncoder); - if (mAudioBitRate > maxAudioBitRate) { + if (maxAudioBitRate != -1 && mAudioBitRate > maxAudioBitRate) { ALOGW("Intended audio encoding bit rate (%d) is too large" " and will be set to (%d)", mAudioBitRate, maxAudioBitRate); mAudioBitRate = maxAudioBitRate; @@ -1186,7 +1186,7 @@ void StagefrightRecorder::clipAudioSampleRate() { int minSampleRate = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.hz.min", mAudioEncoder); - if (mSampleRate < minSampleRate) { + if (minSampleRate != -1 && mSampleRate < minSampleRate) { ALOGW("Intended audio sample rate (%d) is too small" " and will be set to (%d)", mSampleRate, minSampleRate); mSampleRate = minSampleRate; @@ -1195,7 +1195,7 @@ void StagefrightRecorder::clipAudioSampleRate() { int maxSampleRate = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.hz.max", mAudioEncoder); - if (mSampleRate > maxSampleRate) { + if (maxSampleRate != -1 && mSampleRate > maxSampleRate) { ALOGW("Intended audio sample rate (%d) is too large" " and will be set to (%d)", mSampleRate, maxSampleRate); mSampleRate = maxSampleRate; @@ -1208,7 +1208,7 @@ void StagefrightRecorder::clipNumberOfAudioChannels() { int minChannels = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.ch.min", mAudioEncoder); - if (mAudioChannels < minChannels) { + if (minChannels != -1 && mAudioChannels < minChannels) { ALOGW("Intended number of audio channels (%d) is too small" " and will be set to (%d)", mAudioChannels, minChannels); mAudioChannels = minChannels; @@ -1217,7 +1217,7 @@ void StagefrightRecorder::clipNumberOfAudioChannels() { int maxChannels = mEncoderProfiles->getAudioEncoderParamByName( "enc.aud.ch.max", mAudioEncoder); - if (mAudioChannels > maxChannels) { + if (maxChannels != -1 && mAudioChannels > maxChannels) { ALOGW("Intended number of audio channels (%d) is too large" " and will be set to (%d)", mAudioChannels, maxChannels); mAudioChannels = maxChannels; @@ -1230,11 +1230,11 @@ void StagefrightRecorder::clipVideoFrameHeight() { "enc.vid.height.min", mVideoEncoder); int maxFrameHeight = mEncoderProfiles->getVideoEncoderParamByName( "enc.vid.height.max", mVideoEncoder); - if (mVideoHeight < minFrameHeight) { + if (minFrameHeight != -1 && mVideoHeight < minFrameHeight) { ALOGW("Intended video encoding frame height (%d) is too small" " and will be set to (%d)", mVideoHeight, minFrameHeight); mVideoHeight = minFrameHeight; - } else if (mVideoHeight > maxFrameHeight) { + } else if (maxFrameHeight != -1 && mVideoHeight > maxFrameHeight) { ALOGW("Intended video encoding frame height (%d) is too large" " and will be set to (%d)", mVideoHeight, maxFrameHeight); mVideoHeight = maxFrameHeight; |