OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/midi/midi_manager_win.h" | 5 #include "media/midi/midi_manager_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <ks.h> | 8 #include <ks.h> |
9 #include <ksmedia.h> | 9 #include <ksmedia.h> |
10 #include <mmreg.h> | 10 #include <mmreg.h> |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 base::Bind(&MidiServiceWinImpl::SetOutputPortStateOnTaskThread, | 884 base::Bind(&MidiServiceWinImpl::SetOutputPortStateOnTaskThread, |
885 base::Unretained(this), port_number, | 885 base::Unretained(this), port_number, |
886 MIDI_PORT_DISCONNECTED)); | 886 MIDI_PORT_DISCONNECTED)); |
887 } | 887 } |
888 | 888 |
889 ///////////////////////////////////////////////////////////////////////////// | 889 ///////////////////////////////////////////////////////////////////////////// |
890 // Callbacks on the sender thread. | 890 // Callbacks on the sender thread. |
891 ///////////////////////////////////////////////////////////////////////////// | 891 ///////////////////////////////////////////////////////////////////////////// |
892 | 892 |
893 void AssertOnSenderThread() { | 893 void AssertOnSenderThread() { |
894 DCHECK_EQ(sender_thread_.thread_id(), base::PlatformThread::CurrentId()); | 894 DCHECK_EQ(sender_thread_.GetThreadId(), base::PlatformThread::CurrentId()); |
895 } | 895 } |
896 | 896 |
897 void SendOnSenderThread(uint32 port_number, | 897 void SendOnSenderThread(uint32 port_number, |
898 uint64 port_age, | 898 uint64 port_age, |
899 const std::vector<uint8>& data, | 899 const std::vector<uint8>& data, |
900 base::TimeTicks time) { | 900 base::TimeTicks time) { |
901 AssertOnSenderThread(); | 901 AssertOnSenderThread(); |
902 if (destructor_started) { | 902 if (destructor_started) { |
903 LOG(ERROR) << "ThreadSafeSendData failed because MidiServiceWinImpl is " | 903 LOG(ERROR) << "ThreadSafeSendData failed because MidiServiceWinImpl is " |
904 "being destructed. port: " << port_number; | 904 "being destructed. port: " << port_number; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 else | 940 else |
941 SendLongMidiMessageInternal(state->midi_handle, message); | 941 SendLongMidiMessageInternal(state->midi_handle, message); |
942 } | 942 } |
943 } | 943 } |
944 | 944 |
945 ///////////////////////////////////////////////////////////////////////////// | 945 ///////////////////////////////////////////////////////////////////////////// |
946 // Callbacks on the task thread. | 946 // Callbacks on the task thread. |
947 ///////////////////////////////////////////////////////////////////////////// | 947 ///////////////////////////////////////////////////////////////////////////// |
948 | 948 |
949 void AssertOnTaskThread() { | 949 void AssertOnTaskThread() { |
950 DCHECK_EQ(task_thread_.thread_id(), base::PlatformThread::CurrentId()); | 950 DCHECK_EQ(task_thread_.GetThreadId(), base::PlatformThread::CurrentId()); |
951 } | 951 } |
952 | 952 |
953 void UpdateDeviceListOnTaskThread() { | 953 void UpdateDeviceListOnTaskThread() { |
954 AssertOnTaskThread(); | 954 AssertOnTaskThread(); |
955 const UINT num_in_devices = midiInGetNumDevs(); | 955 const UINT num_in_devices = midiInGetNumDevs(); |
956 for (UINT device_id = 0; device_id < num_in_devices; ++device_id) { | 956 for (UINT device_id = 0; device_id < num_in_devices; ++device_id) { |
957 // Here we use |CALLBACK_FUNCTION| to subscribe MIM_DATA, MIM_LONGDATA, | 957 // Here we use |CALLBACK_FUNCTION| to subscribe MIM_DATA, MIM_LONGDATA, |
958 // MIM_OPEN, and MIM_CLOSE events. | 958 // MIM_OPEN, and MIM_CLOSE events. |
959 // - MIM_DATA: This is the only way to get a short MIDI message with | 959 // - MIM_DATA: This is the only way to get a short MIDI message with |
960 // timestamp information. | 960 // timestamp information. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 base::TimeTicks time) { | 1166 base::TimeTicks time) { |
1167 ReceiveMidiData(port_index, &data[0], data.size(), time); | 1167 ReceiveMidiData(port_index, &data[0], data.size(), time); |
1168 } | 1168 } |
1169 | 1169 |
1170 MidiManager* MidiManager::Create() { | 1170 MidiManager* MidiManager::Create() { |
1171 return new MidiManagerWin(); | 1171 return new MidiManagerWin(); |
1172 } | 1172 } |
1173 | 1173 |
1174 } // namespace midi | 1174 } // namespace midi |
1175 } // namespace media | 1175 } // namespace media |
OLD | NEW |