From 575a5361fc970476cd7979638ee3ac00cc6e5024 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Wed, 3 Oct 2012 10:16:58 -0700 Subject: Better power savings with wifi display code. No more polling the encoder for work to do, the encoder instead notifies if there's activity. Change-Id: Ia707211b4f5c5a6e6b70d750233d204a2d6bb778 related-to-bug: 7248248 --- include/media/stagefright/MediaCodec.h | 42 +++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 8c612d4..cacfa54 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -108,6 +108,11 @@ struct MediaCodec : public AHandler { status_t requestIDRFrame(); + // Notification will be posted once there "is something to do", i.e. + // an input/output buffer has become available, a format change is + // pending, an error is pending. + void requestActivityNotification(const sp ¬ify); + protected: virtual ~MediaCodec(); virtual void onMessageReceived(const sp &msg); @@ -132,22 +137,23 @@ private: }; enum { - kWhatInit = 'init', - kWhatConfigure = 'conf', - kWhatStart = 'strt', - kWhatStop = 'stop', - kWhatRelease = 'rele', - kWhatDequeueInputBuffer = 'deqI', - kWhatQueueInputBuffer = 'queI', - kWhatDequeueOutputBuffer = 'deqO', - kWhatReleaseOutputBuffer = 'relO', - kWhatGetBuffers = 'getB', - kWhatFlush = 'flus', - kWhatGetOutputFormat = 'getO', - kWhatDequeueInputTimedOut = 'dITO', - kWhatDequeueOutputTimedOut = 'dOTO', - kWhatCodecNotify = 'codc', - kWhatRequestIDRFrame = 'ridr', + kWhatInit = 'init', + kWhatConfigure = 'conf', + kWhatStart = 'strt', + kWhatStop = 'stop', + kWhatRelease = 'rele', + kWhatDequeueInputBuffer = 'deqI', + kWhatQueueInputBuffer = 'queI', + kWhatDequeueOutputBuffer = 'deqO', + kWhatReleaseOutputBuffer = 'relO', + kWhatGetBuffers = 'getB', + kWhatFlush = 'flus', + kWhatGetOutputFormat = 'getO', + kWhatDequeueInputTimedOut = 'dITO', + kWhatDequeueOutputTimedOut = 'dOTO', + kWhatCodecNotify = 'codc', + kWhatRequestIDRFrame = 'ridr', + kWhatRequestActivityNotification = 'racN', }; enum { @@ -191,6 +197,8 @@ private: List > mCSD; + sp mActivityNotify; + MediaCodec(const sp &looper); static status_t PostAndAwaitResponse( @@ -216,6 +224,8 @@ private: status_t setNativeWindow( const sp &surfaceTextureClient); + void postActivityNotificationIfPossible(); + DISALLOW_EVIL_CONSTRUCTORS(MediaCodec); }; -- cgit v1.1