mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1000195 - Fix the auto-play path by calling MediaDecoder::NotifySuspendedStatusChanged. r=sworkman, r=ettseng
This commit is contained in:
parent
5c4d7906b9
commit
f91d7f3d9e
@ -357,6 +357,7 @@ RtspMediaResource::RtspMediaResource(MediaDecoder* aDecoder,
|
||||
: BaseMediaResource(aDecoder, aChannel, aURI, aContentType)
|
||||
, mIsConnected(false)
|
||||
, mRealTime(false)
|
||||
, mIsSuspend(true)
|
||||
{
|
||||
#ifndef NECKO_PROTOCOL_rtsp
|
||||
MOZ_CRASH("Should not be called except for B2G platform");
|
||||
@ -384,6 +385,28 @@ RtspMediaResource::~RtspMediaResource()
|
||||
}
|
||||
}
|
||||
|
||||
void RtspMediaResource::SetSuspend(bool aIsSuspend)
|
||||
{
|
||||
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
|
||||
RTSPMLOG("SetSuspend %d",aIsSuspend);
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethodWithArg<bool>(this, &RtspMediaResource::NotifySuspend,
|
||||
aIsSuspend);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
|
||||
void RtspMediaResource::NotifySuspend(bool aIsSuspend)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
|
||||
RTSPMLOG("NotifySuspend %d",aIsSuspend);
|
||||
|
||||
mIsSuspend = aIsSuspend;
|
||||
if (mDecoder) {
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
RtspMediaResource::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
@ -638,6 +661,8 @@ RtspMediaResource::OnDisconnected(uint8_t aTrackIdx, nsresult aReason)
|
||||
void RtspMediaResource::Suspend(bool aCloseImmediately)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
|
||||
|
||||
mIsSuspend = true;
|
||||
if (NS_WARN_IF(!mDecoder)) {
|
||||
return;
|
||||
}
|
||||
@ -649,11 +674,14 @@ void RtspMediaResource::Suspend(bool aCloseImmediately)
|
||||
|
||||
mMediaStreamController->Suspend();
|
||||
element->DownloadSuspended();
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
|
||||
void RtspMediaResource::Resume()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
|
||||
|
||||
mIsSuspend = false;
|
||||
if (NS_WARN_IF(!mDecoder)) {
|
||||
return;
|
||||
}
|
||||
@ -667,6 +695,7 @@ void RtspMediaResource::Resume()
|
||||
element->DownloadResumed();
|
||||
}
|
||||
mMediaStreamController->Resume();
|
||||
mDecoder->NotifySuspendedStatusChanged();
|
||||
}
|
||||
|
||||
nsresult RtspMediaResource::Open(nsIStreamListener **aStreamListener)
|
||||
|
@ -93,6 +93,10 @@ public:
|
||||
return mRealTime;
|
||||
}
|
||||
|
||||
// Called by RtspOmxReader, dispatch a runnable to notify mDecoder.
|
||||
// Other thread only.
|
||||
void SetSuspend(bool aIsSuspend);
|
||||
|
||||
// The following methods can be called on any thread except main thread.
|
||||
|
||||
// Read data from track.
|
||||
@ -137,8 +141,7 @@ public:
|
||||
virtual void Pin() MOZ_OVERRIDE {}
|
||||
virtual void Unpin() MOZ_OVERRIDE {}
|
||||
|
||||
// dummy
|
||||
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
|
||||
virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return mIsSuspend; }
|
||||
|
||||
virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
|
||||
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
|
||||
@ -224,6 +227,8 @@ protected:
|
||||
nsRefPtr<Listener> mListener;
|
||||
|
||||
private:
|
||||
// Notify mDecoder the rtsp stream is suspend. Main thread only.
|
||||
void NotifySuspend(bool aIsSuspend);
|
||||
bool IsVideoEnabled();
|
||||
bool IsVideo(uint8_t tracks, nsIStreamingProtocolMetaData *meta);
|
||||
// These two members are created at |RtspMediaResource::OnConnected|.
|
||||
@ -235,6 +240,8 @@ private:
|
||||
bool mIsConnected;
|
||||
// live stream
|
||||
bool mRealTime;
|
||||
// Indicate the rtsp controller is suspended or not. Main thread only.
|
||||
bool mIsSuspend;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -322,6 +322,7 @@ void RtspOmxReader::SetIdle() {
|
||||
if (controller) {
|
||||
controller->Pause();
|
||||
}
|
||||
mRtspResource->SetSuspend(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,6 +334,7 @@ void RtspOmxReader::SetActive() {
|
||||
if (controller) {
|
||||
controller->Play();
|
||||
}
|
||||
mRtspResource->SetSuspend(false);
|
||||
}
|
||||
|
||||
// Call parent class to set OMXCodec active.
|
||||
|
Loading…
Reference in New Issue
Block a user