Bug 1320705: P1. Fix function prototyping. r?gerald
Returning already_AddRefed is by convention preferred.
MozReview-Commit-ID: 1UyIcyBm923
--- a/dom/media/ogg/OggCodecState.cpp
+++ b/dom/media/ogg/OggCodecState.cpp
@@ -223,17 +223,17 @@ OggCodecState::PacketPeek()
void
OggCodecState::PushFront(OggPacketQueue &&aOther)
{
while (!aOther.IsEmpty()) {
mPackets.PushFront(aOther.Pop());
}
}
-RefPtr<MediaRawData>
+already_AddRefed<MediaRawData>
OggCodecState::PacketOutAsMediaRawData()
{
ogg_packet* packet = PacketOut();
if (!packet) {
return nullptr;
}
NS_ASSERTION(!IsHeader(packet), "PacketOutAsMediaRawData can only be called on non-header packets");
@@ -248,17 +248,17 @@ OggCodecState::PacketOutAsMediaRawData()
sample->mTimecode = packet->granulepos;
sample->mTime = end_tstamp - duration;
sample->mDuration = duration;
sample->mKeyframe = IsKeyframe(packet);
sample->mEOS = packet->e_o_s;
ReleasePacket(packet);
- return sample;
+ return sample.forget();
}
nsresult
OggCodecState::PageIn(ogg_page* aPage)
{
if (!mActive) {
return NS_OK;
}
--- a/dom/media/ogg/OggCodecState.h
+++ b/dom/media/ogg/OggCodecState.h
@@ -190,17 +190,17 @@ public:
// Releases the memory used by a cloned packet. Every packet returned by
// PacketOut() must be free'd using this function.
static void ReleasePacket(ogg_packet* aPacket);
// Returns the next packet in the stream as a MediaRawData, or nullptr
// if there are no more packets buffered in the packet queue. More packets
// can be buffered by inserting one or more pages into the stream by calling
// PageIn(). The packet will have a valid granulepos.
- virtual RefPtr<MediaRawData> PacketOutAsMediaRawData();
+ virtual already_AddRefed<MediaRawData> PacketOutAsMediaRawData();
// Extracts all packets from the page, and inserts them into the packet
// queue. They can be extracted by calling PacketOut(). Packets from an
// inactive stream are not buffered, i.e. this call has no effect for
// inactive streams. Multiple pages may need to be inserted before
// PacketOut() starts to return packets, as granulepos may need to be
// captured.
virtual nsresult PageIn(ogg_page* aPage);