Bug 1133461 - [RTSP] Remove the extra PLAY request for seek operation. r=bechen

This commit is contained in:
Ethan Tseng 2015-03-04 17:34:35 +08:00
Родитель e8b4f395c0
Коммит 5bc6a1cede
3 изменённых файлов: 16 добавлений и 3 удалений

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

@ -48,6 +48,7 @@ RtspOmxReader::Seek(int64_t aTime, int64_t aEndTime)
// seek operation. The function will clear the |mVideoQueue| and |mAudioQueue|
// that store the decoded data and also call the |DecodeToTarget| to pass
// the seek time to OMX a/v decoders.
mEnsureActiveFromSeek = true;
return MediaOmxReader::Seek(aTime, aEndTime);
}
@ -71,9 +72,13 @@ void RtspOmxReader::EnsureActive() {
if (mRtspResource) {
nsIStreamingProtocolController* controller =
mRtspResource->GetMediaStreamController();
if (controller) {
// We do not have to call Play if the EnsureActive request is from Seek
// operation because RTSP connection must already be established before
// performing Seek.
if (controller && !mEnsureActiveFromSeek) {
controller->Play();
}
mEnsureActiveFromSeek = false;
mRtspResource->SetSuspend(false);
}

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

@ -32,7 +32,9 @@ protected:
public:
RtspOmxReader(AbstractMediaDecoder* aDecoder)
: MediaOmxReader(aDecoder) {
: MediaOmxReader(aDecoder)
, mEnsureActiveFromSeek(false)
{
MOZ_COUNT_CTOR(RtspOmxReader);
NS_ASSERTION(mDecoder, "RtspOmxReader mDecoder is null.");
NS_ASSERTION(mDecoder->GetResource(),
@ -73,6 +75,8 @@ private:
// holds the MediaDecoderStateMachine and RtspMediaResource.
// And MediaDecoderStateMachine holds this RtspOmxReader.
RtspMediaResource* mRtspResource;
bool mEnsureActiveFromSeek;
};
} // namespace mozilla

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

@ -218,7 +218,11 @@ status_t RTSPSource::seekTo(int64_t seekTimeUs) {
sp<AMessage> msg = new AMessage(kWhatPerformSeek, mReflector->id());
msg->setInt32("generation", ++mSeekGeneration);
msg->setInt64("timeUs", seekTimeUs);
msg->post(200000ll);
// The original code in Android posts this message for 200ms delay in order
// to avoid performing multiple seeks in a short period of time. This is not
// necessary for us because MediaDecoderStateMachine already circumvents
// that situation.
msg->post();
return OK;
}