Bug 1187118 - [WIP] debug log draft
authorKaku Kuo <kaku@mozilla.com>
Thu, 23 Feb 2017 11:24:36 +0800
changeset 488569 00d7f8cd84cd160d8ed179130bfd334ebfa10d3c
parent 488568 6cdb98f04f518bdc45eeda6b675ecfe536d81c02
child 488570 bc55c1e835f6945d0858bba77a9dda328bb04939
push id46579
push userbmo:kaku@mozilla.com
push dateThu, 23 Feb 2017 10:26:35 +0000
bugs1187118
milestone54.0a1
Bug 1187118 - [WIP] debug log MozReview-Commit-ID: AarQUPGJTPG
dom/media/gif/GIFDemuxer.cpp
dom/media/platforms/agnostic/GIFDataDecoder.cpp
--- a/dom/media/gif/GIFDemuxer.cpp
+++ b/dom/media/gif/GIFDemuxer.cpp
@@ -343,16 +343,18 @@ already_AddRefed<MediaRawData>
 GIFTrackDemuxer::ConvertFrameToMediaRawData(RawAccessFrameRef& aFrame)
 {
   // Kaku: This is a hard copy of the underlying data, we should do something
   //       more efficient.
   uint8_t* data = nullptr;
   uint32_t length = -1;
   aFrame->GetImageData(&data, &length);
   RefPtr<MediaRawData> sample = new MediaRawData(data, length);
+printf_stderr("New frame: ----------------\n");
+printf_stderr("New frame: length = %d, aFrame->GetIsPaletted() = %d\n", length, aFrame->GetIsPaletted());
 
   // We insert the frame header in mExtraData
   sample->mExtraData = new MediaByteBuffer();
   {
     gfx::IntSize size = aFrame->GetSize();
     uint8_t* p = reinterpret_cast<uint8_t*>(&size);
     for (uint32_t i = 0; i < sizeof(aFrame->GetSize()); i++, p++) {
       sample->mExtraData->AppendElement(*p);
@@ -363,16 +365,18 @@ GIFTrackDemuxer::ConvertFrameToMediaRawD
 
   // Kaku: am I using the right information?
   const AnimationData animationData = aFrame->GetAnimationData();
   media::TimeUnit time = media::TimeUnit::FromMicroseconds((int64_t)animationData.mTimeout.AsMilliseconds() * 1000);
   sample->mDuration = time.ToMicroseconds();
   sample->mTime = mTime;
   sample->mKeyframe = true;
   sample->mTimecode = mTime;
+printf_stderr("New frame: sample->mTime = %lld, sample->mDuration = %lld\n", sample->mTime, sample->mDuration);
+printf_stderr("New frame: width = %d, height = %d\n", aFrame->GetSize().width, aFrame->GetSize().height);
 
   // Update the decoded range.
   mTime += time.ToMicroseconds();
 
   return sample.forget();
 }
 
 } // namespace mozilla
--- a/dom/media/platforms/agnostic/GIFDataDecoder.cpp
+++ b/dom/media/platforms/agnostic/GIFDataDecoder.cpp
@@ -50,16 +50,19 @@ GIFDataDecoder::Decode(MediaRawData* aSa
 
 RefPtr<MediaDataDecoder::DecodePromise>
 GIFDataDecoder::ProcessDecode(MediaRawData* aSample)
 {
   MOZ_ASSERT(aSample->mExtraData->Length() == 8,
     "Something is wrong about the size of mExtraData");
 
   gfx::IntSize frameSize = *(reinterpret_cast<gfx::IntSize*>(aSample->mExtraData->Elements()));
+
+printf_stderr("GIFDataDecoder::ProcessDecode: width = %d, height = %d\n", frameSize.width, frameSize.height);
+
   RefPtr<Image> image = CreateSharedRGBImage(mImageContainer, frameSize, gfxImageFormat::A8R8G8B8);
   RefPtr<SharedRGBImage> sharedRGBImage = static_cast<SharedRGBImage*>(image.get());
   memcpy(sharedRGBImage->GetBuffer(), aSample->Data(), aSample->Size());
   const IntRect picture(0, 0, frameSize.width, frameSize.height);
 
   RefPtr<VideoData> v = VideoData::CreateFromImage(mInfo,
                                                    aSample->mOffset,
                                                    aSample->mTime,