mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1062666
- Add a debug-only dump method to MediaSource for debugging issues with appended data.
This commit is contained in:
parent
09e4e096d1
commit
fb4f149b1f
@ -28,6 +28,11 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#if defined(DEBUG)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
||||
@ -507,6 +512,20 @@ MediaSource::InitializationEvent()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void
|
||||
MediaSource::Dump(const char* aPath)
|
||||
{
|
||||
char buf[255];
|
||||
PR_snprintf(buf, sizeof(buf), "%s/mediasource-%p", aPath, this);
|
||||
mkdir(buf, 0700);
|
||||
|
||||
if (mSourceBuffers) {
|
||||
mSourceBuffers->Dump(buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsPIDOMWindow*
|
||||
MediaSource::GetParentObject() const
|
||||
{
|
||||
|
@ -98,6 +98,12 @@ public:
|
||||
// initialization.
|
||||
void QueueInitializationEvent();
|
||||
|
||||
#if defined(DEBUG)
|
||||
// Dump the contents of each SourceBuffer to a series of files under aPath.
|
||||
// aPath must exist. Debug only, invoke from your favourite debugger.
|
||||
void Dump(const char* aPath);
|
||||
#endif
|
||||
|
||||
private:
|
||||
~MediaSource();
|
||||
|
||||
|
@ -134,6 +134,23 @@ public:
|
||||
return size;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Dump(const char* aPath) {
|
||||
for (uint32_t i = 0; i < uint32_t(GetSize()); ++i) {
|
||||
ResourceItem* item = ResourceAt(i);
|
||||
|
||||
char buf[255];
|
||||
PR_snprintf(buf, sizeof(buf), "%s/%08u.bin", aPath, i);
|
||||
FILE* fp = fopen(buf, "wb");
|
||||
if (!fp) {
|
||||
return;
|
||||
}
|
||||
fwrite(item->mData.Elements(), item->mData.Length(), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
ResourceItem* ResourceAt(uint32_t aIndex) const {
|
||||
return static_cast<ResourceItem*>(ObjectAt(aIndex));
|
||||
@ -173,6 +190,5 @@ private:
|
||||
uint64_t mOffset;
|
||||
};
|
||||
|
||||
|
||||
} // namespace mozilla
|
||||
#endif /* MOZILLA_RESOURCEQUEUE_H_ */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- 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
|
||||
@ -687,6 +688,16 @@ SourceBuffer::Evict(double aStart, double aEnd)
|
||||
mTrackBuffer->EvictBefore(evictTime);
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void
|
||||
SourceBuffer::Dump(const char* aPath)
|
||||
{
|
||||
if (mTrackBuffer) {
|
||||
mTrackBuffer->Dump(aPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(SourceBuffer, DOMEventTargetHelper,
|
||||
mMediaSource)
|
||||
|
||||
|
@ -109,6 +109,10 @@ public:
|
||||
double GetBufferedStart();
|
||||
double GetBufferedEnd();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Dump(const char* aPath);
|
||||
#endif
|
||||
|
||||
private:
|
||||
~SourceBuffer();
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- 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
|
||||
|
@ -167,6 +167,16 @@ SourceBufferList::QueueAsyncSimpleEvent(const char* aName)
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void
|
||||
SourceBufferList::Dump(const char* aPath)
|
||||
{
|
||||
for (uint32_t i = 0; i < mSourceBuffers.Length(); ++i) {
|
||||
mSourceBuffers[i]->Dump(aPath);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SourceBufferList::SourceBufferList(MediaSource* aMediaSource)
|
||||
: DOMEventTargetHelper(aMediaSource->GetParentObject())
|
||||
, mMediaSource(aMediaSource)
|
||||
|
@ -79,6 +79,10 @@ public:
|
||||
// Returns the highest end time of any of the Sourcebuffers.
|
||||
double GetHighestBufferedEndTime();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Dump(const char* aPath);
|
||||
#endif
|
||||
|
||||
private:
|
||||
~SourceBufferList();
|
||||
|
||||
|
@ -120,6 +120,12 @@ public:
|
||||
// Remove data from resource before the given offset.
|
||||
void EvictBefore(uint64_t aOffset);
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Dump(const char* aPath) {
|
||||
mInputBuffer.Dump(aPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
~SourceBufferResource();
|
||||
nsresult SeekInternal(int64_t aOffset);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- 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
|
||||
@ -349,4 +350,22 @@ TrackBuffer::Decoders()
|
||||
return mInitializedDecoders;
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
void
|
||||
TrackBuffer::Dump(const char* aPath)
|
||||
{
|
||||
char path[255];
|
||||
PR_snprintf(path, sizeof(path), "%s/trackbuffer-%p", aPath, this);
|
||||
mkdir(path, 0700);
|
||||
|
||||
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
|
||||
char buf[255];
|
||||
PR_snprintf(buf, sizeof(buf), "%s/reader-%p", path, mDecoders[i]->GetReader());
|
||||
mkdir(buf, 0700);
|
||||
|
||||
mDecoders[i]->GetResource()->Dump(buf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -82,6 +82,10 @@ public:
|
||||
// TODO: Refactor to a cleaner interface between TrackBuffer and MediaSourceReader.
|
||||
const nsTArray<nsRefPtr<SourceBufferDecoder>>& Decoders();
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Dump(const char* aPath);
|
||||
#endif
|
||||
|
||||
private:
|
||||
~TrackBuffer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user