• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/av


Commit MetaInfo

Revision37940eefcba982836b579fe1ffec6cada72b0974 (tree)
Time2009-09-02 08:02:43
AuthorAndreas Huber <andih@goog...>
CommiterAndreas Huber

Log Message

Squashed commit of the following:

commit c45bfbb97ccd05982008df47181f9c73abaf0497
Author: Andreas Huber <andih@google.com>
Date: Tue Sep 1 15:58:12 2009 -0700

This quirk should not be enabled by default in order to make the bug reproducible by the vendor.

commit 21d72e80e795fcae53d9c3bcc8ba6312b081e420
Author: Andreas Huber <andih@google.com>
Date: Tue Sep 1 15:55:45 2009 -0700

Undoing the hack to temporarily give up the lock to facilitate reading from the buffer source.
This simply causes too many issues, there need to be independent threads providing input buffers and dequeuing output buffers.

commit 84d507def8999c146ce124cc8edfe106c9ca70c2
Author: Andreas Huber <andih@google.com>
Date: Tue Sep 1 15:16:23 2009 -0700

The AAC components appear to output stereo data even if the input data is mono...

Change Summary

Incremental Difference

--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -136,7 +136,7 @@ private:
136136 void clearCodecSpecificData();
137137
138138 void setAMRFormat();
139- void setAACFormat();
139+ void setAACFormat(int32_t numChannels, int32_t sampleRate);
140140
141141 status_t setVideoPortFormatType(
142142 OMX_U32 portIndex,
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -302,7 +302,11 @@ sp<OMXCodec> OMXCodec::Create(
302302 codec->setAMRFormat();
303303 }
304304 if (!createEncoder && !strcasecmp("audio/mp4a-latm", mime)) {
305- codec->setAACFormat();
305+ int32_t numChannels, sampleRate;
306+ CHECK(meta->findInt32(kKeyChannelCount, &numChannels));
307+ CHECK(meta->findInt32(kKeySampleRate, &sampleRate));
308+
309+ codec->setAACFormat(numChannels, sampleRate);
306310 }
307311 if (!strncasecmp(mime, "video/", 6)) {
308312 int32_t width, height;
@@ -1321,10 +1325,6 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
13211325 return;
13221326 }
13231327
1324- // We're going to temporarily give up the lock while reading data
1325- // from the source. A certain client unfortunately chose to have the
1326- // thread supplying input data and reading output data be the same...
1327-
13281328 MediaBuffer *srcBuffer;
13291329 status_t err;
13301330 if (mSeekTimeUs >= 0) {
@@ -1332,13 +1332,10 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
13321332 options.setSeekTo(mSeekTimeUs);
13331333 mSeekTimeUs = -1;
13341334
1335- mLock.unlock();
13361335 err = mSource->read(&srcBuffer, &options);
13371336 } else {
1338- mLock.unlock();
13391337 err = mSource->read(&srcBuffer);
13401338 }
1341- mLock.lock();
13421339
13431340 OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME;
13441341 OMX_TICKS timestamp = 0;
@@ -1496,20 +1493,22 @@ void OMXCodec::setAMRFormat() {
14961493 }
14971494 }
14981495
1499-void OMXCodec::setAACFormat() {
1500- OMX_AUDIO_PARAM_AACPROFILETYPE def;
1501- def.nSize = sizeof(def);
1502- def.nVersion.s.nVersionMajor = 1;
1503- def.nVersion.s.nVersionMinor = 1;
1504- def.nPortIndex = kPortIndexInput;
1496+void OMXCodec::setAACFormat(int32_t numChannels, int32_t sampleRate) {
1497+ OMX_AUDIO_PARAM_AACPROFILETYPE profile;
1498+ profile.nSize = sizeof(profile);
1499+ profile.nVersion.s.nVersionMajor = 1;
1500+ profile.nVersion.s.nVersionMinor = 1;
1501+ profile.nPortIndex = kPortIndexInput;
15051502
15061503 status_t err =
1507- mOMX->get_parameter(mNode, OMX_IndexParamAudioAac, &def, sizeof(def));
1504+ mOMX->get_parameter(mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
15081505 CHECK_EQ(err, OK);
15091506
1510- def.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
1507+ profile.nChannels = numChannels;
1508+ profile.nSampleRate = sampleRate;
1509+ profile.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
15111510
1512- err = mOMX->set_parameter(mNode, OMX_IndexParamAudioAac, &def, sizeof(def));
1511+ err = mOMX->set_parameter(mNode, OMX_IndexParamAudioAac, &profile, sizeof(profile));
15131512 CHECK_EQ(err, OK);
15141513 }
15151514
@@ -2123,8 +2122,19 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) {
21232122 inputFormat->findInt32(kKeyChannelCount, &numChannels);
21242123 inputFormat->findInt32(kKeySampleRate, &sampleRate);
21252124
2125+ if ((OMX_U32)numChannels != params.nChannels) {
2126+ LOGW("Codec outputs a different number of channels than "
2127+ "the input stream contains.");
2128+ }
2129+
21262130 mOutputFormat->setCString(kKeyMIMEType, "audio/raw");
2127- mOutputFormat->setInt32(kKeyChannelCount, numChannels);
2131+
2132+ // Use the codec-advertised number of channels, as some
2133+ // codecs appear to output stereo even if the input data is
2134+ // mono.
2135+ mOutputFormat->setInt32(kKeyChannelCount, params.nChannels);
2136+
2137+ // The codec-reported sampleRate is not reliable...
21282138 mOutputFormat->setInt32(kKeySampleRate, sampleRate);
21292139 break;
21302140 }