Merge change I0f73439a into eclair
* changes:
Partially fix bug 2111240 Detect docking / undocking event by reporting to the AudioPolicyManager a new forced usage AudioSystem::FOR_DOCK which can take the FORCE_NONE, FORCE_BT_DOCK or FORCE_WIRED_ACCESSORY values. This CL is complemented by an update of the APM to take into account the FOR_DOCK usage.
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index f3f6e4f..2024cc0 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -1111,7 +1111,6 @@
{
track->mState = TrackBase::TERMINATED;
if (mActiveTracks.indexOf(track) < 0) {
- LOGV("remove track (%d) and delete from mixer", track->name());
mTracks.remove(track);
deleteTrackName_l(track->name());
}
@@ -1511,6 +1510,7 @@
// deleteTrackName_l() must be called with ThreadBase::mLock held
void AudioFlinger::MixerThread::deleteTrackName_l(int name)
{
+ LOGV("remove track (%d) and delete from mixer", name);
mAudioMixer->deleteTrackName(name);
}
@@ -1922,6 +1922,9 @@
AudioFlinger::DuplicatingThread::~DuplicatingThread()
{
+ for (size_t i = 0; i < mOutputTracks.size(); i++) {
+ mOutputTracks[i]->destroy();
+ }
mOutputTracks.clear();
}
@@ -2044,17 +2047,6 @@
outputTracks.clear();
}
- { // scope for the mLock
-
- Mutex::Autolock _l(mLock);
- if (!mStandby) {
- LOGV("DuplicatingThread() exiting out of standby");
- for (size_t i = 0; i < mOutputTracks.size(); i++) {
- mOutputTracks[i]->destroy();
- }
- }
- }
-
return false;
}
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index eb017bf..137c5c0 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -120,9 +120,7 @@
source->onTransaction(flags);
uint32_t res = LayerBase::doTransaction(flags);
// we always want filtering for these surfaces
- if (!(mFlags & DisplayHardware::SLOW_CONFIG)) {
- mUseLinearFiltering = true;
- }
+ mUseLinearFiltering = !(mFlags & DisplayHardware::SLOW_CONFIG);
return res;
}
@@ -371,25 +369,33 @@
// note that the size of this buffer doesn't really matter,
// the final image will always be drawn with proper aspect ratio.
- int w = buffers.w;
- int h = buffers.h;
+ int w = layer.mTransformedBounds.width();
+ int h = layer.mTransformedBounds.height();
+ if (buffers.w * h != buffers.h * w) {
+ int t = w; w = h; h = t;
+ }
+ if (buffers.w * h == buffers.h * w) {
+ // same pixel area, don't use filtering
+ layer.mUseLinearFiltering = false;
+ }
+
mTempGraphicBuffer.clear();
mTempGraphicBuffer = new GraphicBuffer(
- w, h, HAL_PIXEL_FORMAT_RGBX_8888,
+ w, h, HAL_PIXEL_FORMAT_RGB_565,
GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_HW_2D);
if (mTempGraphicBuffer->initCheck() == NO_ERROR) {
NativeBuffer& dst(mTempBuffer);
dst.img.w = mTempGraphicBuffer->getStride();
- dst.img.h = mTempGraphicBuffer->getHeight();
+ dst.img.h = h;
dst.img.format = mTempGraphicBuffer->getPixelFormat();
dst.img.handle = (native_handle_t *)mTempGraphicBuffer->handle;
dst.img.base = 0;
dst.crop.l = 0;
dst.crop.t = 0;
- dst.crop.r = mTempGraphicBuffer->getWidth();
- dst.crop.b = mTempGraphicBuffer->getHeight();
+ dst.crop.r = w;
+ dst.crop.b = h;
} else {
mTempGraphicBuffer.clear();
}