diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-12 14:03:23 -0500 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-03-12 14:03:23 -0500 |
commit | 33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7 (patch) | |
tree | faa52dddeecce0fc9585f19d4165af0e938b33d6 /media/mtp | |
parent | 2eb62955eb84b97695e8a7e56e14310cbb86412b (diff) | |
download | frameworks_av-33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7.zip frameworks_av-33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7.tar.gz frameworks_av-33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7.tar.bz2 |
MTP host: Fix problems reading large data packets
Fixes problem reading large thumbnails via PTP
Bug: 4065217
Change-Id: I643672512829c93ab0827091f39103dbb1918071
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp')
-rw-r--r-- | media/mtp/MtpDataPacket.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/media/mtp/MtpDataPacket.cpp b/media/mtp/MtpDataPacket.cpp index 801edb0..0b0c80d 100644 --- a/media/mtp/MtpDataPacket.cpp +++ b/media/mtp/MtpDataPacket.cpp @@ -28,7 +28,7 @@ namespace android { MtpDataPacket::MtpDataPacket() - : MtpPacket(512), + : MtpPacket(16384), // MAX_USBFS_BUFFER_SIZE mOffset(MTP_CONTAINER_HEADER_SIZE) { } @@ -399,10 +399,10 @@ int MtpDataPacket::read(struct usb_request *request) { if (length >= MTP_CONTAINER_HEADER_SIZE) { // look at the length field to see if the data spans multiple packets uint32_t totalLength = MtpPacket::getUInt32(MTP_CONTAINER_LENGTH_OFFSET); + allocate(totalLength); while (totalLength > length) { - allocate(length + mAllocationIncrement); request->buffer = mBuffer + length; - request->buffer_length = mAllocationIncrement; + request->buffer_length = totalLength - length; int ret = transfer(request); if (ret >= 0) length += ret; |