mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Backed out changeset 303ba353d785 (bug 831224) for turning bug 897108 permaorange
This commit is contained in:
parent
648f49bf94
commit
86d33773fb
@ -632,7 +632,7 @@ nsresult MediaDecoder::Seek(double aTime)
|
||||
if (distanceLeft == distanceRight) {
|
||||
distanceLeft = Abs(leftBound - mCurrentTime);
|
||||
distanceRight = Abs(rightBound - mCurrentTime);
|
||||
}
|
||||
}
|
||||
aTime = (distanceLeft < distanceRight) ? leftBound : rightBound;
|
||||
} else {
|
||||
// Seek target is after the end last range in seekable data.
|
||||
|
@ -456,12 +456,12 @@ public:
|
||||
int64_t aStartTime,
|
||||
int64_t aEndTime,
|
||||
int64_t aCurrentTime) = 0;
|
||||
|
||||
|
||||
// Called when the decode thread is started, before calling any other
|
||||
// decode, read metadata, or seek functions. Do any thread local setup
|
||||
// in this function.
|
||||
virtual void OnDecodeThreadStart() {}
|
||||
|
||||
|
||||
// Called when the decode thread is about to finish, after all calls to
|
||||
// any other decode, read metadata, or seek functions. Any backend specific
|
||||
// thread local tear down must be done in this function. Note that another
|
||||
|
@ -140,8 +140,8 @@ private:
|
||||
{
|
||||
MOZ_COUNT_CTOR(StateMachineTracker);
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
~StateMachineTracker()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
@ -156,7 +156,7 @@ public:
|
||||
// access always occurs after this and uses the monitor to
|
||||
// safely access the decode thread counts.
|
||||
static StateMachineTracker& Instance();
|
||||
|
||||
|
||||
// Instantiate the global state machine thread if required.
|
||||
// Call on main thread only.
|
||||
void EnsureGlobalStateMachine();
|
||||
@ -244,7 +244,7 @@ StateMachineTracker& StateMachineTracker::Instance()
|
||||
return *sInstance;
|
||||
}
|
||||
|
||||
void StateMachineTracker::EnsureGlobalStateMachine()
|
||||
void StateMachineTracker::EnsureGlobalStateMachine()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
@ -451,7 +451,7 @@ MediaDecoderStateMachine::~MediaDecoderStateMachine()
|
||||
mTimer->Cancel();
|
||||
mTimer = nullptr;
|
||||
mReader = nullptr;
|
||||
|
||||
|
||||
StateMachineTracker::Instance().CleanupGlobalStateMachine();
|
||||
#ifdef XP_WIN
|
||||
timeEndPeriod(1);
|
||||
@ -490,7 +490,7 @@ void MediaDecoderStateMachine::DecodeThreadRun()
|
||||
{
|
||||
NS_ASSERTION(OnDecodeThread(), "Should be on decode thread.");
|
||||
mReader->OnDecodeThreadStart();
|
||||
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
@ -531,7 +531,7 @@ void MediaDecoderStateMachine::DecodeThreadRun()
|
||||
mDecodeThreadIdle = true;
|
||||
LOG(PR_LOG_DEBUG, ("%p Decode thread finished", mDecoder.get()));
|
||||
}
|
||||
|
||||
|
||||
mReader->OnDecodeThreadFinish();
|
||||
}
|
||||
|
||||
@ -1323,7 +1323,7 @@ void MediaDecoderStateMachine::StartPlayback()
|
||||
|
||||
NS_ASSERTION(IsPlaying(), "Should report playing by end of StartPlayback()");
|
||||
if (NS_FAILED(StartAudioThread())) {
|
||||
NS_WARNING("Failed to create audio thread");
|
||||
NS_WARNING("Failed to create audio thread");
|
||||
}
|
||||
mDecoder->GetReentrantMonitor().NotifyAll();
|
||||
}
|
||||
@ -1700,7 +1700,7 @@ MediaDecoderStateMachine::ScheduleDecodeThread()
|
||||
{
|
||||
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
|
||||
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
|
||||
mStopDecodeThread = false;
|
||||
if (mState >= DECODER_STATE_COMPLETED) {
|
||||
return NS_OK;
|
||||
@ -1831,7 +1831,7 @@ int64_t MediaDecoderStateMachine::GetUndecodedData() const
|
||||
NS_ASSERTION(mState > DECODER_STATE_DECODING_METADATA,
|
||||
"Must have loaded metadata for GetBuffered() to work");
|
||||
TimeRanges buffered;
|
||||
|
||||
|
||||
nsresult res = mDecoder->GetBuffered(&buffered);
|
||||
NS_ENSURE_SUCCESS(res, 0);
|
||||
double currentTime = GetCurrentTime();
|
||||
@ -2201,7 +2201,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
// Ensure we have a decode thread to decode metadata.
|
||||
return ScheduleDecodeThread();
|
||||
}
|
||||
|
||||
|
||||
case DECODER_STATE_DECODING: {
|
||||
if (mDecoder->GetState() != MediaDecoder::PLAY_STATE_PLAYING &&
|
||||
IsPlaying())
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
return mAudioSource != nullptr;
|
||||
}
|
||||
|
||||
bool ReadVideo(VideoFrame *aFrame, int64_t aSeekTimeUs,
|
||||
bool ReadVideo(VideoFrame *aFrame, int64_t aSeekTimeUs,
|
||||
bool aKeyframeSkip = false,
|
||||
bool aDoSeek = false);
|
||||
bool ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs);
|
||||
|
@ -154,10 +154,10 @@ var gPlayTests = [
|
||||
|
||||
// Test playback of a WebM file with non-zero start time.
|
||||
{ name:"split.webm", type:"video/webm", duration:1.967 },
|
||||
|
||||
|
||||
// Test playback of a raw file
|
||||
{ name:"seek.yuv", type:"video/x-raw-yuv", duration:1.833 },
|
||||
|
||||
|
||||
// A really short, low sample rate, single channel file. This tests whether
|
||||
// we can handle playing files when only push very little audio data to the
|
||||
// hardware.
|
||||
@ -563,7 +563,7 @@ const DEBUG_TEST_LOOP_FOREVER = false;
|
||||
// 1. Create a new MediaTestManager object.
|
||||
// 2. Create a test startTest function. This takes a test object and a token,
|
||||
// and performs anything necessary to start the test. The test object is an
|
||||
// element in one of the g*Tests above. Your startTest function must call
|
||||
// element in one of the g*Tests above. Your startTest function must call
|
||||
// MediaTestManager.start(token) if it starts a test. The test object is
|
||||
// guaranteed to be playable by our supported decoders; you don't need to
|
||||
// check canPlayType.
|
||||
@ -574,12 +574,12 @@ function MediaTestManager() {
|
||||
|
||||
// Sets up a MediaTestManager to runs through the 'tests' array, which needs
|
||||
// to be one of, or have the same fields as, the g*Test arrays of tests. Uses
|
||||
// the user supplied 'startTest' function to initialize the test. This
|
||||
// the user supplied 'startTest' function to initialize the test. This
|
||||
// function must accept two arguments, the test entry from the 'tests' array,
|
||||
// and a token. Call MediaTestManager.started(token) if you start the test,
|
||||
// and MediaTestManager.finished(token) when the test finishes. You don't have
|
||||
// to start every test, but if you call started() you *must* call finish()
|
||||
// else you'll timeout.
|
||||
// else you'll timeout.
|
||||
this.runTests = function(tests, startTest) {
|
||||
this.startTime = new Date();
|
||||
SimpleTest.info("Started " + this.startTime + " (" + this.startTime.getTime()/1000 + "s)");
|
||||
@ -593,7 +593,7 @@ function MediaTestManager() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
this.nextTest();
|
||||
}
|
||||
|
||||
|
||||
// Registers that the test corresponding to 'token' has been started.
|
||||
// Don't call more than once per token.
|
||||
this.started = function(token) {
|
||||
@ -601,7 +601,7 @@ function MediaTestManager() {
|
||||
this.numTestsRunning++;
|
||||
is(this.numTestsRunning, this.tokens.length, "[started " + token + "] Length of array should match number of running tests");
|
||||
}
|
||||
|
||||
|
||||
// Registers that the test corresponding to 'token' has finished. Call when
|
||||
// you've finished your test. If all tests are complete this will finish the
|
||||
// run, otherwise it may start up the next run. It's ok to call multiple times
|
||||
@ -626,7 +626,7 @@ function MediaTestManager() {
|
||||
// with live threads waiting for the GC are killed promptly, to free up the
|
||||
// thread stacks' address space.
|
||||
SpecialPowers.forceGC();
|
||||
|
||||
|
||||
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
||||
var test = this.tests[this.testNum];
|
||||
var token = (test.name ? (test.name + "-"): "") + this.testNum;
|
||||
@ -635,11 +635,11 @@ function MediaTestManager() {
|
||||
if (DEBUG_TEST_LOOP_FOREVER && this.testNum == this.tests.length) {
|
||||
this.testNum = 0;
|
||||
}
|
||||
|
||||
|
||||
// Ensure we can play the resource type.
|
||||
if (test.type && !document.createElement('video').canPlayType(test.type))
|
||||
continue;
|
||||
|
||||
|
||||
// Do the init. This should start the test.
|
||||
this.startTest(test, token);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user