之前的文章提到调试重采样程序碰到的“未加载符号文件”,如下图所示:
执行到swr_convert函数的时候触发了0x00007FFE73681A03 (swresample-4.dll)处(位于 xx.exe 中)引发的异常: 0xC0000005: 写入位置 0x0000000000000000 时发生访问冲突。
ffmpeg源码中的swr_convert函数声明:int swr_convert(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in , int in_count);
点击弹出对话框的中断按钮就出现上面的截图,一般是swr_convert函数的参数有问题,后来对照之前调试的正确的参数验证,发现还是报错了,把对应的代码拷贝到文本文件,再拷贝到开发编辑界面调试,发现就没有报错了,但不稳定,有时候报错,有时候没报错,之前是调整整个程序文件中用到的变量的顺序后没有再出现。
总结,如果一旦错误,出了这个问题,后续即使代码改对了,还是会出现这个问题,只要还是那个cpp文件,如果从一个运行正常的把代码全都拷贝过来发现又不报错,如果一点一点的改,即使用代码比对,发现一样,还是会报错,真是不知道自己编辑问题,还是真的这么莫名其妙 。后面干脆改好逻辑,新建一个文件,复制到新文件,然后把旧的删除了,然后再运行。碰到这个问题,先把参数改对,如果还是触发,可以新建一个文件调试看看验证改对了。查看反汇编出现一大堆代码如下
00007FF9E1E31A03 vmovss dword ptr [rdx],xmm0
00007FF9E1E31A07 cmp r11d,r14d
00007FF9E1E31A0A jl 00007FF9E1E31A12
00007FF9E1E31A0C sub r11d,r14d
00007FF9E1E31A0F inc r10d
00007FF9E1E31A12 add rdx,4
00007FF9E1E31A16 cmp r10d,ecx
00007FF9E1E31A19 jb 00007FF9E1E31A27
00007FF9E1E31A1B sub r10d,ecx
00007FF9E1E31A1E lea r8,[r8+4]
00007FF9E1E31A22 cmp r10d,ecx
00007FF9E1E31A25 jae 00007FF9E1E31A1B
00007FF9E1E31A27 cmp rdx,r12
00007FF9E1E31A2A jne 00007FF9E1E319B9
00007FF9E1E31A2C cmp dword ptr [rsp+68h],0
00007FF9E1E31A31 je 00007FF9E1E31A4C
00007FF9E1E31A33 mov rcx,qword ptr [rsp-8]
00007FF9E1E31A38 mov rax,r8
00007FF9E1E31A3B mov dword ptr [rcx+2Ch],r11d
00007FF9E1E31A3F sub rax,qword ptr [rsp-10h]
00007FF9E1E31A44 mov dword ptr [rcx+28h],r10d
00007FF9E1E31A48 shr rax,2
00007FF9E1E31A4C pop r13
00007FF9E1E31A4E pop r12
00007FF9E1E31A50 pop r15
00007FF9E1E31A52 pop r14
00007FF9E1E31A54 pop rbp
00007FF9E1E31A55 pop rbx
00007FF9E1E31A56 pop rsi
00007FF9E1E31A57 pop rdi
00007FF9E1E31A58 vzeroupper
00007FF9E1E31A5B ret
00007FF9E1E31A5C nop
00007FF9E1E31A5D nop
00007FF9E1E31A5E nop
00007FF9E1E31A5F nop
00007FF9E1E31A60 push rdi
00007FF9E1E31A61 push rsi
00007FF9E1E31A62 push rbx
00007FF9E1E31A63 push rbp
00007FF9E1E31A64 push r14
00007FF9E1E31A66 push r15
00007FF9E1E31A68 push r12
00007FF9E1E31A6A push r13
00007FF9E1E31A6C mov r15,rdx
00007FF9E1E31A6F mov eax,r9d
00007FF9E1E31A72 mov r10d,dword ptr [rcx+28h]
00007FF9E1E31A76 mov r11d,dword ptr [rcx+2Ch]
00007FF9E1E31A7A mov edi,dword ptr [rcx+24h]
00007FF9E1E31A7D mov r13,qword ptr [rcx+8]
00007FF9E1E31A81 mov r14d,dword ptr [rcx+30h]
00007FF9E1E31A85 mov qword ptr [rsp-8],rcx
00007FF9E1E31A8A mov ebx,dword ptr [rcx+10h]
00007FF9E1E31A8D vcvtsi2ss xmm0,xmm0,r14d
00007FF9E1E31A92 vmovss xmm4,dword ptr [7FF9E1EA3260h]
00007FF9E1E31A9A vdivss xmm4,xmm4,xmm0
00007FF9E1E31A9E mov ebp,dword ptr [rcx+20h]
00007FF9E1E31AA1 shl ebx,2
00007FF9E1E31AA4 lea r12,[r15+rax*4]
00007FF9E1E31AA8 mov r9d,dword ptr [rcx+14h]
00007FF9E1E31AAC mov ecx,dword ptr [rcx+38h]
00007FF9E1E31AAF neg rbx
00007FF9E1E31AB2 sub r13,rbx
00007FF9E1E31AB5 sub r8,rbx
00007FF9E1E31AB8 mov qword ptr [rsp-10h],r8
00007FF9E1E31ABD mov eax,r9d
00007FF9E1E31AC0 imul eax,r10d
00007FF9E1E31AC4 mov rsi,rbx
00007FF9E1E31AC7 lea rax,[r13+rax*4]
00007FF9E1E31ACC lea rdx,[rax+r9*4]
00007FF9E1E31AD0 vxorps ymm0,ymm0,ymm0
00007FF9E1E31AD4 vxorps ymm2,ymm2,ymm2
00007FF9E1E31AD8 nop
00007FF9E1E31AD9 nop
00007FF9E1E31ADA nop
00007FF9E1E31ADB nop
00007FF9E1E31ADC nop
00007FF9E1E31ADD nop
00007FF9E1E31ADE nop
00007FF9E1E31ADF nop
00007FF9E1E31AE0 vmovups ymm1,ymmword ptr [r8+rsi]
00007FF9E1E31AE6 vfmadd231ps ymm2,ymm1,ymmword ptr [rdx+rsi]
00007FF9E1E31AEC vfmadd231ps ymm0,ymm1,ymmword ptr [rax+rsi]
00007FF9E1E31AF2 add rsi,20h
00007FF9E1E31AF6 js 00007FF9E1E31AE0
00007FF9E1E31AF8 vextractf128 xmm1,ymm0,1
00007FF9E1E31AFE vextractf128 xmm3,ymm2,1
00007FF9E1E31B04 vaddps xmm0,xmm0,xmm1
00007FF9E1E31B08 vaddps xmm2,xmm2,xmm3
00007FF9E1E31B0C vcvtsi2ss xmm1,xmm1,r11d
00007FF9E1E31B11 vsubps xmm2,xmm2,xmm0
00007FF9E1E31B15 vmulps xmm1,xmm1,xmm4
00007FF9E1E31B19 vshufps xmm1,xmm1,xmm1,0
00007FF9E1E31B1E vfmadd231ps xmm0,xmm2,xmm1
00007FF9E1E31B23 vmovhlps xmm1,xmm1,xmm0
00007FF9E1E31B27 vaddps xmm0,xmm0,xmm1
00007FF9E1E31B2B vshufps xmm1,xmm0,xmm0,1
00007FF9E1E31B30 add r11d,edi
00007FF9E1E31B33 vaddps xmm0,xmm0,xmm1
00007FF9E1E31B37 add r10d,ebp
00007FF9E1E31B3A vmovss dword ptr [r15],xmm0
00007FF9E1E31B3F cmp r11d,r14d
00007FF9E1E31B42 jl 00007FF9E1E31B4A
00007FF9E1E31B44 sub r11d,r14d
00007FF9E1E31B47 inc r10d
00007FF9E1E31B4A add r15,4
00007FF9E1E31B4E cmp r10d,ecx
00007FF9E1E31B51 jb 00007FF9E1E31B5F
00007FF9E1E31B53 sub r10d,ecx
00007FF9E1E31B56 lea r8,[r8+4]
00007FF9E1E31B5A cmp r10d,ecx
00007FF9E1E31B5D jae 00007FF9E1E31B53
00007FF9E1E31B5F cmp r15,r12
00007FF9E1E31B62 jne 00007FF9E1E31ABD
00007FF9E1E31B68 cmp dword ptr [rsp+68h],0
00007FF9E1E31B6D je 00007FF9E1E31B88
00007FF9E1E31B6F mov rcx,qword ptr [rsp-8]
00007FF9E1E31B74 mov rax,r8
00007FF9E1E31B77 mov dword ptr [rcx+2Ch],r11d
00007FF9E1E31B7B sub rax,qword ptr [rsp-10h]
00007FF9E1E31B80 mov dword ptr [rcx+28h],r10d
00007FF9E1E31B84 shr rax,2
00007FF9E1E31B88 pop r13
00007FF9E1E31B8A pop r12
00007FF9E1E31B8C pop r15
00007FF9E1E31B8E pop r14
00007FF9E1E31B90 pop rbp
00007FF9E1E31B91 pop rbx
00007FF9E1E31B92 pop rsi
00007FF9E1E31B93 pop rdi
00007FF9E1E31B94 vzeroupper
00007FF9E1E31B97 ret
00007FF9E1E31B98 nop
00007FF9E1E31B99 nop
00007FF9E1E31B9A nop
00007FF9E1E31B9B nop
00007FF9E1E31B9C nop
00007FF9E1E31B9D nop
00007FF9E1E31B9E nop
00007FF9E1E31B9F nop
00007FF9E1E31BA0 push rdi
00007FF9E1E31BA1 push rsi
00007FF9E1E31BA2 push rbx
00007FF9E1E31BA3 push rbp
00007FF9E1E31BA4 push r14
00007FF9E1E31BA6 push r15
00007FF9E1E31BA8 push r12
00007FF9E1E31BAA push r13
00007FF9E1E31BAC mov edi,r9d
00007FF9E1E31BAF mov r10d,dword ptr [rcx+28h]
00007FF9E1E31BB3 mov r11d,dword ptr [rcx+2Ch]
00007FF9E1E31BB7 mov eax,dword ptr [rcx+24h]
00007FF9E1E31BBA mov r13,qword ptr [rcx+8]
00007FF9E1E31BBE mov r14d,dword ptr [rcx+30h]
00007FF9E1E31BC2 mov qword ptr [rsp-8],rcx
00007FF9E1E31BC7 mov ebx,dword ptr [rcx+10h]
00007FF9E1E31BCA mov ebp,dword ptr [rcx+20h]
00007FF9E1E31BCD shl ebx,2
00007FF9E1E31BD0 lea r12,[rdx+rdi*4]
00007FF9E1E31BD4 mov r9d,dword ptr [rcx+14h]
00007FF9E1E31BD8 mov ecx,dword ptr [rcx+38h]
00007FF9E1E31BDB neg rbx
00007FF9E1E31BDE sub r13,rbx
00007FF9E1E31BE1 sub r8,rbx
00007FF9E1E31BE4 mov qword ptr [rsp-10h],r8
00007FF9E1E31BE9 mov edi,r9d
00007FF9E1E31BEC imul edi,r10d
00007FF9E1E31BF0 mov rsi,rbx
00007FF9E1E31BF3 lea rdi,[r13+rdi*4]
00007FF9E1E31BF8 vxorps xmm0,xmm0,xmm0
00007FF9E1E31BFC nop
00007FF9E1E31BFD nop
00007FF9E1E31BFE nop
00007FF9E1E31BFF nop
00007FF9E1E31C00 vmovdqu xmm1,xmmword ptr [r8+rsi]
00007FF9E1E31C06 vfmaddps xmm0,xmm1,xmmword ptr [rdi+rsi],xmm0
00007FF9E1E31C0D add rsi,10h
00007FF9E1E31C11 js 00007FF9E1E31C00
00007FF9E1E31C13 vmovhlps xmm1,xmm1,xmm0
00007FF9E1E31C17 vaddps xmm0,xmm0,xmm1
00007FF9E1E31C1B vshufps xmm1,xmm0,xmm0,1
00007FF9E1E31C20 add r11d,eax
00007FF9E1E31C23 vaddps xmm0,xmm0,xmm1
00007FF9E1E31C27 add r10d,ebp
00007FF9E1E31C2A vmovss dword ptr [rdx],xmm0
00007FF9E1E31C2E cmp r11d,r14d
00007FF9E1E31C31 jl 00007FF9E1E31C39
00007FF9E1E31C33 sub r11d,r14d
00007FF9E1E31C36 inc r10d
00007FF9E1E31C39 add rdx,4
00007FF9E1E31C3D cmp r10d,ecx
00007FF9E1E31C40 jb 00007FF9E1E31C4E
00007FF9E1E31C42 sub r10d,ecx
00007FF9E1E31C45 lea r8,[r8+4]
00007FF9E1E31C49 cmp r10d,ecx
00007FF9E1E31C4C jae 00007FF9E1E31C42
00007FF9E1E31C4E cmp rdx,r12
00007FF9E1E31C51 jne 00007FF9E1E31BE9
00007FF9E1E31C53 cmp dword ptr [rsp+68h],0
00007FF9E1E31C58 je 00007FF9E1E31C73
00007FF9E1E31C5A mov rcx,qword ptr [rsp-8]
00007FF9E1E31C5F mov rax,r8
00007FF9E1E31C62 mov dword ptr [rcx+2Ch],r11d
00007FF9E1E31C66 sub rax,qword ptr [rsp-10h]
00007FF9E1E31C6B mov dword ptr [rcx+28h],r10d
00007FF9E1E31C6F shr rax,2
00007FF9E1E31C73 pop r13
00007FF9E1E31C75 pop r12
00007FF9E1E31C77 pop r15
00007FF9E1E31C79 pop r14
00007FF9E1E31C7B pop rbp
00007FF9E1E31C7C pop rbx
00007FF9E1E31C7D pop rsi
00007FF9E1E31C7E pop rdi
00007FF9E1E31C7F ret
00007FF9E1E31C80 push rdi
00007FF9E1E31C81 push rsi
00007FF9E1E31C82 push rbx
00007FF9E1E31C83 push rbp
00007FF9E1E31C84 push r14
00007FF9E1E31C86 push r15
00007FF9E1E31C88 push r12
00007FF9E1E31C8A push r13
00007FF9E1E31C8C mov r15,rdx
00007FF9E1E31C8F mov eax,r9d
00007FF9E1E31C92 mov r10d,dword ptr [rcx+28h]
00007FF9E1E31C96 mov r11d,dword ptr [rcx+2Ch]
00007FF9E1E31C9A mov edi,dword ptr [rcx+24h]
00007FF9E1E31C9D mov r13,qword ptr [rcx+8]
00007FF9E1E31CA1 mov r14d,dword ptr [rcx+30h]
00007FF9E1E31CA5 mov qword ptr [rsp-8],rcx
00007FF9E1E31CAA mov ebx,dword ptr [rcx+10h]
00007FF9E1E31CAD vcvtsi2ss xmm0,xmm0,r14d
00007FF9E1E31CB2 vmovss xmm4,dword ptr [7FF9E1EA3260h]
00007FF9E1E31CBA vdivss xmm4,xmm4,xmm0
00007FF9E1E31CBE mov ebp,dword ptr [rcx+20h]
00007FF9E1E31CC1 shl ebx,2
00007FF9E1E31CC4 lea r12,[r15+rax*4]
00007FF9E1E31CC8 mov r9d,dword ptr [rcx+14h]
00007FF9E1E31CCC mov ecx,dword ptr [rcx+38h]
00007FF9E1E31CCF neg rbx
00007FF9E1E31CD2 sub r13,rbx
00007FF9E1E31CD5 sub r8,rbx
00007FF9E1E31CD8 mov qword ptr [rsp-10h],r8
00007FF9E1E31CDD mov eax,r9d
00007FF9E1E31CE0 imul eax,r10d
00007FF9E1E31CE4 mov rsi,rbx
00007FF9E1E31CE7 lea rax,[r13+rax*4]
00007FF9E1E31CEC lea rdx,[rax+r9*4]
00007FF9E1E31CF0 vxorps xmm0,xmm0,xmm0
00007FF9E1E31CF4 vxorps xmm2,xmm2,xmm2
00007FF9E1E31CF8 nop
00007FF9E1E31CF9 nop
00007FF9E1E31CFA nop
00007FF9E1E31CFB nop
00007FF9E1E31CFC nop
00007FF9E1E31CFD nop
00007FF9E1E31CFE nop
00007FF9E1E31CFF nop
00007FF9E1E31D00 vmovdqu xmm1,xmmword ptr [r8+rsi]
00007FF9E1E31D06 vfmaddps xmm2,xmm1,xmmword ptr [rdx+rsi],xmm2
00007FF9E1E31D0D vfmaddps xmm0,xmm1,xmmword ptr [rax+rsi],xmm0
00007FF9E1E31D14 add rsi,10h
00007FF9E1E31D18 js 00007FF9E1E31D00
00007FF9E1E31D1A vcvtsi2ss xmm1,xmm1,r11d
00007FF9E1E31D1F vsubps xmm2,xmm2,xmm0
00007FF9E1E31D23 vmulps xmm1,xmm1,xmm4
00007FF9E1E31D27 vshufps xmm1,xmm1,xmm1,0
00007FF9E1E31D2C vfmaddps xmm0,xmm2,xmm1,xmm0
00007FF9E1E31D32 vmovhlps xmm1,xmm1,xmm0
00007FF9E1E31D36 vaddps xmm0,xmm0,xmm1
00007FF9E1E31D3A vshufps xmm1,xmm0,xmm0,1
00007FF9E1E31D3F add r11d,edi
00007FF9E1E31D42 vaddps xmm0,xmm0,xmm1
00007FF9E1E31D46 add r10d,ebp
00007FF9E1E31D49 vmovss dword ptr [r15],xmm0
00007FF9E1E31D4E cmp r11d,r14d
00007FF9E1E31D51 jl 00007FF9E1E31D59
00007FF9E1E31D53 sub r11d,r14d
00007FF9E1E31D56 inc r10d
00007FF9E1E31D59 add r15,4
00007FF9E1E31D5D cmp r10d,ecx
00007FF9E1E31D60 jb 00007FF9E1E31D6E
00007FF9E1E31D62 sub r10d,ecx
00007FF9E1E31D65 lea r8,[r8+4]
00007FF9E1E31D69 cmp r10d,ecx
00007FF9E1E31D6C jae 00007FF9E1E31D62
00007FF9E1E31D6E cmp r15,r12
00007FF9E1E31D71 jne 00007FF9E1E31CDD
00007FF9E1E31D77 cmp dword ptr [rsp+68h],0
00007FF9E1E31D7C je 00007FF9E1E31D97
00007FF9E1E31D7E mov rcx,qword ptr [rsp-8]
00007FF9E1E31D83 mov rax,r8
00007FF9E1E31D86 mov dword ptr [rcx+2Ch],r11d
00007FF9E1E31D8A sub rax,qword ptr [rsp-10h]
00007FF9E1E31D8F mov dword ptr [rcx+28h],r10d
00007FF9E1E31D93 shr rax,2
00007FF9E1E31D97 pop r13
00007FF9E1E31D99 pop r12
00007FF9E1E31D9B pop r15
00007FF9E1E31D9D pop r14
00007FF9E1E31D9F pop rbp
00007FF9E1E31DA0 pop rbx
00007FF9E1E31DA1 pop rsi
00007FF9E1E31DA2 pop rdi
00007FF9E1E31DA3 ret
00007FF9E1E31DA4 nop
00007FF9E1E31DA5 nop
00007FF9E1E31DA6 nop
00007FF9E1E31DA7 nop
00007FF9E1E31DA8 nop
00007FF9E1E31DA9 nop
00007FF9E1E31DAA nop
00007FF9E1E31DAB nop
00007FF9E1E31DAC nop
00007FF9E1E31DAD nop
00007FF9E1E31DAE nop
00007FF9E1E31DAF nop
00007FF9E1E31DB0 push rdi
00007FF9E1E31DB1 push rsi
00007FF9E1E31DB2 push rbx
00007FF9E1E31DB3 push rbp
00007FF9E1E31DB4 push r14
00007FF9E1E31DB6 push r15
00007FF9E1E31DB8 push r12
00007FF9E1E31DBA push r13
00007FF9E1E31DBC mov edi,r9d
00007FF9E1E31DBF mov r10d,dword ptr [rcx+28h]
00007FF9E1E31DC3 mov r11d,dword ptr [rcx+2Ch]
00007FF9E1E31DC7 mov eax,dword ptr [rcx+24h]
00007FF9E1E31DCA mov r13,qword ptr [rcx+8]
00007FF9E1E31DCE mov r14d,dword ptr [rcx+30h]
00007FF9E1E31DD2 mov qword ptr [rsp-8],rcx
00007FF9E1E31DD7 mov ebx,dword ptr [rcx+10h]
00007FF9E1E31DDA mov ebp,dword ptr [rcx+20h]
00007FF9E1E31DDD shl ebx,1
00007FF9E1E31DDF lea r12,[rdx+rdi*2]
00007FF9E1E31DE3 mov r9d,dword ptr [rcx+14h]
00007FF9E1E31DE7 mov ecx,dword ptr [rcx+38h]
00007FF9E1E31DEA neg rbx
00007FF9E1E31DED sub r13,rbx
00007FF9E1E31DF0 sub r8,rbx
00007FF9E1E31DF3 mov qword ptr [rsp-10h],r8
00007FF9E1E31DF8 mov edi,r9d
00007FF9E1E31DFB imul edi,r10d
00007FF9E1E31DFF mov rsi,rbx
00007FF9E1E31E02 lea rdi,[r13+rdi*2]
00007FF9E1E31E07 movd xmm0,dword ptr [7FF9E1EA326Ch]
00007FF9E1E31E0F nop
00007FF9E1E31E10 movdqu xmm1,xmmword ptr [r8+rsi]
00007FF9E1E31E16 pmaddwd xmm1,xmmword ptr [rdi+rsi]
00007FF9E1E31E1B paddd xmm0,xmm1
00007FF9E1E31E1F add rsi,10h
00007FF9E1E31E23 js 00007FF9E1E31E10
00007FF9E1E31E25 movhlps xmm1,xmm0
00007FF9E1E31E28 paddd xmm0,xmm1
00007FF9E1E31E2C pshuflw xmm1,xmm0,0Eh
00007FF9E1E31E31 paddd xmm0,xmm1
00007FF9E1E31E35 psrad xmm0,0Fh
00007FF9E1E31E3A add r11d,eax
00007FF9E1E31E3D packssdw xmm0,xmm0
00007FF9E1E31E41 add r10d,ebp
00007FF9E1E31E44 movd dword ptr [rdx],xmm0
00007FF9E1E31E48 cmp r11d,r14d
00007FF9E1E31E4B jl 00007FF9E1E31E53
00007FF9E1E31E4D sub r11d,r14d
00007FF9E1E31E50 inc r10d
00007FF9E1E31E53 add rdx,2
00007FF9E1E31E57 cmp r10d,ecx
00007FF9E1E31E5A jb 00007FF9E1E31E68
00007FF9E1E31E5C sub r10d,ecx
00007FF9E1E31E5F lea r8,[r8+2]
00007FF9E1E31E63 cmp r10d,ecx
00007FF9E1E31E66 jae 00007FF9E1E31E5C
00007FF9E1E31E68 cmp rdx,r12
00007FF9E1E31E6B jne 00007FF9E1E31DF8
00007FF9E1E31E6D cmp dword ptr [rsp+68h],0
00007FF9E1E31E72 je 00007FF9E1E31E8C
00007FF9E1E31E74 mov rcx,qword ptr [rsp-8]
00007FF9E1E31E79 mov rax,r8
00007FF9E1E31E7C mov dword ptr [rcx+2Ch],r11d
00007FF9E1E31E80 sub rax,qword ptr [rsp-10h]
看这样的代码,来定位出问题,还没研究应该怎样定位。重采样后的声音变了,这又是另一个问题了。