Bug 1320705: P1. Fix function prototyping. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 30 Nov 2016 17:18:58 +1100
changeset 325255 255480c6f63c3cc36b491f9abf1ff1bed456bd0f
parent 325254 fef5e39a4c3a0b9c4d3fbe5bd098fc17bf7bbb27
child 325256 bea4ed2781a85d5c6b5128f3cf7b6c6400a69590
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +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);