Skip to content

Commit 7f87d9c

Browse files
Mike LockwoodAndroid (Google) Code Review
authored andcommitted
Merge "MTP: Don't attempt to read more than 16K at a time from the MTP driver DO NOT MERGE" into ics-mr1
2 parents 25bcbbb + 7a1ad63 commit 7f87d9c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

media/mtp/MtpDataPacket.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
#include "MtpDataPacket.h"
2626
#include "MtpStringBuffer.h"
2727

28+
#define MTP_BUFFER_SIZE 16384
29+
2830
namespace android {
2931

3032
MtpDataPacket::MtpDataPacket()
31-
: MtpPacket(16384), // MAX_USBFS_BUFFER_SIZE
33+
: MtpPacket(MTP_BUFFER_SIZE), // MAX_USBFS_BUFFER_SIZE
3234
mOffset(MTP_CONTAINER_HEADER_SIZE)
3335
{
3436
}
@@ -345,7 +347,7 @@ void MtpDataPacket::putString(const uint16_t* string) {
345347

346348
#ifdef MTP_DEVICE
347349
int MtpDataPacket::read(int fd) {
348-
int ret = ::read(fd, mBuffer, mBufferSize);
350+
int ret = ::read(fd, mBuffer, MTP_BUFFER_SIZE);
349351
if (ret < MTP_CONTAINER_HEADER_SIZE)
350352
return -1;
351353
mPacketSize = ret;

0 commit comments

Comments
 (0)