Bug 1320705: P1. Fix function prototyping. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 30 Nov 2016 17:18:58 +1100
changeset 447398 90d44881a02cd089b6338fa2324b676830dfec1e
parent 447397 2c3a734fca12fb844edc002d10c6e4c806164056
child 447399 6ca28565d22c01bede8dbcc2b891ac2913580d28
push id38050
push userbmo:jyavenard@mozilla.com
push dateSun, 04 Dec 2016 20:45:36 +0000
reviewersgerald
bugs1320705
milestone53.0a1
Bug 1320705: P1. Fix function prototyping. r?gerald Returning already_AddRefed is by convention preferred. MozReview-Commit-ID: 1UyIcyBm923
dom/media/ogg/OggCodecState.cpp
dom/media/ogg/OggCodecState.h
--- 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);