2015-05-01 08:26:50 +03:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef RESOURCESTREAM_H_
|
|
|
|
#define RESOURCESTREAM_H_
|
|
|
|
|
|
|
|
#include "MediaResource.h"
|
2017-11-17 09:30:09 +03:00
|
|
|
#include "ByteStream.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2015-05-01 08:26:50 +03:00
|
|
|
|
2017-11-17 09:30:09 +03:00
|
|
|
namespace mozilla
|
2015-05-01 08:26:50 +03:00
|
|
|
{
|
|
|
|
|
Bug 1407810 - Use DDLogger in media stack - r=jwwang
Mostly-mechanical additions:
- Log constructions&destructions, usually by just inheriting from
DecoderDoctorLifeLogger, otherwise with explicit log commands (for internal
classes for which DecoderDoctorTraits can't be specialized),
- Log links between most objects, e.g.: Media element -> decoder -> state
machine -> reader -> demuxer -> resource, etc.
And logging some important properties and events (JS events, duration change,
frames being decoded, etc.)
More will be added later on, from just converting MOZ_LOGs, and as needed.
MozReview-Commit-ID: KgNhHSz35t0
--HG--
extra : rebase_source : dd7206e350e32671adc6f3b9e54ebf777251de2c
2017-10-10 09:55:27 +03:00
|
|
|
DDLoggedTypeDeclNameAndBase(ResourceStream, ByteStream);
|
|
|
|
|
|
|
|
class ResourceStream
|
|
|
|
: public ByteStream
|
|
|
|
, public DecoderDoctorLifeLogger<ResourceStream>
|
2015-05-01 08:26:50 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit ResourceStream(mozilla::MediaResource* aResource);
|
|
|
|
|
|
|
|
virtual bool ReadAt(int64_t offset, void* aBuffer, size_t aCount,
|
|
|
|
size_t* aBytesRead) override;
|
|
|
|
virtual bool CachedReadAt(int64_t aOffset, void* aBuffer, size_t aCount,
|
|
|
|
size_t* aBytesRead) override;
|
|
|
|
virtual bool Length(int64_t* size) override;
|
|
|
|
|
|
|
|
void Pin()
|
|
|
|
{
|
2017-05-31 09:17:37 +03:00
|
|
|
mResource.GetResource()->Pin();
|
2015-05-01 08:26:50 +03:00
|
|
|
++mPinCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Unpin()
|
|
|
|
{
|
2017-05-31 09:17:37 +03:00
|
|
|
mResource.GetResource()->Unpin();
|
2015-05-01 08:26:50 +03:00
|
|
|
MOZ_ASSERT(mPinCount);
|
|
|
|
--mPinCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~ResourceStream();
|
|
|
|
|
|
|
|
private:
|
2017-05-31 09:17:37 +03:00
|
|
|
mozilla::MediaResourceIndex mResource;
|
2015-05-01 08:26:50 +03:00
|
|
|
uint32_t mPinCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // RESOURCESTREAM_H_
|