OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/midi/midi_output_port_android.h" | |
6 | |
7 #include "base/android/jni_array.h" | |
8 #include "jni/MidiOutputPortAndroid_jni.h" | |
9 | |
10 namespace media { | |
11 namespace midi { | |
12 | |
13 MidiOutputPortAndroid::MidiOutputPortAndroid(JNIEnv* env, jobject raw) | |
14 : raw_port_(env, raw) {} | |
15 MidiOutputPortAndroid::~MidiOutputPortAndroid() {} | |
16 | |
17 void MidiOutputPortAndroid::Send(const std::vector<uint8>& data) { | |
18 JNIEnv* env = base::android::AttachCurrentThread(); | |
19 const uint8* head = data.size() ? &data[0] : nullptr; | |
philburk
2015/08/19 01:40:15
If there is no data maybe skip the send call.
yhirano
2015/08/19 06:32:03
Done.
| |
20 ScopedJavaLocalRef<jbyteArray> data_to_pass = | |
21 base::android::ToJavaByteArray(env, head, data.size()); | |
22 | |
23 Java_MidiOutputPortAndroid_send(env, raw_port_.obj(), data_to_pass.obj()); | |
24 } | |
25 | |
26 bool MidiOutputPortAndroid::Register(JNIEnv* env) { | |
27 return RegisterNativesImpl(env); | |
28 } | |
29 | |
30 } // namespace midi | |
31 } // namespace media | |
OLD | NEW |