Merge "For thumbnail extraction make sure we instantiate a decoder that allows access to the framebuffer. Implement the samsung workaround to support this by reconfiguring the decoder." into gingerbread
diff --git a/media/libstagefright/MPEG2TSWriter.cpp b/media/libstagefright/MPEG2TSWriter.cpp
index b3daf67..81a2b0d 100644
--- a/media/libstagefright/MPEG2TSWriter.cpp
+++ b/media/libstagefright/MPEG2TSWriter.cpp
@@ -725,6 +725,14 @@
size_t PES_packet_length = accessUnit->size() + 8;
+ if (PES_packet_length >= 65536) {
+ // This really should only happen for video.
+ CHECK_EQ(stream_id, 0xe0u);
+
+ // It's valid to set this to 0 for video according to the specs.
+ PES_packet_length = 0;
+ }
+
uint8_t *ptr = buffer->data();
*ptr++ = 0x47;
*ptr++ = 0x40 | (PID >> 8);