2014-08-26 08:53:48 +04: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 BUFFER_STREAM_H_
|
|
|
|
#define BUFFER_STREAM_H_
|
|
|
|
|
2017-11-17 09:30:09 +03:00
|
|
|
#include "ByteStream.h"
|
2014-09-11 07:57:33 +04:00
|
|
|
#include "nsTArray.h"
|
2015-05-11 13:54:59 +03:00
|
|
|
#include "MediaResource.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
2015-06-15 07:37:13 +03:00
|
|
|
class MediaByteBuffer;
|
2014-08-26 08:53:48 +04: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(BufferStream, ByteStream);
|
|
|
|
|
|
|
|
class BufferStream
|
|
|
|
: public ByteStream
|
|
|
|
, public mozilla::DecoderDoctorLifeLogger<BufferStream>
|
2014-08-26 08:53:48 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/* BufferStream does not take ownership of aData nor does it make a copy.
|
|
|
|
* Therefore BufferStream shouldn't get used after aData is destroyed.
|
|
|
|
*/
|
2014-09-11 07:57:33 +04:00
|
|
|
BufferStream();
|
2015-06-15 07:37:13 +03:00
|
|
|
explicit BufferStream(mozilla::MediaByteBuffer* aBuffer);
|
2014-08-26 08:53:48 +04:00
|
|
|
|
|
|
|
virtual bool ReadAt(int64_t aOffset, void* aData, size_t aLength,
|
2015-03-21 19:28:04 +03:00
|
|
|
size_t* aBytesRead) override;
|
2014-11-10 03:32:09 +03:00
|
|
|
virtual bool CachedReadAt(int64_t aOffset, void* aData, size_t aLength,
|
2015-03-21 19:28:04 +03:00
|
|
|
size_t* aBytesRead) override;
|
|
|
|
virtual bool Length(int64_t* aLength) override;
|
2014-08-26 08:53:48 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void DiscardBefore(int64_t aOffset) override;
|
2014-09-11 07:57:33 +04:00
|
|
|
|
2015-05-11 13:54:59 +03:00
|
|
|
bool AppendBytes(const uint8_t* aData, size_t aLength);
|
2014-09-11 07:57:33 +04:00
|
|
|
|
|
|
|
mozilla::MediaByteRange GetByteRange();
|
|
|
|
|
2014-08-26 08:53:48 +04:00
|
|
|
private:
|
2015-05-11 13:54:59 +03:00
|
|
|
~BufferStream();
|
2014-09-11 07:57:33 +04:00
|
|
|
int64_t mStartOffset;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::MediaByteBuffer> mData;
|
2014-08-26 08:53:48 +04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|