我更改了演示代码media_stream_video.cc 通过以下代码将ConfigureTrack设置为单线程:
m_p_worker_thread.message_loop().PostWork(callback_factory_.NewCallback(&MediaStreamVideoDemoInstance::ConfigureTrack));
然后从JavaScript中,通过以下代码将视频样本更改为共享样本:
chrome.desktopCapture.chooseDesktopMedia(["screen", "window"], onAccessApproved);
function onAccessApproved(){
navigator.webkitGetUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'desktop',
chromeMediaSourceId: desktop_id,
maxWidth: 1920,
maxHeight: 1200,
maxFrameRate: 5
}
}
}, success, console.log);
}
我重复停止共享并开始共享。将崩溃,下面是回溯:
#0 0x000000000fe509c2 in ?? ()
#1 0x000000000fd55f20 in ?? ()
#2 0x0000000000056d40 in pp::VideoFrame::GetFormat (this=0xfed7fa68) at video_frame.cc:49
#3 0x0000000000026240 in (anonymous namespace)::MediaStreamVideoDemoInstance::OnGetFrame (this=0xfeec0520, result=0,
frame=...) at media_stream_video.cc:621
#4 0x0000000000026b20 in pp::CompletionCallbackFactory<(anonymous namespace)::MediaStreamVideoDemoInstance, pp::ThreadSafeThreadTraits>::DispatcherWithOutput0<pp::VideoFrame, void ((anonymous namespace)::MediaStreamVideoDemoInstance::*)(int, pp::VideoFrame)>::operator() (this=0xfeec1298, object=0xfeec0520, result=0)
at D:/Project/nacl_sdk/pepper_49/include\ppapi/utility/completion_callback_factory.h:633
#5 0x0000000000026920 in pp::CompletionCallbackFactory<(anonymous namespace)::MediaStreamVideoDemoInstance, pp::ThreadSafeThreadTraits>::CallbackData<pp::CompletionCallbackFactory<(anonymous namespace)::MediaStreamVideoDemoInstance, pp::ThreadSafeThreadTraits>::DispatcherWithOutput0<pp::VideoFrame, void ((anonymous namespace)::MediaStreamVideoDemoInstance::*)(int, pp::VideoFrame)> >::Thunk (user_data=0xfeec12a8, result=0)
at D:/Project/nacl_sdk/pepper_49/include\ppapi/utility/completion_callback_factory.h:584
#6 0x000000000fea6840 in ?? ()
#7 0x000000000fe0d420 in ?? ()
#8 0x000000000fe0d5a0 in ?? ()
#9 0x000000000fe0d4e0 in ?? ()
#10 0x000000000fdd8100 in ?? ()
#11 0x000000000fdb7560 in ?? ()
#12 0x000000000fdb79e0 in ?? ()
#13 0x000000000fdb7ca0 in ?? ()
#14 0x000000000fdb9ca0 in ?? ()
#15 0x000000000fdcb880 in ?? ()
#16 0x000000000fea2120 in ?? ()
#17 0x000000000fe153e0 in ?? ()
#18 0x000000000fe162c0 in ?? ()
#19 0x0000000000041980 in pp::MessageLoop::Run (this=0xfeec06f0) at message_loop.cc:67
#20 0x0000000000050740 in pp::(anonymous namespace)::RunThread (void_data=0xfeec06f0) at simple_thread.cc:41
---Type <return> to continue, or q <return> to quit---
#21 0x0000000000062d80 in nc_thread_starter () at src/untrusted/pthread/nc_thread.c:101
#22 0x000000000fdf9560 in ?? ()
#23 0x0000000000000000 in ?? ()
测试手册:联想 CPU:Inter(R)Celeron(R)CPU N3350 @ 1.10GHz 架构:x86_64 处理器数量:2
我测试另一本书,没有这个问题。 我认为这是一个竞争问题。但我不确定。 有人可以帮助我吗?