MTP Streaming: Optimize header verification.
commit88c8cb264719a9ae817803b0260fc07a6acb03c7
authortommycli@chromium.org <tommycli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 4 Mar 2014 20:55:57 +0000 (4 20:55 +0000)
committertommycli@chromium.org <tommycli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 4 Mar 2014 20:55:57 +0000 (4 20:55 +0000)
tree2f6cd36676567283c41da61833c161260c507b58
parent733f7fed2dcfe92c9d94d225051d376580d8a43f
MTP Streaming: Optimize header verification.

Currently, for MTP streaming, we make a special request for the header bytes, to verify that it is indeed a media file.

In the common case of reading from start to finish, this is wasteful, as the originally requested read starts from the 0th byte and includes the header bytes anyways.

This detects that case, and reads the first chunk directly, and then looks at the header bytes within that.

BUG=110119

Review URL: https://codereview.chromium.org/185593008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254818 0039d316-1c4b-4281-b951-d872f2087c98
chrome/browser/media_galleries/fileapi/mtp_file_stream_reader.cc