Merge change 20677

* changes:
  workaround a bug in the SGX driver that would prevent eglGetConfig to work properly
diff --git a/include/ui/Surface.h b/include/ui/Surface.h
index 5665c1f..d5dad31 100644
--- a/include/ui/Surface.h
+++ b/include/ui/Surface.h
@@ -35,8 +35,8 @@
 // ---------------------------------------------------------------------------
 
 class BufferMapper;
+class IOMX;
 class Rect;
-class MediaPlayerImpl;
 class Surface;
 class SurfaceComposerClient;
 struct per_client_cblk_t;
@@ -181,7 +181,7 @@
     // mediaplayer needs access to ISurface for display
     friend class MediaPlayer;
     friend class Test;
-    friend class MediaPlayerImpl;
+    friend class IOMX;
     const sp<ISurface>& getISurface() const { return mSurface; }
 
     status_t getBufferLocked(int index);
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index d019097..2e947d6 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -1512,6 +1512,10 @@
                     int name = getTrackName_l();
                     if (name < 0) break;
                     mTracks[i]->mName = name;
+                    // limit track sample rate to 2 x new output sample rate
+                    if (mTracks[i]->mCblk->sampleRate > 2 * sampleRate()) {
+                        mTracks[i]->mCblk->sampleRate = 2 * sampleRate();
+                    }
                 }
                 sendConfigEvent_l(AudioSystem::OUTPUT_CONFIG_CHANGED);
             }