Bug 916135 - Part 2: Don't call OMXCodec::pause in emulator mode to prevent getting stuck in paused state of OMXCodec. r=cdouble

This commit is contained in:
JW Wang 2013-12-16 16:30:59 +08:00
parent eab8831c35
commit 77c2ed6ed0

View File

@ -500,6 +500,13 @@ bool OmxDecoder::IsWaitingMediaResources()
return false;
}
static bool isInEmulator()
{
char propQemu[PROPERTY_VALUE_MAX];
property_get("ro.kernel.qemu", propQemu, "");
return !strncmp(propQemu, "1", 1);
}
bool OmxDecoder::AllocateMediaResources()
{
// OMXClient::connect() always returns OK and abort's fatally if
@ -524,9 +531,7 @@ bool OmxDecoder::AllocateMediaResources()
// up.
int flags = kHardwareCodecsOnly;
char propQemu[PROPERTY_VALUE_MAX];
property_get("ro.kernel.qemu", propQemu, "");
if (!strncmp(propQemu, "1", 1)) {
if (isInEmulator()) {
// If we are in emulator, allow to fall back to software.
flags = 0;
}
@ -966,6 +971,16 @@ nsresult OmxDecoder::Play()
// We need to fix it until it is really happened.
void OmxDecoder::Pause()
{
/* The implementation of OMXCodec::pause is flawed.
* OMXCodec::start will not restore from the paused state and result in
* buffer timeout which causes timeouts in mochitests.
* Since there is not power consumption problem in emulator, we will just
* return when running in emulator to fix timeouts in mochitests.
*/
if (isInEmulator()) {
return;
}
if (mVideoPaused || mAudioPaused) {
return;
}