Files
palemoon27/dom/media/webaudio/BufferDecoder.cpp
T
trav90 fde7400175 Stop updating playback position from Ogg seek and remove MediaDecoder::UpdatePlaybackPosition
The ogg reader makes two adjustments to the seek time - the first is to clamp it between start and end time, which MDSM already does. The second is to subtract SEEK_OPUS_PREROLL from the target. If we wanted to, we could return this as the resolve value in the seek promise and handle the update in the MDSM. But DropVideoUpToSeekTarget should actually handle this just fine.
2018-07-25 01:03:05 +08:00

199 lines
3.4 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BufferDecoder.h"
#include "nsISupports.h"
#include "MediaResource.h"
namespace mozilla {
#ifdef PR_LOGGING
extern PRLogModuleInfo* gMediaDecoderLog;
#endif
NS_IMPL_ISUPPORTS0(BufferDecoder)
BufferDecoder::BufferDecoder(MediaResource* aResource)
: mReentrantMonitor("BufferDecoder")
, mResource(aResource)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_COUNT_CTOR(BufferDecoder);
#ifdef PR_LOGGING
if (!gMediaDecoderLog) {
gMediaDecoderLog = PR_NewLogModule("MediaDecoder");
}
#endif
}
BufferDecoder::~BufferDecoder()
{
// The dtor may run on any thread, we cannot be sure.
MOZ_COUNT_DTOR(BufferDecoder);
}
void
BufferDecoder::BeginDecoding(MediaTaskQueue* aTaskQueueIdentity)
{
MOZ_ASSERT(!mTaskQueueIdentity && aTaskQueueIdentity);
mTaskQueueIdentity = aTaskQueueIdentity;
}
ReentrantMonitor&
BufferDecoder::GetReentrantMonitor()
{
return mReentrantMonitor;
}
bool
BufferDecoder::IsShutdown() const
{
// BufferDecoder cannot be shut down.
return false;
}
bool
BufferDecoder::OnStateMachineThread() const
{
// BufferDecoder doesn't have the concept of a state machine.
return true;
}
bool
BufferDecoder::OnDecodeThread() const
{
MOZ_ASSERT(mTaskQueueIdentity, "Forgot to call BeginDecoding?");
return mTaskQueueIdentity->IsCurrentThreadIn();
}
MediaResource*
BufferDecoder::GetResource() const
{
return mResource;
}
void
BufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset)
{
// ignore
}
void
BufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded,
uint32_t aDropped)
{
// ignore
}
int64_t
BufferDecoder::GetMediaDuration()
{
// unknown
return -1;
}
void
BufferDecoder::SetMediaDuration(int64_t aDuration)
{
// ignore
}
void
BufferDecoder::UpdateEstimatedMediaDuration(int64_t aDuration)
{
// ignore
}
void
BufferDecoder::SetMediaSeekable(bool aMediaSeekable)
{
// ignore
}
VideoFrameContainer*
BufferDecoder::GetVideoFrameContainer()
{
// no video frame
return nullptr;
}
layers::ImageContainer*
BufferDecoder::GetImageContainer()
{
// no image container
return nullptr;
}
bool
BufferDecoder::IsTransportSeekable()
{
return false;
}
bool
BufferDecoder::IsMediaSeekable()
{
return false;
}
void
BufferDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags, MediaDecoderEventVisibility aEventVisibility)
{
// ignore
}
void
BufferDecoder::FirstFrameLoaded(nsAutoPtr<MediaInfo> aInfo, MediaDecoderEventVisibility aEventVisibility)
{
// ignore
}
void
BufferDecoder::QueueMetadata(int64_t aTime, nsAutoPtr<MediaInfo> aInfo, nsAutoPtr<MetadataTags> aTags)
{
// ignore
}
void
BufferDecoder::RemoveMediaTracks()
{
// ignore
}
void
BufferDecoder::SetMediaEndTime(int64_t aTime)
{
// ignore
}
void
BufferDecoder::OnReadMetadataCompleted()
{
// ignore
}
void
BufferDecoder::NotifyWaitingForResourcesStatusChanged()
{
// ignore
}
void
BufferDecoder::NotifyDataArrived(const char* aBuffer, uint32_t aLength, int64_t aOffset)
{
// ignore
}
MediaDecoderOwner*
BufferDecoder::GetOwner()
{
// unknown
return nullptr;
}
} // namespace mozilla