diff options
author | Chong Zhang <chz@google.com> | 2013-05-30 21:51:38 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2013-05-30 21:59:05 -0700 |
commit | 1ad3eb9441eb509c792c61aa0181b0e74dbe9984 (patch) | |
tree | 4c9d638d9522efc8fcbc0dd28bad71482e02ef58 | |
parent | fbb70ce416b193655fbe5ff7f6c8676050bdf524 (diff) | |
download | frameworks_av-1ad3eb9441eb509c792c61aa0181b0e74dbe9984.zip frameworks_av-1ad3eb9441eb509c792c61aa0181b0e74dbe9984.tar.gz frameworks_av-1ad3eb9441eb509c792c61aa0181b0e74dbe9984.tar.bz2 |
wifi-display: fix resolution list and keepalive interval
- add all resolutions lower than 1280x720p30
- schedule next keepalive when sending M16
bug 9116665
Change-Id: I7b3fea2101d3d882c0af5c153af5c502b8ce98f6
-rw-r--r-- | media/libstagefright/wifi-display/VideoFormats.cpp | 23 | ||||
-rw-r--r-- | media/libstagefright/wifi-display/VideoFormats.h | 3 | ||||
-rw-r--r-- | media/libstagefright/wifi-display/source/WifiDisplaySource.cpp | 7 |
3 files changed, 30 insertions, 3 deletions
diff --git a/media/libstagefright/wifi-display/VideoFormats.cpp b/media/libstagefright/wifi-display/VideoFormats.cpp index c368c38..04e02c1 100644 --- a/media/libstagefright/wifi-display/VideoFormats.cpp +++ b/media/libstagefright/wifi-display/VideoFormats.cpp @@ -178,6 +178,29 @@ void VideoFormats::enableAll() { } } +void VideoFormats::enableResolutionUpto( + ResolutionType type, size_t index, + ProfileType profile, LevelType level) { + size_t width, height, fps, score; + bool interlaced; + if (!GetConfiguration(type, index, &width, &height, + &fps, &interlaced)) { + ALOGE("Maximum resolution not found!"); + return; + } + score = width * height * fps * (!interlaced + 1); + for (size_t i = 0; i < kNumResolutionTypes; ++i) { + for (size_t j = 0; j < 32; j++) { + if (GetConfiguration((ResolutionType)i, j, + &width, &height, &fps, &interlaced) + && score >= width * height * fps * (!interlaced + 1)) { + setResolutionEnabled((ResolutionType)i, j); + setProfileLevel((ResolutionType)i, j, profile, level); + } + } + } +} + void VideoFormats::setResolutionEnabled( ResolutionType type, size_t index, bool enabled) { CHECK_LT(type, kNumResolutionTypes); diff --git a/media/libstagefright/wifi-display/VideoFormats.h b/media/libstagefright/wifi-display/VideoFormats.h index b918652..fd38fd1 100644 --- a/media/libstagefright/wifi-display/VideoFormats.h +++ b/media/libstagefright/wifi-display/VideoFormats.h @@ -69,6 +69,9 @@ struct VideoFormats { void disableAll(); void enableAll(); + void enableResolutionUpto( + ResolutionType type, size_t index, + ProfileType profile, LevelType level); void setResolutionEnabled( ResolutionType type, size_t index, bool enabled = true); diff --git a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp index dee95eb..b421b35 100644 --- a/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp +++ b/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp @@ -75,7 +75,8 @@ WifiDisplaySource::WifiDisplaySource( mSupportedSourceVideoFormats.setNativeResolution( VideoFormats::RESOLUTION_CEA, 5); // 1280x720 p30 - mSupportedSourceVideoFormats.setProfileLevel( + // Enable all resolutions up to 1280x720p30 + mSupportedSourceVideoFormats.enableResolutionUpto( VideoFormats::RESOLUTION_CEA, 5, VideoFormats::PROFILE_CHP, // Constrained High Profile VideoFormats::LEVEL_32); // Level 3.2 @@ -751,6 +752,8 @@ status_t WifiDisplaySource::sendM16(int32_t sessionID) { ++mNextCSeq; + scheduleKeepAlive(sessionID); + return OK; } @@ -1021,8 +1024,6 @@ status_t WifiDisplaySource::onReceiveM16Response( if (mClientInfo.mPlaybackSession != NULL) { mClientInfo.mPlaybackSession->updateLiveness(); - - scheduleKeepAlive(sessionID); } return OK; |