Closed Bug 818672 Opened 13 years ago Closed 13 years ago

Implement BufferMediaResource

Categories

(Core :: Audio/Video, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 1 obsolete file)

This class implements a MediaResource which encapsulates an in-memory buffer. I need this for my decodeAudioData implementation.
Attached patch Patch (v1) (obsolete) — Splinter Review
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #688939 - Flags: review?(cpearce)
Comment on attachment 688939 [details] [diff] [review] Patch (v1) Review of attachment 688939 [details] [diff] [review]: ----------------------------------------------------------------- Not sure what you should do in GetCurrentPrincipal(), Roc would know. ::: content/media/BufferMediaResource.h @@ +23,5 @@ > + mBuffer(aBuffer), > + mLength(aLength), > + mOffset(0) > + { > + MOZ_COUNT_CTOR(MediaResource); Shouldn't this be MOZ_COUNT_CTOR(BufferMediaResource) ?
Attachment #688939 - Flags: review?(cpearce) → review?(roc)
(In reply to comment #2) > ::: content/media/BufferMediaResource.h > @@ +23,5 @@ > > + mBuffer(aBuffer), > > + mLength(aLength), > > + mOffset(0) > > + { > > + MOZ_COUNT_CTOR(MediaResource); > > Shouldn't this be MOZ_COUNT_CTOR(BufferMediaResource) ? Of course. I'll fix that when landing.
Comment on attachment 688939 [details] [diff] [review] Patch (v1) Review of attachment 688939 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/media/BufferMediaResource.h @@ +37,5 @@ > + virtual void Resume() {} > + // Get the current principal for the channel > + virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() > + { > + return nullptr; I think you should pass in a principal to the constructor that gets used here. @@ +91,5 @@ > + virtual void Pin() {} > + virtual void Unpin() {} > + virtual double GetDownloadRate(bool* aIsReliable) { return 0.; } > + virtual int64_t GetLength() { return mLength; } > + virtual int64_t GetNextCachedData(int64_t aOffset) { return 0; } We should treat everything as cached, so this should return aOffset. @@ +92,5 @@ > + virtual void Unpin() {} > + virtual double GetDownloadRate(bool* aIsReliable) { return 0.; } > + virtual int64_t GetLength() { return mLength; } > + virtual int64_t GetNextCachedData(int64_t aOffset) { return 0; } > + virtual int64_t GetCachedDataEnd(int64_t aOffset) { return 0; } Should return mLength. @@ +93,5 @@ > + virtual double GetDownloadRate(bool* aIsReliable) { return 0.; } > + virtual int64_t GetLength() { return mLength; } > + virtual int64_t GetNextCachedData(int64_t aOffset) { return 0; } > + virtual int64_t GetCachedDataEnd(int64_t aOffset) { return 0; } > + virtual bool IsDataCachedToEndOfResource(int64_t aOffset) { return false; } Should return true. @@ +100,5 @@ > + virtual nsresult ReadFromCache(char* aBuffer, > + int64_t aOffset, > + uint32_t aCount) > + { > + return NS_ERROR_FAILURE; Should behave like Read. @@ +116,5 @@ > + } > + > + virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) > + { > + return NS_ERROR_FAILURE; This should return a single range containing the entire resource.
(In reply to comment #4) > ::: content/media/BufferMediaResource.h > @@ +37,5 @@ > > + virtual void Resume() {} > > + // Get the current principal for the channel > > + virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal() > > + { > > + return nullptr; > > I think you should pass in a principal to the constructor that gets used here. What would that principal be? I can accept that as an argument to the ctor, but it's still would be null. Is that OK?
Attached patch Patch (v2)Splinter Review
Attachment #688939 - Attachment is obsolete: true
Attachment #688939 - Flags: review?(roc)
Attachment #689016 - Flags: review?(roc)
(In reply to Ehsan Akhgari [:ehsan] from comment #5) > What would that principal be? I can accept that as an argument to the ctor, > but it's still would be null. Is that OK? Anything accessing the contents of the resource must have a principal that subsumes the resource's principal. So use the principal of the window that called decode I guess.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: