Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Issue 68353002: Use MIDIMessageQueue/IsValidWebMIDIData for MIDI byte stream validation (Closed)

Created:
7 years, 1 month ago by yukawa
Modified:
7 years ago
CC:
chromium-reviews, feature-media-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Use MIDIMessageQueue/IsValidWebMIDIData for MIDI byte stream validation WebMIDI spec draft: http://www.w3.org/TR/webmidi/ WebMIDI API guarantees that MIDIInput::onmessage is called back with a single MIDI message. To guarantee this, this CL introduces MIDIMessageQueue class, which allows you to - maintain fragmented MIDI message. - Skip any invalid data sequence. - Reorder MIDI messages so that "System Real Time Message", which can be inserted at any point of the byte stream, can be placed at the boundary of complete MIDI messages. - (Optional) Reconstruct complete MIDI messages from data stream that is compressed with "running status". This CL also replaces existing System Exclusive message validation logic in MIDIHost::OnSendData with MIDIHost::IsValidWebMIDIData, which can detect SysEx message even when it is concatenated with non-SysEx messages. With this change, renderer/blink can be much simpler and free from this kind of data validation. BUG=303599, 317355 TEST=media_unittests --gtest_filter=MIDI*, content_unittests --gtest_filter=MIDI* Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=237558

Patch Set 1 : Use ScopedVector<T> instead to make legacy compilers happy. #

Total comments: 2

Patch Set 2 : Use MIDIMessageQueue from MIDIHost #

Total comments: 2

Patch Set 3 : Use MIDIMessageQueue in MIDIHost::OnSendData as well as MIDIHost::ReceiveMIDIData #

Total comments: 37

Patch Set 4 : Address comment except for the location of media/midi/midi_message_queue* #

Patch Set 5 : Address comment (CPSPolicy is cached, fixed vague comments) #

Patch Set 6 : Add IsValidMIDIMessagesForWebMIDI to avoid memory copy #

Total comments: 8

Patch Set 7 : Address comment #

Total comments: 11

Patch Set 8 : Address comments from scherkus, make GetMIDIMessageLength visible for future use #

Patch Set 9 : Address comments from scherkus. Rename IsValidWebMIDIMessage to IsValidWebMIDIData #

Patch Set 10 : rebase #

Total comments: 2

Patch Set 11 : Removed unnecessary notation from a header comment, to address scherkus' comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+672 lines, -44 lines) Patch
M content/browser/renderer_host/media/midi_host.h View 1 2 3 4 5 6 7 8 5 chunks +22 lines, -5 lines 0 comments Download
M content/browser/renderer_host/media/midi_host.cc View 1 2 3 4 5 6 7 8 5 chunks +96 lines, -39 lines 0 comments Download
A content/browser/renderer_host/media/midi_host_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +90 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 6 7 8 9 2 chunks +6 lines, -0 lines 0 comments Download
A media/midi/midi_message_queue.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +72 lines, -0 lines 0 comments Download
A media/midi/midi_message_queue.cc View 1 2 3 4 5 6 7 8 1 chunk +119 lines, -0 lines 0 comments Download
A media/midi/midi_message_queue_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +173 lines, -0 lines 0 comments Download
A media/midi/midi_message_util.h View 1 2 3 4 5 6 7 8 1 chunk +25 lines, -0 lines 0 comments Download
A media/midi/midi_message_util.cc View 1 2 3 4 5 6 7 8 1 chunk +34 lines, -0 lines 0 comments Download
A media/midi/midi_message_util_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +34 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
yukawa
Hi Toyoshima-san, I'm wondering if we should format MIDI messages from external MIDI devices to ...
7 years, 1 month ago (2013-11-11 06:40:41 UTC) #1
Takashi Toyoshima
Thank you for sending a great patch. As I commented, MIDIHost is a better place ...
7 years, 1 month ago (2013-11-12 21:59:36 UTC) #2
yukawa
PTAL? Now MIDIMessageQueue is used inside MIDIHost as you suggested. https://codereview.chromium.org/68353002/diff/230001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/68353002/diff/230001/media/midi/midi_manager.cc#newcode63 ...
7 years, 1 month ago (2013-11-14 14:55:30 UTC) #3
yukawa
On 2013/11/14 14:55:30, yukawa wrote: > PTAL? Now MIDIMessageQueue is used inside MIDIHost as you ...
7 years, 1 month ago (2013-11-15 05:46:35 UTC) #4
Takashi Toyoshima
https://codereview.chromium.org/68353002/diff/430001/content/browser/renderer_host/media/midi_host.cc File content/browser/renderer_host/media/midi_host.cc (right): https://codereview.chromium.org/68353002/diff/430001/content/browser/renderer_host/media/midi_host.cc#newcode156 content/browser/renderer_host/media/midi_host.cc:156: if (message[0] == kSysExMessage) { I chatted this with ...
7 years, 1 month ago (2013-11-19 01:08:37 UTC) #5
Takashi Toyoshima
https://codereview.chromium.org/68353002/diff/710001/media/midi/midi_message_queue.cc File media/midi/midi_message_queue.cc (right): https://codereview.chromium.org/68353002/diff/710001/media/midi/midi_message_queue.cc#newcode18 media/midi/midi_message_queue.cc:18: return data < 128; I'm slightly prefer (data & ...
7 years, 1 month ago (2013-11-19 01:45:30 UTC) #6
Takashi Toyoshima
+scherkus for media owner review
7 years, 1 month ago (2013-11-19 02:12:22 UTC) #7
yukawa
https://codereview.chromium.org/68353002/diff/710001/content/browser/renderer_host/media/midi_host.cc File content/browser/renderer_host/media/midi_host.cc (right): https://codereview.chromium.org/68353002/diff/710001/content/browser/renderer_host/media/midi_host.cc#newcode131 content/browser/renderer_host/media/midi_host.cc:131: CanSendMIDISysExMessageQuery can_send_sys_ex(renderer_process_id_); On 2013/11/19 01:08:37, Takashi Toyoshima (chromium) wrote: ...
7 years, 1 month ago (2013-11-19 09:41:41 UTC) #8
Takashi Toyoshima
lgtm with some comment requests. Also please wait for scherkus's owner review. https://codereview.chromium.org/68353002/diff/710001/content/browser/renderer_host/media/midi_host.cc File content/browser/renderer_host/media/midi_host.cc ...
7 years, 1 month ago (2013-11-19 12:49:59 UTC) #9
yukawa
Thank you for the review! Now I'm a bit concerned about additional memory copy cost ...
7 years, 1 month ago (2013-11-19 14:49:31 UTC) #10
Takashi Toyoshima
still lgtm https://codereview.chromium.org/68353002/diff/710001/media/midi/midi_message_queue.h File media/midi/midi_message_queue.h (right): https://codereview.chromium.org/68353002/diff/710001/media/midi/midi_message_queue.h#newcode1 media/midi/midi_message_queue.h:1: // Copyright (c) 2013 The Chromium Authors. ...
7 years, 1 month ago (2013-11-20 10:04:57 UTC) #11
yukawa
Thanks! scherkus@, could you take an owner review? https://codereview.chromium.org/68353002/diff/1110001/content/browser/renderer_host/media/midi_host.cc File content/browser/renderer_host/media/midi_host.cc (right): https://codereview.chromium.org/68353002/diff/1110001/content/browser/renderer_host/media/midi_host.cc#newcode40 content/browser/renderer_host/media/midi_host.cc:40: sysex_allowed_(false), ...
7 years, 1 month ago (2013-11-20 11:06:08 UTC) #12
scherkus (not reviewing)
https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.cc File media/midi/midi_message_util.cc (right): https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.cc#newcode32 media/midi/midi_message_util.cc:32: else if (0x80 <= data && data <= 0xbf) ...
7 years, 1 month ago (2013-11-20 20:15:59 UTC) #13
yukawa
https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.cc File media/midi/midi_message_util.cc (right): https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.cc#newcode32 media/midi/midi_message_util.cc:32: else if (0x80 <= data && data <= 0xbf) ...
7 years, 1 month ago (2013-11-21 01:19:39 UTC) #14
yukawa
ping?
7 years ago (2013-11-25 14:06:51 UTC) #15
scherkus (not reviewing)
https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.h File media/midi/midi_message_util.h (right): https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.h#newcode75 media/midi/midi_message_util.h:75: MEDIA_EXPORT bool IsValidWebMIDIMessage(const std::vector<uint8>& data); On 2013/11/21 01:19:40, yukawa ...
7 years ago (2013-11-25 23:14:36 UTC) #16
yukawa
On 2013/11/25 23:14:36, scherkus wrote: > https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.h > File media/midi/midi_message_util.h (right): > > https://codereview.chromium.org/68353002/diff/1210001/media/midi/midi_message_util.h#newcode75 > ...
7 years ago (2013-11-26 03:30:01 UTC) #17
scherkus (not reviewing)
lgtm w/ nits thanks! https://codereview.chromium.org/68353002/diff/1630001/media/midi/midi_message_queue.h File media/midi/midi_message_queue.h (right): https://codereview.chromium.org/68353002/diff/1630001/media/midi/midi_message_queue.h#newcode51 media/midi/midi_message_queue.h:51: // this method returns. nit: ...
7 years ago (2013-11-26 19:05:36 UTC) #18
yukawa
https://codereview.chromium.org/68353002/diff/1630001/media/midi/midi_message_queue.h File media/midi/midi_message_queue.h (right): https://codereview.chromium.org/68353002/diff/1630001/media/midi/midi_message_queue.h#newcode51 media/midi/midi_message_queue.h:51: // this method returns. On 2013/11/26 19:05:36, scherkus wrote: ...
7 years ago (2013-11-26 19:19:07 UTC) #19
yukawa
+jochen for the owner's review of content/content_tests.gypi.
7 years ago (2013-11-26 19:24:04 UTC) #20
jochen (gone - plz use gerrit)
lgtm
7 years ago (2013-11-27 09:14:05 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yukawa@chromium.org/68353002/1650001
7 years ago (2013-11-27 10:07:51 UTC) #22
commit-bot: I haz the power
7 years ago (2013-11-27 12:09:38 UTC) #23
Message was sent while issue was closed.
Change committed as 237558

Powered by Google App Engine
This is Rietveld 408576698