Bug 1133633: Part2. Enable async decoding on mac. r=mattmoodrow, a=sledru
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 31 Mar 2015 20:36:32 +1100
changeset 258427 10f75583d21a
parent 258426 fe0a2d7b08f3
child 258428 7efd806788be
push id4667
push userjyavenard@mozilla.com
push date2015-04-13 13:11 +0000
treeherdermozilla-beta@7efd806788be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattmoodrow, sledru
bugs1133633
milestone38.0
Bug 1133633: Part2. Enable async decoding on mac. r=mattmoodrow, a=sledru
dom/media/fmp4/apple/AppleVTDecoder.cpp
dom/media/fmp4/apple/VideoToolbox/VideoToolbox.h
--- a/dom/media/fmp4/apple/AppleVTDecoder.cpp
+++ b/dom/media/fmp4/apple/AppleVTDecoder.cpp
@@ -230,19 +230,22 @@ AppleVTDecoder::SubmitFrame(mp4_demuxer:
     return NS_ERROR_FAILURE;
   }
   CMSampleTimingInfo timestamp = TimingInfoFromSample(aSample);
   rv = CMSampleBufferCreate(kCFAllocatorDefault, block, true, 0, 0, mFormat, 1, 1, &timestamp, 0, NULL, sample.receive());
   if (rv != noErr) {
     NS_ERROR("Couldn't create CMSampleBuffer");
     return NS_ERROR_FAILURE;
   }
+
+  VTDecodeFrameFlags decodeFlags =
+    kVTDecodeFrame_EnableAsynchronousDecompression;
   rv = VTDecompressionSessionDecodeFrame(mSession,
                                          sample,
-                                         0,
+                                         decodeFlags,
                                          CreateAppleFrameRef(aSample),
                                          &flags);
   if (rv != noErr) {
     NS_WARNING("Couldn't pass frame to decoder");
     return NS_ERROR_FAILURE;
   }
 
   // Ask for more data.
--- a/dom/media/fmp4/apple/VideoToolbox/VideoToolbox.h
+++ b/dom/media/fmp4/apple/VideoToolbox/VideoToolbox.h
@@ -20,16 +20,22 @@
 #include <CoreVideo/CVPixelBuffer.h>
 
 typedef uint32_t VTDecodeFrameFlags;
 typedef uint32_t VTDecodeInfoFlags;
 enum {
   kVTDecodeInfo_Asynchronous = 1UL << 0,
   kVTDecodeInfo_FrameDropped = 1UL << 1,
 };
+enum {
+  kVTDecodeFrame_EnableAsynchronousDecompression = 1<<0,
+  kVTDecodeFrame_DoNotOutputFrame = 1<<1,
+  kVTDecodeFrame_1xRealTimePlayback = 1<<2,
+  kVTDecodeFrame_EnableTemporalProcessing = 1<<3,
+};
 
 typedef CFTypeRef VTSessionRef;
 typedef struct OpaqueVTDecompressionSession* VTDecompressionSessionRef;
 typedef void (*VTDecompressionOutputCallback)(
     void*,
     void*,
     OSStatus,
     VTDecodeInfoFlags,