Bug 1502927 - Remove MediaStream.currentTime. r=baku,jib

This has never been specced and is unused appart from our tests.

Differential Revision: https://phabricator.services.mozilla.com/D10082

--HG--
extra : rebase_source : 4c54d808fb69c0e403ff2e1775b97571889efca4
extra : histedit_source : bc568066b0684bb82b4f553b99f0dd48212aa633
This commit is contained in:
Paul Adenot 2018-10-29 17:38:19 +01:00
Родитель f341826914
Коммит 6c82d39b64
10 изменённых файлов: 7 добавлений и 62 удалений

Просмотреть файл

@ -32,23 +32,10 @@
#include "nsRFPService.h"
#include "nsServiceManagerUtils.h"
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
// GetTickCount() and conflicts with NS_DECL_NSIDOMMEDIASTREAM, containing
// currentTime getter.
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
#ifdef LOG
#undef LOG
#endif
// GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
// GetTickCount() and conflicts with MediaStream::GetCurrentTime.
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
@ -414,9 +401,9 @@ NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
DOMMediaStream::DOMMediaStream(nsPIDOMWindowInner* aWindow,
MediaStreamTrackSourceGetter* aTrackSourceGetter)
: mLogicalStreamStartTime(0), mWindow(aWindow),
mInputStream(nullptr), mOwnedStream(nullptr), mPlaybackStream(nullptr),
mTracksPendingRemoval(0), mTrackSourceGetter(aTrackSourceGetter),
: mWindow(aWindow), mInputStream(nullptr), mOwnedStream(nullptr),
mPlaybackStream(nullptr), mTracksPendingRemoval(0),
mTrackSourceGetter(aTrackSourceGetter),
mPlaybackTrackListener(MakeAndAddRef<PlaybackTrackListener>(this)),
mTracksCreated(false), mNotifiedOfMediaStreamGraphShutdown(false),
mActive(false), mSetInactiveOnFinish(false), mCORSMode(CORS_NONE)
@ -565,20 +552,6 @@ DOMMediaStream::Constructor(const GlobalObject& aGlobal,
return newStream.forget();
}
double
DOMMediaStream::CurrentTime()
{
if (!mPlaybackStream) {
return 0.0;
}
// The value of a MediaStream's CurrentTime will always advance forward; it will never
// reset (even if one rewinds a video.) Therefore we can use a single Random Seed
// initialized at the same time as the object.
return nsRFPService::ReduceTimePrecisionAsSecs(mPlaybackStream->
StreamTimeToSeconds(mPlaybackStream->GetCurrentTime() - mLogicalStreamStartTime),
GetRandomTimelineSeed());
}
already_AddRefed<Promise>
DOMMediaStream::CountUnderlyingStreams(const GlobalObject& aGlobal, ErrorResult& aRv)
{

Просмотреть файл

@ -19,12 +19,6 @@
#include "mozilla/RelativeTimeline.h"
#include "PrincipalChangeObserver.h"
// X11 has a #define for CurrentTime. Unbelievable :-(.
// See dom/media/webaudio/AudioContext.h for more fun!
#ifdef CurrentTime
#undef CurrentTime
#endif
namespace mozilla {
class AbstractThread;
@ -357,8 +351,6 @@ public:
const dom::Sequence<OwningNonNull<MediaStreamTrack>>& aTracks,
ErrorResult& aRv);
double CurrentTime();
static already_AddRefed<dom::Promise>
CountUnderlyingStreams(const dom::GlobalObject& aGlobal, ErrorResult& aRv);
@ -522,11 +514,6 @@ public:
nsIPrincipal* aPrincipal,
MediaStreamGraph* aGraph);
void SetLogicalStreamStartTime(StreamTime aTime)
{
mLogicalStreamStartTime = aTime;
}
/**
* Adds a MediaStreamTrack to mTracks and raises "addtrack".
*
@ -662,9 +649,6 @@ protected:
// the principal changes.
void RecomputePrincipal();
// StreamTime at which the currentTime attribute would return 0.
StreamTime mLogicalStreamStartTime;
// We need this to track our parent object.
nsCOMPtr<nsPIDOMWindowInner> mWindow;

Просмотреть файл

@ -1312,10 +1312,6 @@ public:
return;
}
// Start currentTime from the point where this stream was successfully
// returned.
aStream->SetLogicalStreamStartTime(aStream->GetPlaybackStream()->GetCurrentTime());
// This is safe since we're on main-thread, and the windowlist can only
// be invalidated from the main-thread (see OnNavigation)
LOG(("Returning success for getUserMedia()"));

Просмотреть файл

@ -1221,9 +1221,6 @@ class RTCPeerConnection {
}
addTrack(track, stream) {
if (stream.currentTime === undefined) {
throw new this._win.DOMException("invalid stream.", "InvalidParameterError");
}
this._checkClosed();
if (this._transceivers.some(

Просмотреть файл

@ -38,7 +38,6 @@ function startTest(test) {
var stream;
var checkEnded = function() {
is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
if (test.duration) {
isGreaterThanOrEqualEps(vout.currentTime, test.duration,
test.name + " current time at end");
@ -58,7 +57,6 @@ function startTest(test) {
var onloadedmetadata = function (ev) {
stream = v.mozCaptureStreamUntilEnded();
is(stream.currentTime, 0, test.name + " stream initial currentTime");
vout.srcObject = stream;
is(vout.srcObject, stream, test.name + " set output element .srcObject correctly");
v.play();

Просмотреть файл

@ -92,12 +92,10 @@ MediaStreamPlayback.prototype = {
* Verifies that media is playing.
*/
verifyPlaying : function() {
var lastStreamTime = this.mediaStream.currentTime;
var lastElementTime = this.mediaElement.currentTime;
var mediaTimeProgressed = listenUntil(this.mediaElement, 'timeupdate',
() => this.mediaStream.currentTime > lastStreamTime &&
this.mediaElement.currentTime > lastElementTime);
() => this.mediaElement.currentTime > lastElementTime);
return timeout(Promise.all([this.canPlayThroughFired, mediaTimeProgressed]),
VERIFYPLAYING_TIMEOUT_LENGTH, "verifyPlaying timed out")

Просмотреть файл

@ -75,7 +75,7 @@ runNetworkTest(function() {
.then(() => pcall(pc1, pc1.setRemoteDescription, pc2.localDescription))
.then(() => delivered)
// .then(() => canPlayThrough) // why doesn't this fire?
.then(() => waitUntil(() => v2.currentTime > 0 && v2.srcObject.currentTime > 0))
.then(() => waitUntil(() => v2.currentTime > 0))
.then(() => ok(v2.currentTime > 0, "v2.currentTime is moving (" + v2.currentTime + ")"))
.then(() => ok(true, "Connected."))
.then(() => pcall(pc1, pc1.getStats, null))

Просмотреть файл

@ -51,7 +51,7 @@
.then(() => pc1.setRemoteDescription(pc2.localDescription))
.then(() => delivered)
// .then(() => canPlayThrough) // why doesn't this fire?
.then(() => waitUntil(() => v2.currentTime > 0 && v2.srcObject.currentTime > 0))
.then(() => waitUntil(() => v2.currentTime > 0))
.then(() => ok(v2.currentTime > 0, "v2.currentTime is moving (" + v2.currentTime + ")"))
.then(() => ok(true, "Connected."))
.catch(reason => ok(false, "unexpected failure: " + reason))

Просмотреть файл

@ -64,7 +64,7 @@
await v2loadedmetadata;
await waitUntil(() => v2.currentTime > 0 && v2.srcObject.currentTime > 0);
await waitUntil(() => v2.currentTime > 0);
ok(v2.currentTime > 0, "v2.currentTime is moving (" + v2.currentTime + ")");
ok(v1.videoWidth > 0, "source width is positive");

Просмотреть файл

@ -39,7 +39,6 @@ interface MediaStream : EventTarget {
readonly attribute boolean active;
attribute EventHandler onaddtrack;
attribute EventHandler onremovetrack;
readonly attribute double currentTime;
[ChromeOnly, Throws]
static Promise<long> countUnderlyingStreams();