: mNotify(notify),
mNativeWindow(nativeWindow),
mBufferGeneration(0),
+ mPaused(true),
mComponentName("decoder") {
// Every decoder has its own looper because MediaCodec operations
// are blocking, but NuPlayer needs asynchronous operations.
mOutputBuffers.size());
requestCodecNotification();
+ mPaused = false;
}
void NuPlayer::Decoder::requestCodecNotification() {
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kWhatFlushCompleted);
notify->post();
+ mPaused = true;
+}
+
+void NuPlayer::Decoder::onResume() {
+ mPaused = false;
}
void NuPlayer::Decoder::onShutdown() {
sp<AMessage> notify = mNotify->dup();
notify->setInt32("what", kWhatShutdownCompleted);
notify->post();
+ mPaused = true;
}
void NuPlayer::Decoder::onMessageReceived(const sp<AMessage> &msg) {
case kWhatCodecNotify:
{
if (!isStaleReply(msg)) {
- while (handleAnInputBuffer()) {
+ if (!mPaused) {
+ while (handleAnInputBuffer()) {
+ }
}
while (handleAnOutputBuffer()) {
break;
}
+ case kWhatResume:
+ {
+ onResume();
+ break;
+ }
+
case kWhatShutdown:
{
onShutdown();
}
void NuPlayer::Decoder::signalResume() {
- // nothing to do
+ (new AMessage(kWhatResume, id()))->post();
}
void NuPlayer::Decoder::initiateShutdown() {
void onConfigure(const sp<AMessage> &format);
void onFlush();
+ void onResume();
void onInputBufferFilled(const sp<AMessage> &msg);
void onRenderBuffer(const sp<AMessage> &msg);
void onShutdown();
int32_t mBufferGeneration;
+ bool mPaused;
AString mComponentName;
bool supportsSeamlessAudioFormatChange(const sp<AMessage> &targetFormat) const;