Bug 994557 - part1:fix formatting, typo, 80 characters. r=rillian
authorBenjamin Chen <bechen@mozilla.com>
Wed, 23 Apr 2014 10:32:46 +0800
changeset 198236 0930742ce5c6e9c2ee97ef7e8037cbd7c7c853c0
parent 198235 4f69b95c714fdac4d9c70146aac90801e157e13b
child 198237 80dba24cc92979858f88cffdccde906a3b6d8308
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs994557
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 994557 - part1:fix formatting, typo, 80 characters. r=rillian
content/media/webm/EbmlComposer.cpp
--- a/content/media/webm/EbmlComposer.cpp
+++ b/content/media/webm/EbmlComposer.cpp
@@ -26,17 +26,18 @@ void EbmlComposer::GenerateHeader()
   ebml.buf = buffer.get();
   ebml.offset = 0;
   writeHeader(&ebml);
   {
     EbmlLoc segEbmlLoc, ebmlLocseg, ebmlLoc;
     Ebml_StartSubElement(&ebml, &segEbmlLoc, Segment);
     {
       Ebml_StartSubElement(&ebml, &ebmlLocseg, SeekHead);
-      // Todo: We don't know the exact sizes of encoded data and ignore this section.
+      // Todo: We don't know the exact sizes of encoded data and
+      // ignore this section.
       Ebml_EndSubElement(&ebml, &ebmlLocseg);
       writeSegmentInformation(&ebml, &ebmlLoc, TIME_CODE_SCALE, 0);
       {
         EbmlLoc trackLoc;
         Ebml_StartSubElement(&ebml, &trackLoc, Tracks);
         {
           // Video
           if (mWidth > 0 && mHeight > 0) {
@@ -49,30 +50,31 @@ void EbmlComposer::GenerateHeader()
             writeAudioTrack(&ebml, 0x2, 0x0, "A_VORBIS", mSampleFreq,
                             mChannels, mCodecPrivateData.Elements(),
                             mCodecPrivateData.Length());
           }
         }
         Ebml_EndSubElement(&ebml, &trackLoc);
       }
     }
-    // The Recording length is unknow and ignore write the whole Segment element size
+    // The Recording length is unknown and
+    // ignore write the whole Segment element size
   }
   MOZ_ASSERT(ebml.offset <= DEFAULT_HEADER_SIZE + mCodecPrivateData.Length(),
              "write more data > EBML_BUFFER_SIZE");
   mClusterBuffs.AppendElement();
   mClusterBuffs.LastElement().SetLength(ebml.offset);
   memcpy(mClusterBuffs.LastElement().Elements(), ebml.buf, ebml.offset);
 }
 
 void EbmlComposer::FinishCluster()
 {
   MOZ_ASSERT(mClusterLengthLoc > 0 );
   MOZ_ASSERT(mClusterHeaderIndex > 0);
-  for (uint32_t i = 0; i < mClusterBuffs.Length(); i ++ ) {
+  for (uint32_t i = 0; i < mClusterBuffs.Length(); i++) {
     mClusterCanFlushBuffs.AppendElement()->SwapElements(mClusterBuffs[i]);
   }
   mClusterBuffs.Clear();
   EbmlGlobal ebml;
   EbmlLoc ebmlLoc;
   ebmlLoc.offset = mClusterLengthLoc;
   ebml.offset = mClusterCanFlushBuffs[mClusterHeaderIndex].Length();
   ebml.buf = mClusterCanFlushBuffs[mClusterHeaderIndex].Elements();
@@ -93,36 +95,39 @@ EbmlComposer::WriteSimpleBlock(EncodedFr
 
   mClusterBuffs.AppendElement();
   mClusterBuffs.LastElement().SetLength(aFrame->GetFrameData().Length() + DEFAULT_HEADER_SIZE);
   ebml.buf = mClusterBuffs.LastElement().Elements();
 
   if (aFrame->GetFrameType() == EncodedFrame::FrameType::VP8_I_FRAME) {
     EbmlLoc ebmlLoc;
     Ebml_StartSubElement(&ebml, &ebmlLoc, Cluster);
-    mClusterHeaderIndex = mClusterBuffs.Length() - 1; // current cluster header array index
+    // current cluster header array index
+    mClusterHeaderIndex = mClusterBuffs.Length() - 1;
     mClusterLengthLoc = ebmlLoc.offset;
     if (aFrame->GetFrameType() != EncodedFrame::FrameType::VORBIS_AUDIO_FRAME) {
       mClusterTimecode = aFrame->GetTimeStamp() / PR_USEC_PER_MSEC;
     }
     Ebml_SerializeUnsigned(&ebml, Timecode, mClusterTimecode);
   }
 
   if (aFrame->GetFrameType() != EncodedFrame::FrameType::VORBIS_AUDIO_FRAME) {
-    short timeCode = aFrame->GetTimeStamp() / PR_USEC_PER_MSEC - mClusterTimecode;
+    short timeCode = aFrame->GetTimeStamp() / PR_USEC_PER_MSEC
+                     - mClusterTimecode;
     writeSimpleBlock(&ebml, 0x1, timeCode, aFrame->GetFrameType() ==
                      EncodedFrame::FrameType::VP8_I_FRAME,
                      0, 0, (unsigned char*)aFrame->GetFrameData().Elements(),
                      aFrame->GetFrameData().Length());
   } else {
     writeSimpleBlock(&ebml, 0x2, 0, false,
                      0, 0, (unsigned char*)aFrame->GetFrameData().Elements(),
                      aFrame->GetFrameData().Length());
   }
-  MOZ_ASSERT(ebml.offset <= DEFAULT_HEADER_SIZE + aFrame->GetFrameData().Length(),
+  MOZ_ASSERT(ebml.offset <= DEFAULT_HEADER_SIZE +
+             aFrame->GetFrameData().Length(),
              "write more data > EBML_BUFFER_SIZE");
   mClusterBuffs.LastElement().SetLength(ebml.offset);
 }
 
 void
 EbmlComposer::SetVideoConfig(uint32_t aWidth, uint32_t aHeight,
                              uint32_t aDisplayWidth, uint32_t aDisplayHeight,
                              float aFrameRate)
@@ -154,17 +159,17 @@ EbmlComposer::SetAudioConfig(uint32_t aS
 void
 EbmlComposer::ExtractBuffer(nsTArray<nsTArray<uint8_t> >* aDestBufs,
                             uint32_t aFlag)
 {
   if ((aFlag & ContainerWriter::FLUSH_NEEDED) && mClusterHeaderIndex > 0) {
     FinishCluster();
   }
   // aDestBufs may have some element
-  for (uint32_t i = 0; i < mClusterCanFlushBuffs.Length(); i ++ ) {
+  for (uint32_t i = 0; i < mClusterCanFlushBuffs.Length(); i++) {
     aDestBufs->AppendElement()->SwapElements(mClusterCanFlushBuffs[i]);
   }
   mClusterCanFlushBuffs.Clear();
 }
 
 EbmlComposer::EbmlComposer()
   : mClusterHeaderIndex(0)
   , mClusterLengthLoc(0)