am c90e35c1: am 8d300280: Merge "Support "pausing" of MediaSources with the effect that they no longer pull on their upstream source until a subsequent read-with-seek." into kraken

This commit is contained in:
Andreas Huber
2010-06-10 12:43:53 -07:00
committed by Android Git Automerger
3 changed files with 31 additions and 1 deletions

View File

@@ -1145,7 +1145,8 @@ OMXCodec::OMXCodec(
mNoMoreOutputData(false),
mOutputPortSettingsHaveChanged(false),
mSeekTimeUs(-1),
mLeftOverBuffer(NULL) {
mLeftOverBuffer(NULL),
mPaused(false) {
mPortStatus[kPortIndexInput] = ENABLED;
mPortStatus[kPortIndexOutput] = ENABLED;
@@ -1735,6 +1736,9 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) {
CODEC_LOGV("Finished flushing both ports, now continuing from"
" seek-time.");
// We implicitly resume pulling on our upstream source.
mPaused = false;
drainInputBuffers();
fillOutputBuffers();
}
@@ -2034,6 +2038,10 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) {
return;
}
if (mPaused) {
return;
}
status_t err;
bool signalEOS = false;
@@ -2554,6 +2562,7 @@ status_t OMXCodec::start(MetaData *) {
mOutputPortSettingsHaveChanged = false;
mSeekTimeUs = -1;
mFilledBuffers.clear();
mPaused = false;
return init();
}
@@ -2660,6 +2669,7 @@ status_t OMXCodec::read(
// There's no reason to trigger the code below, there's
// nothing to flush yet.
seeking = false;
mPaused = false;
}
drainInputBuffers();
@@ -3220,6 +3230,14 @@ void OMXCodec::initOutputFormat(const sp<MetaData> &inputFormat) {
}
}
status_t OMXCodec::pause() {
Mutex::Autolock autoLock(mLock);
mPaused = true;
return OK;
}
////////////////////////////////////////////////////////////////////////////////
status_t QueryCodecs(