Backed out changeset 475f82f18288 (bug 1535766) because it shouldn't have landed on beta. a=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 25 Mar 2019 16:54:30 +0100
changeset 525706 1dabaf68f8fe6e50d20202773f1a8bd95dadb4b4
parent 525705 6db60f4d14eefd1a17451476a178a64286221cf1
child 525707 14e8cc18791dd9bb7c1f0580cf62ab52ecab51aa
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1535766
milestone67.0
backs out475f82f18288433b2a972c4d28a784bf323fe70b
Backed out changeset 475f82f18288 (bug 1535766) because it shouldn't have landed on beta. a=backout
media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
--- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
+++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp
@@ -2,17 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WebrtcGmpVideoCodec.h"
 
 #include <vector>
 
 #include "mozilla/CheckedInt.h"
-#include "mozilla/EndianUtils.h"
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Move.h"
 #include "mozilla/SyncRunnable.h"
 #include "VideoConduit.h"
 #include "AudioConduit.h"
 #include "runnable_utils.h"
 
 #include "mozIGeckoMediaPluginService.h"
@@ -508,22 +507,16 @@ void WebrtcGmpVideoEncoder::Encoded(
           aEncodedFrame->TimeStamp(), aEncodedFrame->BufferType(),
           aEncodedFrame->Size()));
 
     // Right now makes one Encoded() callback per unit
     // XXX convert to FragmentationHeader format (array of offsets and sizes
     // plus a buffer) in combination with H264 packetization changes in
     // webrtc/trunk code
     uint8_t* buffer = aEncodedFrame->Buffer();
-
-    if (!buffer) {
-      LOG(LogLevel::Error, ("GMP plugin returned null buffer"));
-      return;
-    }
-
     uint8_t* end = aEncodedFrame->Buffer() + aEncodedFrame->Size();
     size_t size_bytes;
     switch (aEncodedFrame->BufferType()) {
       case GMP_BufferSingle:
         size_bytes = 0;
         break;
       case GMP_BufferLength8:
         size_bytes = 1;
@@ -557,39 +550,31 @@ void WebrtcGmpVideoEncoder::Encoded(
       switch (aEncodedFrame->BufferType()) {
         case GMP_BufferSingle:
           size = aEncodedFrame->Size();
           break;
         case GMP_BufferLength8:
           size = *buffer++;
           break;
         case GMP_BufferLength16:
-// The plugin is expected to encode data in native byte order
-#ifdef MOZ_LITTLE_ENDIAN
-          size = LittleEndian::readUint16(buffer);
-#else
-          size = BigEndian::readUint16(buffer);
-#endif
+          // presumes we can do unaligned loads
+          size = *(reinterpret_cast<uint16_t*>(buffer));
           buffer += 2;
           break;
         case GMP_BufferLength24:
           // 24-bits is a pain, since byte-order issues make things painful
           // I'm going to define 24-bit as little-endian always; big-endian must
           // convert
           size = ((uint32_t)*buffer) | (((uint32_t) * (buffer + 1)) << 8) |
                  (((uint32_t) * (buffer + 2)) << 16);
           buffer += 3;
           break;
         case GMP_BufferLength32:
-// The plugin is expected to encode data in native byte order
-#ifdef MOZ_LITTLE_ENDIAN
-          size = LittleEndian::readUint32(buffer);
-#else
-          size = BigEndian::readUint32(buffer);
-#endif
+          // presumes we can do unaligned loads
+          size = *(reinterpret_cast<uint32_t*>(buffer));
           buffer += 4;
           break;
         default:
           MOZ_CRASH("GMP_BufferType already handled in switch above");
       }
       MOZ_ASSERT(size != 0 &&
                  buffer + size <=
                      end);  // in non-debug code, don't crash in this case