Based on my (self-answered) question here Muxing AVPackets into mp4 file - revisited, I have to ask, what could be the reason why there are no values written for pts/dts in the resulting mp4 container.
I examined the container file with the tool MediaInfo.
I observe that only the very first Frame contains a value for pts in the container. After that, pts is not even shown in the mp4 file anymore, but dts is, with a value of all zeros.
This is the output from MediaInfo for the first 3 frames:
0000A2 slice_layer_without_partitioning (IDR) - 0 (0x0) - Frame 0 - slice_type I - frame_num 0 - DTS 00:00:00.000 - PTS 00:00:00.017 (141867 bytes)
0000A2 Header (5 bytes)
0000A2 zero_byte: 0 (0x00)
0000A3 start_code_prefix_one_3bytes: 1 (0x000001)
0000A6 nal_ref_idc: 3 (0x3) - (2 bits)
0000A6 nal_unit_type: 5 (0x05) - (5 bits)
0000A7 slice_header (3 bytes)
0000A7 first_mb_in_slice: 0 (0x0)
0000A7 slice_type: 7 (0x07) - I
0000A8 pic_parameter_set_id: 0 (0x0)
0000A8 frame_num: 0 (0x0)
0000A8 idr_pic_id: 0 (0x0)
0000A8 no_output_of_prior_pics_flag: No
0000A8 long_term_reference_flag: No
0000A9 slice_qp_delta: -5 (0xFFFFFFFB)
0000AA disable_deblocking_filter_idc: 0 (0x0)
0000AA slice_alpha_c0_offset_div2: 0 (0x0)
0000AA slice_beta_offset_div2: 0 (0x0)
0000AA slice_data (141856 bytes)
0000AA (ToDo): (Data)
022ACD slice_layer_without_partitioning (IDR) - 0 (0x0) - Frame 0 - slice_type I - frame_num 0 - DTS 00:00:00.000 - PTS 00:00:00.017 - first_mb_in_slice 8040 (2248 bytes)
022ACD Header (5 bytes)
022ACD zero_byte: 0 (0x00)
022ACE start_code_prefix_one_3bytes: 1 (0x000001)
022AD1 nal_ref_idc: 3 (0x3) - (2 bits)
022AD1 nal_unit_type: 5 (0x05) - (5 bits)
022AD2 slice_header (6 bytes)
022AD2 first_mb_in_slice: 8040 (0x001F68)
022AD5 slice_type: 7 (0x07) - I
022AD6 pic_parameter_set_id: 0 (0x0)
022AD6 frame_num: 0 (0x0)
022AD6 idr_pic_id: 0 (0x0)
022AD6 no_output_of_prior_pics_flag: No
022AD6 long_term_reference_flag: No
022AD7 slice_qp_delta: -5 (0xFFFFFFFB)
022AD8 disable_deblocking_filter_idc: 0 (0x0)
022AD8 slice_alpha_c0_offset_div2: 0 (0x0)
022AD8 slice_beta_offset_div2: 0 (0x0)
022AD8 slice_data (2237 bytes)
022AD8 (ToDo): (Data)
023395 1 (36212 bytes)
023395 slice_layer_without_partitioning (non-IDR) - 2 (0x2) - Frame 1 - slice_type P - frame_num 1 - DTS 00:00:00.000 (36017 bytes)
023395 Header (5 bytes)
023395 zero_byte: 0 (0x00)
023396 start_code_prefix_one_3bytes: 1 (0x000001)
023399 nal_ref_idc: 3 (0x3) - (2 bits)
023399 nal_unit_type: 1 (0x01) - (5 bits)
02339A slice_header (3 bytes)
02339A first_mb_in_slice: 0 (0x0)
02339A slice_type: 5 (0x5) - P
02339A pic_parameter_set_id: 0 (0x0)
02339A frame_num: 1 (0x1)
02339B num_ref_idx_active_override_flag (0 bytes)
02339B num_ref_idx_active_override_flag: Yes
02339B num_ref_idx_l0_active_minus1: 0 (0x0)
02339B ref_pic_list_modification_flag_l0: No
02339B adaptive_ref_pic_marking_mode_flag: No
02339C cabac_init_idc: 0 (0x0)
02339C slice_qp_delta: -3 (0xFFFFFFFD)
02339C disable_deblocking_filter_idc: 0 (0x0)
02339C slice_alpha_c0_offset_div2: 0 (0x0)
02339D slice_beta_offset_div2: 0 (0x0)
02339D slice_data (36012 bytes)
02339D (ToDo): (Data)
02C046 slice_layer_without_partitioning (non-IDR) - 2 (0x2) - Frame 1 - slice_type P - frame_num 1 - DTS 00:00:00.000 - first_mb_in_slice 8040 (195 bytes)
02C046 Header (5 bytes)
02C046 zero_byte: 0 (0x00)
02C047 start_code_prefix_one_3bytes: 1 (0x000001)
02C04A nal_ref_idc: 3 (0x3) - (2 bits)
02C04A nal_unit_type: 1 (0x01) - (5 bits)
02C04B slice_header (6 bytes)
02C04B first_mb_in_slice: 8040 (0x001F68)
02C04E slice_type: 5 (0x5) - P
02C04E pic_parameter_set_id: 0 (0x0)
02C04E frame_num: 1 (0x1)
02C04F num_ref_idx_active_override_flag (0 bytes)
02C04F num_ref_idx_active_override_flag: Yes
02C04F num_ref_idx_l0_active_minus1: 0 (0x0)
02C04F ref_pic_list_modification_flag_l0: No
02C04F adaptive_ref_pic_marking_mode_flag: No
02C050 cabac_init_idc: 0 (0x0)
02C050 slice_qp_delta: -3 (0xFFFFFFFD)
02C050 disable_deblocking_filter_idc: 0 (0x0)
02C050 slice_alpha_c0_offset_div2: 0 (0x0)
02C051 slice_beta_offset_div2: 0 (0x0)
02C051 slice_data (190 bytes)
02C051 (ToDo): (Data)
02C109 1 (26280 bytes)
02C109 slice_layer_without_partitioning (non-IDR) - 4 (0x4) - Frame 2 - slice_type P - frame_num 2 - DTS 00:00:00.000 (26157 bytes)
02C109 Header (5 bytes)
02C109 zero_byte: 0 (0x00)
02C10A start_code_prefix_one_3bytes: 1 (0x000001)
02C10D nal_ref_idc: 3 (0x3) - (2 bits)
02C10D nal_unit_type: 1 (0x01) - (5 bits)
02C10E slice_header (3 bytes)
02C10E first_mb_in_slice: 0 (0x0)
02C10E slice_type: 5 (0x5) - P
02C10E pic_parameter_set_id: 0 (0x0)
02C10E frame_num: 2 (0x2)
02C10F num_ref_idx_active_override_flag (0 bytes)
02C10F num_ref_idx_active_override_flag: Yes
02C10F num_ref_idx_l0_active_minus1: 0 (0x0)
02C10F ref_pic_list_modification_flag_l0: No
02C10F adaptive_ref_pic_marking_mode_flag: No
02C110 cabac_init_idc: 0 (0x0)
02C110 slice_qp_delta: -2 (0xFFFFFFFE)
02C110 disable_deblocking_filter_idc: 0 (0x0)
02C110 slice_alpha_c0_offset_div2: 0 (0x0)
02C111 slice_beta_offset_div2: 0 (0x0)
02C111 slice_data (26152 bytes)
02C111 (ToDo): (Data)
032736 slice_layer_without_partitioning (non-IDR) - 4 (0x4) - Frame 2 - slice_type P - frame_num 2 - DTS 00:00:00.000 - first_mb_in_slice 8040 (123 bytes)
032736 Header (5 bytes)
032736 zero_byte: 0 (0x00)
032737 start_code_prefix_one_3bytes: 1 (0x000001)
03273A nal_ref_idc: 3 (0x3) - (2 bits)
03273A nal_unit_type: 1 (0x01) - (5 bits)
03273B slice_header (6 bytes)
03273B first_mb_in_slice: 8040 (0x001F68)
03273E slice_type: 5 (0x5) - P
03273E pic_parameter_set_id: 0 (0x0)
03273E frame_num: 2 (0x2)
03273F num_ref_idx_active_override_flag (0 bytes)
03273F num_ref_idx_active_override_flag: Yes
03273F num_ref_idx_l0_active_minus1: 0 (0x0)
03273F ref_pic_list_modification_flag_l0: No
03273F adaptive_ref_pic_marking_mode_flag: No
032740 cabac_init_idc: 0 (0x0)
032740 slice_qp_delta: -2 (0xFFFFFFFE)
032740 disable_deblocking_filter_idc: 0 (0x0)
032740 slice_alpha_c0_offset_div2: 0 (0x0)
032741 slice_beta_offset_div2: 0 (0x0)
032741 slice_data (118 bytes)
032741 (ToDo): (Data)
0327B1 1 (21125 bytes)
It goes on like that, even though I set pts and dts. The settings may not be correct already (I do some calculations like (1 / framerate) * FrameNumber), but I would expect at least some numbers in pts and dts, when I set the according fields in the avPacket structure and write that via av_interleaved_write_frame(outFmtCtx, &avPacket); to the file.
What could be wrong here?
Edit:
(please see below in the comments the download to my testdata and source file)
One thing that bugs me is the fact, if I compare the output of MediaInfo from my file and that of the muxing.c generated is, that in the header, the muxing.c generated already mentions the duration of the file as 9960 ms, whereas mine is only 40 ms.
muxing.c also does call avformat_write_header before even one frame is drawn. Yes, I suppose that the header will be updated, when the either av_interleaved_write_frame or av_write_trailer is called, but I totally not understand the mechanics behind it.
Maybe somebody can enlighten me with some background information of any kind.
Additionally, I think it could be necessarry to extract some SPS and PPS from my raw data (preceding the I-slice), and give that as extra data to the avformat_write_header call. But I just cannot figure out myself if I have to do that at all and if so, how to do it.
Related
Problem:
I need to install Qt Creator for my university course on my mac and it doesn't open. I've tried reinstalling different versions a lot of times but it gives me a Segmentation Fault everytime.
Everything else is updated to the latest Version and i don't know what to try anymore.
Any tips and solutions would be appreciated.
This is one of the error messages:
DebuggerItem \"/Applications/Xcode.app/Contents/Developer/usr/bin/lldb\" ({8999bbd1-bcb9-4fd1-843a-47fec36eb8b6}) read from \"/Users/Samy/.config/QtProject/qtcreator/debuggers.xml\" dropped since the command is not executable."
zsh: segmentation fault /Applications/Qt\ Creator.app/Contents/MacOS/Qt\ Creator
Here is the Report if I try opening the App:
Process: Qt Creator [54924]
Path: /Applications/Qt Creator.app/Contents/MacOS/Qt Creator
Identifier: org.qt-project.qtcreator
Version: 4.11.0 (4.11.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Qt Creator [54924]
User ID: 501
Date/Time: 2020-01-08 22:12:42.699 +0100
OS Version: Mac OS X 10.15 (19A602)
Report Version: 12
Anonymous UUID: 103F9158-D5E0-F1B8-BA89-222AB7C6F587
Sleep/Wake UUID: 3FB53B09-90D6-4FB8-AB3A-2D663E75701E
Time Awake Since Boot: 170000 seconds
Time Since Wake: 15000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [54924]
VM Regions Near 0:
-->
__TEXT 000000010d082000-000000010d096000 [ 80K] r-x/rwx SM=COW /Applications/Qt Creator.app/Contents/MacOS/Qt Creator
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libUtils.4.11.0.dylib 0x000000010d1ab7b0 QtPrivate::QFunctorSlotObject<Utils::FancyMainWindowPrivate::FancyMainWindowPrivate(Utils::FancyMainWindow*)::$_2, 1, QtPrivate::List<bool>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) + 48
1 org.qt-project.QtCore 0x000000010e3369b5 0x10e10f000 + 2259381
2 org.qt-project.QtWidgets 0x000000010d3f040e QAction::setChecked(bool) + 174
3 libDebugger.dylib 0x0000000114a1a2ef Utils::DebuggerMainWindow::restorePersistentSettings() + 1151
4 libDebugger.dylib 0x0000000114a19c5d Utils::DebuggerMainWindow::DebuggerMainWindow() + 925
5 libDebugger.dylib 0x0000000114a218fb Utils::Perspective::Perspective(QString const&, QString const&, QString const&, QString const&) + 267
6 libDebugger.dylib 0x0000000114a24d25 Debugger::Internal::DebuggerPluginPrivate::DebuggerPluginPrivate(QStringList const&) + 1781
7 libDebugger.dylib 0x0000000114a36747 Debugger::Internal::DebuggerPlugin::initialize(QStringList const&, QString*) + 39
8 libExtensionSystem.4.11.0.dylib 0x000000010d0cbecb ExtensionSystem::Internal::PluginSpecPrivate::initializePlugin() + 107
9 libExtensionSystem.4.11.0.dylib 0x000000010d0be6a0 ExtensionSystem::Internal::PluginManagerPrivate::loadPlugin(ExtensionSystem::PluginSpec*, ExtensionSystem::PluginSpec::State) + 656
10 libExtensionSystem.4.11.0.dylib 0x000000010d0b6f90 ExtensionSystem::Internal::PluginManagerPrivate::loadPlugins() + 592
11 org.qt-project.qtcreator 0x000000010d08de28 main + 14520
12 libdyld.dylib 0x00007fff6e91b405 start + 1
Thread 1:
0 libsystem_pthread.dylib 0x00007fff6eb245b4 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00007fff6eb245b4 start_wqthread + 0
Thread 3:
0 libsystem_pthread.dylib 0x00007fff6eb245b4 start_wqthread + 0
Thread 4:
0 libsystem_pthread.dylib 0x00007fff6eb245b4 start_wqthread + 0
Thread 5:
0 libsystem_pthread.dylib 0x00007fff6eb245b4 start_wqthread + 0
Thread 6:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff6ea6b7c6 __select + 10
1 com.apple.CoreFoundation 0x00007fff3764a92a __CFSocketManager + 632
2 libsystem_pthread.dylib 0x00007fff6eb27d76 _pthread_start + 125
3 libsystem_pthread.dylib 0x00007fff6eb245d7 thread_start + 15
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000000 rcx: 0x00007ffee2b7cf50 rdx: 0x0000600000d5a3c0
rdi: 0x0000000000000000 rsi: 0x000060000184bba0 rbp: 0x00007ffee2b7ce70 rsp: 0x00007ffee2b7ce60
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x000000011c7d7be0 r11: 0x000000010d5461d0
r12: 0x0000600003c9bea0 r13: 0x000000011c805d40 r14: 0x0000000000000001 r15: 0x0000600000d5a3c0
rip: 0x000000010d1ab7b0 rfl: 0x0000000000010246 cr2: 0x0000000000000000
Logical CPU: 2
Error Code: 0x00000004 (no mapping for user data write)
Trap Number: 14
[Number jibberish]`enter code here`
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 114998
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=780.0M resident=0K(0%) swapped_out_or_unallocated=780.0M(100%)
Writable regions: Total=573.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=573.9M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 128K 1
Activity Tracing 256K 1
CG backing stores 248K 2
CoreImage 8K 2
CoreUI image data 72K 1
JS VM register file 4360K 4
JS VM register file (reserved) 2040K 1 reserved VM address space (unallocated)
Kernel Alloc Once 8K 1
MALLOC 167.2M 43
MALLOC guard page 16K 4
MALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)
STACK GUARD 56.0M 7
Stack 11.0M 7
VM_ALLOCATE 132K 9
WebAssembly memory 4096K 1
__DATA 39.4M 428
__DATA_CONST 41K 3
__FONT_DATA 4K 1
__GLSLBUILTINS 5176K 1
__LINKEDIT 382.9M 106
__OBJC_RO 31.8M 1
__OBJC_RW 1764K 2
__TEXT 397.2M 410
__UNICODE 564K 1
mapped file 332.3M 43
shared memory 640K 15
=========== ======= =======
TOTAL 1.8G 1096
TOTAL, minus reserved VM space 1.4G 1096
Model: MacBookAir7,2, BootROM 190.0.0.0.0, 2 processors, Dual-Core Intel Core i5, 1,6 GHz, 8 GB, SMC 2.27f2
Graphics: kHW_IntelHDGraphics6000Item, Intel HD Graphics 6000, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x02FE, -
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x02FE, -
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x117), Broadcom BCM43xx 1.0 (7.77.105.1 AirPortDriverBrcmNIC-1429)
Bluetooth: Version 7.0.0f8, 3 services, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0128G, 121,33 GB
USB Device: USB 3.0 Bus
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
Thunderbolt Bus: MacBook Air, Apple Inc., 27.2
Apparently out of the blue, I have started to experience random crashes on my Mac Pro 4.1, flashed to 5.1. It's running High Sierra 10.13.6 (17G9016), with 48Gb of Ram and two cards (one GT120 and a flashed MacVidCard Titan X Pascal). It is a soft crash in the sense that it just logs me out of my session and then I need to log in again, so it doesn't completely reboot.
However it's very annoying since I can't finish any task properly and need to reopen all the files I might be working with, which generally deal with heavy graphics (CAD applications or video editing).
I am not fluent in reading crash logs, so any help reading this one is much appreciated.
Here's the last crash log:
Process: WindowServer [144]
Path: /System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/Resources/WindowServer
Identifier: WindowServer
Version: 600.00 (312.103.11)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
Responsible: WindowServer [144]
User ID: 88
Date/Time: 2019-11-17 18:15:12.313 +0000
OS Version: Mac OS X 10.13.6 (17G9016)
Report Version: 12
Anonymous UUID: B4B1B7C1-08E2-6A09-6684-E949A6C2D95F
Time Awake Since Boot: 230 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000016
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]
VM Regions Near 0x16:
-->
__TEXT 0000000108ebe000-0000000108ebf000 [ 4K] r-x/rwx SM=COW [/System/Library/PrivateFrameworks/SkyLight.framework/Versions/A/Resources/WindowServer]
Application Specific Information:
StartTime:2019-11-17 18:11:36
GPU:NV
MetalDevice for accelerator(0x4507): 0x7fb86ae03ef8 (MTLDevice: 0x7fb86c004800)
MetalDevice for accelerator(0x4e07): 0x7fb86d00d858 (MTLDevice: 0x7fb86c004800)
IOService:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IOU0#3/IOPP/PXS1#0/NVDA,Display-B#1/NVDA
IOService:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IOU1#7/IOPP/PXS2#0/NVDA,Display-A#0/NVDATesla
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libGPUSupport.dylib 0x00007fff6606b10c gpumRestoreTextureData + 60
1 libGFXShared.dylib 0x00007fff56f366d9 gfxUploadPluginTextureLevel + 111
2 GLEngine 0x00007fff57bf55e7 gleSynchronizePluginTextureLevels + 279
3 GLEngine 0x00007fff57bbfaaf gleBindFramebuffer + 321
4 GLEngine 0x00007fff57b0855c glBindFramebuffer_Exec + 142
5 com.apple.SkyLight 0x00007fff6f32ec24 CaptureSurfaceGL::CreateAndAttachTextureToFBO() + 162
6 com.apple.SkyLight 0x00007fff6f32e3d8 CaptureSurfaceGL::PrepareForPopulation(CGRect, WSPixelFormat, float, bool, CGColorSpace*, CGXDisplayDevice*, unsigned int) + 74
7 com.apple.SkyLight 0x00007fff6f444601 WSCALayerBackingUpdateFlatteningIfNeeded + 1284
8 com.apple.SkyLight 0x00007fff6f3cd2b3 CGXNextSurface + 3246
9 com.apple.SkyLight 0x00007fff6f472211 generate_layers_for_window_surfaces(CGXRedrawState*, CGXWindow*, CGSOrderOp, unsigned int, int*, WSCompositeSourceLayer**, CGSRegionObject*) + 5581
10 com.apple.SkyLight 0x00007fff6f46cca6 generate_layers_for_window(CGXRedrawState*, CGXWindow*) + 3193
11 com.apple.SkyLight 0x00007fff6f46afc1 CGXUpdateDisplay + 13505
12 com.apple.SkyLight 0x00007fff6f467882 update_display_callback(void*, double) + 257
13 com.apple.SkyLight 0x00007fff6f4ae552 run_timer_pass + 495
14 com.apple.SkyLight 0x00007fff6f4dc1c9 CGXRunOneServicesPass + 247
15 com.apple.SkyLight 0x00007fff6f4dcd84 SLXServer + 832
16 WindowServer 0x0000000108ebedde 0x108ebe000 + 3550
17 libdyld.dylib 0x00007fff75559015 start + 1
Thread 1:
0 libsystem_kernel.dylib 0x00007fff756aa28a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff75871009 _pthread_wqthread + 1035
2 libsystem_pthread.dylib 0x00007fff75870be9 start_wqthread + 13
Thread 2:
0 libsystem_kernel.dylib 0x00007fff756a020a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff7569f724 mach_msg + 60
2 com.apple.CoreDisplay 0x00007fff4d4cb685 0x7fff4d41c000 + 718469
3 com.apple.CoreDisplay 0x00007fff4d4cb813 0x7fff4d41c000 + 718867
4 libsystem_pthread.dylib 0x00007fff75871661 _pthread_body + 340
5 libsystem_pthread.dylib 0x00007fff7587150d _pthread_start + 377
6 libsystem_pthread.dylib 0x00007fff75870bf9 thread_start + 13
Thread 3:: com.apple.coreanimation.render-server
0 libsystem_kernel.dylib 0x00007fff756a020a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff7569f724 mach_msg + 60
2 com.apple.QuartzCore 0x00007fff5890ae62 CA::Render::Server::server_thread(void*) + 870
3 com.apple.QuartzCore 0x00007fff5890aae6 thread_fun + 25
4 libsystem_pthread.dylib 0x00007fff75871661 _pthread_body + 340
5 libsystem_pthread.dylib 0x00007fff7587150d _pthread_start + 377
6 libsystem_pthread.dylib 0x00007fff75870bf9 thread_start + 13
Thread 4:
0 libsystem_kernel.dylib 0x00007fff756aa28a __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fff75871009 _pthread_wqthread + 1035
2 libsystem_pthread.dylib 0x00007fff75870be9 start_wqthread + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fb871800000 rbx: 0x00007fb86c0e8800 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x00007fb86f832a00 rsi: 0x00007fb86c0e8800 rbp: 0x00007ffee6d40380 rsp: 0x00007ffee6d40320
r8: 0x0000000000000000 r9: 0x000000016f236ee7 r10: 0x0000000000000003 r11: 0x0000000000000206
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x00007fb86f832a00
rip: 0x00007fff6606b10c rfl: 0x0000000000010246 cr2: 0x0000000000000016
Logical CPU: 4
Error Code: 0x00000004
Trap Number: 14
Binary Images:
[…]
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 3
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 318
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=380.3M resident=0K(0%) swapped_out_or_unallocated=380.3M(100%)
Writable regions: Total=1.6G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.6G(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Activity Tracing 256K 2
CG backing stores 173.6M 139
CG framebuffers 1.0G 9
CG framebuffers (reserved) 56.1M 9 reserved VM address space (unallocated)
CG image 668K 9
CoreAnimation 64.1M 53
CoreGraphics 4K 2
Dispatch continuations 32.0M 2
Kernel Alloc Once 8K 2
MALLOC 321.3M 146
MALLOC guard page 48K 13
MALLOC_LARGE (reserved) 160K 2 reserved VM address space (unallocated)
OpenGL GLSL 256K 4
STACK GUARD 56.0M 6
Stack 10.0M 6
VM_ALLOCATE 1352K 50
__CGSERVER 4K 2
__DATA 51.1M 249
__FONT_DATA 4K 2
__GLSLBUILTINS 2588K 2
__LINKEDIT 194.5M 10
__SLSERVER 4K 2
__TEXT 185.8M 250
__UNICODE 560K 2
mapped file 25.8M 3
shared memory 180K 15
=========== ======= =======
TOTAL 2.1G 965
TOTAL, minus reserved VM space 2.1G 965
So I'm writing a simple ETW logger to provide a trigger-event state machine to wake up whenever a new USB device is connected. Using microsoft's Messages analyzer I managed to trace and receive USB "new usb device information" traces using the following filter Microsoft_Windows_USB_USBHUB3.Summary == "New USB Device Information"
However, after examining the packet, there is no way for me to differentiate between USB mass storage devices and other USB devices(camera?)
Available values from the trace:
Name Value Bit Offset Bit Length Type
pointerValue 132972247379928 64 64 UInt64
Fid_HubDevice 0x000078F011FC3CC8 0 64 Etw.EtwPointer
pointerValue 132972489227464 0 64 UInt64
Fid_UsbDevice 0x000078F00391EFD8 64 64 Etw.EtwPointer
Fid_PortNumber 1 128 32 UInt32
Fid_DeviceDescription USB Mass Storage Device 160 384 String
Fid_DeviceInterfacePath \??\USB#VID_0781&PID_5567#200602669107DD62F0E0#{a5dcbf10-6530-11d2-901f-00c04fb951ed} 544 1376 String
Fid_DeviceDescriptor fid_DeviceDescriptor{Fid_bLength=18,Fid_bDescriptorType=1,Fid_bcdUSB=512,Fid_bDeviceClass=0,Fid_bDeviceSubClass=0,Fid_bDeviceProtocol=0,Fid_bMaxPacketSize0=64,Fid_idVendor=1921,Fid_idProduct=21863,Fid_bcdDevice=295,Fid_iManufacturer=1,Fid_iProduct=2,Fid_iSerialNumber=3,Fid_bNumConfigurations=1} 1920 144 Microsoft_Windows_USB_USBHUB3.fid_DeviceDescriptor
Fid_bLength 18 1920 8 Byte
Fid_bDescriptorType 1 1928 8 Byte
Fid_bcdUSB 0x0200 1936 16 UInt16
Fid_bDeviceClass 0 1952 8 Byte
Fid_bDeviceSubClass 0 1960 8 Byte
Fid_bDeviceProtocol 0 1968 8 Byte
Fid_bMaxPacketSize0 64 1976 8 Byte
Fid_idVendor 0x0781 1984 16 UInt16
Fid_idProduct 0x5567 2000 16 UInt16
Fid_bcdDevice 0x0127 2016 16 UInt16
Fid_iManufacturer 1 2032 8 Byte
Fid_iProduct 2 2040 8 Byte
Fid_iSerialNumber 3 2048 8 Byte
Fid_bNumConfigurations 1 2056 8 Byte
Fid_ConfigurationDescriptorLength 0x0020 2064 16 UInt16
Fid_ConfigurationDescriptor [9,2,32,0,1,1,0,128,100,9,4,0,0,2,8,6,80,0,7,5,129,2,0,2,0,7,5,2,2,0,2,1] 2080 256 ArrayValue`1
Fid_PdoName \Device\USBPDO-13 2336 288 String
Fid_Suspended 1 2624 8 Byte
Fid_PortPathDepth 1 2632 32 UInt32
Fid_PortPath [1,0,0,0,0,0] 2664 192 ArrayValue`1
Fid_PciBus 0x00000000 2856 32 UInt32
Fid_PciDevice 0x00000014 2888 32 UInt32
Fid_PciFunction 0x00000000 2920 32 UInt32
Fid_PciVendorId 0x00008086 2952 32 UInt32
Fid_PciDeviceId 0x0000A12F 2984 32 UInt32
Fid_PciRevisionId 0x00000031 3016 32 UInt32
Fid_CurrentWdfPowerDeviceState 0x00000005 3048 32 UInt32
Fid_Usb20LpmStatus 0x00000006 3080 32 UInt32
Fid_ControllerParentBusType ControllerParentBusTypePci 3112 32 MapControllerParentBusType
Fid_AcpiVendorId NULL 3144 40 String
Fid_AcpiDeviceId NULL 3184 40 String
Fid_AcpiRevisionId NULL 3224 40 String
Fid_PortFlagAcpiUpcValid 1 3264 8 Byte
Fid_PortConnectorType 255 3272 8 Byte
Fid_UcmConnectorId 0x0000000000000001 3280 64 UInt64
EtwKeywords Keywords{StandardKeywords=WindowsEtwKeywords{EventlogClassic=False,CorrelationHint=False,AuditSuccess=False,AuditFailure=False,SQM=False,WDIDiag=False,WDIContext=False,Reserved=False},Default=True,USBError=False,IRP=False,Power=False,PnP=True,Performance=False,HeadersBusTrace=False,PartialDataBusTrace=False,FullDataBusTrace=False,StateMachine=False,Enumeration=False,VerifyDriver=False,HWVerifyHost=False,HWVerifyHub=False,HWVerifyDevice=False,Rundown=False,Device=False,Hub=False,Compat=False,ControllerCommand=False,MsMeasures=True} Microsoft_Windows_USB_USBHUB3.Keywords
Limitations:
No strings comparisons
Must use ETW mechanism
My linux-3.0 kernel was panicking saying ERROR: Failed to allocate 0x1000 bytes below 0x0. while booting. So I changed the bootargs and added a boot parameter mem = 16M. Now it boots fine but it takes a lot of time to boot. I have tried with higher mem value also but it does not work. Below are the logs:
`Machine: KZM9D
arm_add_memory: 0 0x40000000 0x1000000
Memory policy: ECC disabled, Data cache writealloc
bootmem_init: max_low=0x266240, max_high=0x266240
<6>Section 8256 and 8250 (node 0)<c> have a circular dependency on usemap and pgdat allocations
<7>On node 0 totalpages: 0
<7>On node 1 totalpages: 0
<7>On node 2 totalpages: 0
<7>On node 3 totalpages: 0
<7>On node 4 totalpages: 0
<7>On node 5 totalpages: 0
<7>On node 6 totalpages: 0
<7>On node 7 totalpages: 0
high_memory: e0000000
Zone PFN ranges:
Normal 0x00040000 -> 0x00041000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x00040000 -> 0x00041000
<7>On node 0 totalpages: 4096
<7> Normal zone: 36 pages used for memmap
<7> Normal zone: 0 pages reserved
<7> Normal zone: 4060 pages, LIFO batch:0
<6>boottime: reserved memory at 0x40002000 size 0x2000
mm_init_owner
<6>PERCPU: Embedded 8 pages/cpu #c087f000 s9824 r8192 d14752 u32768
<7>pcpu-alloc: s9824 r8192 d14752 u32768 alloc=8*4096
<7>pcpu-alloc: [0] 0 [0] 1
build_all_zonelists
Built 1 zonelists in Node order, mobility grouping on. Total pages: 4060
Policy zone: Normal
page_alloc_init
<5>Kernel command line: console=ttyS1,115200n8 root=/dev/nfs ip=9.8.7.6 nfsroot=1.2.3.7:/tftpboot/arm/ rootwait rw mem=16M
parse_early_param
<6>PID hash table entries: 64 (order: -4, 256 bytes)
<6>Dentry cache hash table entries: 2048 (order: 2, 24576 bytes)
<6>Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
<6>Memory: 16MB = 16MB total
<5>Memory: 7824k/7824k available, 8560k reserved, 0K highmem
<5>Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xe0800000 - 0xf0000000 ( 248 MB)
lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc0704024 (7153 kB)
.init : 0xc0705000 - 0xc0740660 ( 238 kB)
.data : 0xc0742000 - 0xc078dc18 ( 304 kB)
.bss : 0xc078dc18 - 0xc07f2950 ( 404 kB)
<6>Preemptible hierarchical RCU implementation.
<6>NR_IRQS:374`
I'm trying to write a simple program using OpenGL in NASM using NASMX. I have a working version of this code in C which works. The assembly version does not really work. It compiles and runs but it only shows a black screen instead of black screen with a white pixel :) ChangeDisplaySettingsA does not seem to change the display settings.
I'd rather not use NASMX but I lack the knowledge on how to do this without NASMX.
I guess there is something wrong with how I use the parameters. So what do you think? What's wrong with this code? A link to a working code sample would be great!
%include 'nasmx-1.0\inc\nasmx.inc'
%include 'nasmx-1.0\inc\win32\windows.inc'
%include 'nasmx-1.0\inc\win32\kernel32.inc'
%include 'nasmx-1.0\inc\win32\user32.inc'
%include 'nasmx-1.0\inc\win32\gdi32.inc'
%include 'nasmx-1.0\inc\win32\opengl32.inc'
%include 'nasmx-1.0\inc\win32\msvcrt.inc'
entry entrypoint
XRES equ 1024
YRES equ 786
[section .text]
proc entrypoint, ptrdiff_t argcount, ptrdiff_t cmdline
locals none
invoke ChangeDisplaySettingsA, ptrdiff_t [dmScreenSettings], 0x00000004
invoke CreateWindowExA, 0, szEdit, 0, WS_POPUP + WS_VISIBLE, 0, 0, XRES, YRES, 0, 0, 0, 0
invoke GetDC, eax
mov ptrdiff_t [hDc], eax
invoke ChoosePixelFormat, ptrdiff_t [hDc], pfd
invoke SetPixelFormat, ptrdiff_t [hDc], eax, pfd
invoke wglCreateContext, ptrdiff_t [hDc]
invoke wglMakeCurrent, ptrdiff_t [hDc], eax
invoke ShowCursor, FALSE
invoke glViewport, 0, 0, XRES, YRES
invoke glMatrixMode, 0x1701
invoke glLoadIdentity
invoke glOrtho, 0, XRES, 0, YRES, -1, 1
invoke glMatrixMode, 0x1700
invoke glLoadIdentity
.intro_loop:
invoke glColor3ub, 255, 255, 255
invoke glBegin, 0x0000
invoke glVertex2i, 100, 100
invoke glEnd
invoke SwapBuffers, ptrdiff_t [hDc]
invoke PeekMessageA, 0, 0, 0, 0, PM_REMOVE
invoke GetAsyncKeyState, VK_ESCAPE
cmp eax, dword 0
je .intro_loop
invoke ExitProcess, 0
endproc
[section .bss]
hDc: reserve(ptrdiff_t) 1
[section .data]
szEdit: declare(NASMX_TCHAR) NASMX_TEXT("edit"), 0x0
NASMX_ISTRUC pfd, PIXELFORMATDESCRIPTOR
NASMX_AT nSize, 0
NASMX_AT nVersion, 1
NASMX_AT dwFlags, 33
NASMX_AT iPixelType, 32
NASMX_AT cColorBits, 0
NASMX_AT cRedBits, 0
NASMX_AT cRedShift, 0
NASMX_AT cGreenBits, 0
NASMX_AT cGreenShift, 0
NASMX_AT cBlueBits, 0
NASMX_AT cBlueShift, 0
NASMX_AT cAlphaBits, 0
NASMX_AT cAlphaShift, 0
NASMX_AT cAccumBits, 0
NASMX_AT cAccumRedBits, 0
NASMX_AT cAccumGreenBits, 0
NASMX_AT cAccumBlueBits, 0
NASMX_AT cAccumAlphaBits, 32
NASMX_AT cDepthBits, 0
NASMX_AT cStencilBits, 0
NASMX_AT cAuxBuffers, 0
NASMX_AT iLayerType, 0
NASMX_AT bReserved, 0
NASMX_AT dwLayerMask, 0
NASMX_AT dwVisibleMask, 0
NASMX_AT dwDamageMask, 0
NASMX_IENDSTRUC
NASMX_ISTRUC dmScreenSettings, DEVMODE
NASMX_AT dmDeviceName, ""
NASMX_AT dmSpecVersion, 0
NASMX_AT dmDriverVersion, 0
NASMX_AT dmSize, 156
NASMX_AT dmDriverExtra, 0
NASMX_AT dmFields, 1572864
NASMX_AT dmOrientation, 0
NASMX_AT dmPaperSize, 0
NASMX_AT dmPaperiLength, 0
NASMX_AT dmPaperWidth, 0
NASMX_AT dmScale, 0
NASMX_AT dmCopies, 0
NASMX_AT dmDefaultSource, 0
NASMX_AT dmPrintQuality, 0
NASMX_AT dmColor, 0
NASMX_AT dmDuplex, 0
NASMX_AT dmYResolution, 0
NASMX_AT dmTTOption, 0
NASMX_AT dmCollate, 0
NASMX_AT dmFormName, ""
NASMX_AT dmUnusedPadding, 0
NASMX_AT dmBitsPerPel, 0
NASMX_AT dmPelsWidth, XRES
NASMX_AT dmPelsHeight, YRES
NASMX_AT dmDisplayFlags, 0
NASMX_AT dmDisplayFrequency, 0
NASMX_AT dmICMMethod, 0
NASMX_AT dmICMIntent, 0
NASMX_AT dmMediaType, 0
NASMX_AT dmDitherType, 0
NASMX_AT dmReserved1, 0
NASMX_AT dmReserved2, 0
NASMX_AT dmPanningWidth, 0
NASMX_AT dmPanningHeight, 0
NASMX_IENDSTRUC
Are you sure you are pushing the correct arguments? Remember that functions like glOrtho takes doubles, not floats.
Plz check
OpenGL DEMO for WIN32 for NASMX
NASMX v1.2 has this OpenGL Demo along with GL and GLUT includes.
Download from NASMX - Sourceforge.net