运行CameraDshowApp.exe后系统声音为什么会消失

凉拌菜 2010-11-26 11:59:06
系统CE6.0,平台S5PC100,没有运行CameraDshowApp.exe前系统声音是正常的,点击触摸屏,播放视频/音频都正常,但是当运行CameraDshowApp.exe后所有的系统声音都没有了,播放视频/音频都没有声音,而且会比较卡。这是怎么回事,有没有哪位遇到过类似的情况。
在应用程序里跟踪了一下代码发现运行如下代码后系统的声音就没有了,确切的说是运行了 hr = g_DShowCaptureGraph.RunGraph()后异常就产生了。
if(SUCCEEDED(g_DShowCaptureGraph.Init(hwnd, &rc, g_dwFilters )))
{

hr = g_DShowCaptureGraph.SetStillCaptureFileName(g_tszStillFileName);
if(FAILED(hr))
{
RETAILMSG(1, ( TEXT("CameraDShowApp: Failed to set the still image file name.")));
}

hr = g_DShowCaptureGraph.SetVideoCaptureFileName(g_tszCaptureFileName);
if(FAILED(hr))
{
RETAILMSG(1, ( TEXT("CameraDShowApp: Failed to set the video capture file name.")));
}

hr = g_DShowCaptureGraph.RunGraph();
if(FAILED(hr))
{
RETAILMSG(1, ( TEXT("CameraDShowApp: Starting the capture graph failed.")));
}
}
else
{
RETAILMSG(1, ( TEXT("CameraDShowApp: Initializing the capture graph failed.")));
}
...全文
125 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
凉拌菜 2010-12-02
  • 打赏
  • 举报
回复
问题解决,之所以出现上述问题是camera priview buffer size默认的是800*480的,小于我现在设置的分辨率。结贴!
凉拌菜 2010-11-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 hohohahahoho 的回复:]
可能是程序在录音
[/Quote]
应该不是录音的问题,我通过测试发现当预览和拍照分辨率较低时不会出现上述情况,比如640X480就不没有什么问题,当把camera设置为1280X1024时就会出现上述情况,很奇怪的是当camera设置为1280X1024时如果设置应用程序不预览只拍照也不会出现上述情况。我怀疑是内存分配的,在image_cfg.h里关于camera和显存的分配如下:
// NK - Camera Still Area
#define IMAGE_CAMERA_CAPTUREBUFFER_SIZE (0x00600000)
// NK - Display FrameBuffer - Refer to platform.reg
#define IMAGE_FRAMEBUFFER_SIZE (0x00800000)
// NK - Camera Preview Buffer
#define IMAGE_CAMERA_PREVIEWBUFFER_SIZE 0x003F0000) // Reserved region 0x10000
但是这些分配的内存区域都大于1024X1280,问题会出在哪里呢?
hohohahahoho 2010-11-28
  • 打赏
  • 举报
回复
可能是程序在录音
91program 2010-11-26
  • 打赏
  • 举报
回复
g_DShowCaptureGraph.RunGraph()呢,不能跟踪进去吗?
凉拌菜 2010-11-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 91program 的回复:]
g_DShowCaptureGraph.RunGraph()呢,不能跟踪进去吗?
[/Quote]
这个函数当然也跟进去看了,代码如下:
CCaptureFramework::RunGraph()
{
HRESULT hr = S_OK;
OAFilterState fsBefore;
OAFilterState fsAfter;

if(m_pMediaControl == NULL)
{
FAIL(TEXT("CCaptureFramework: Core components needed for RunGraph unavailable."));
hr = E_FAIL;
goto cleanup;
}

hr = m_pMediaControl->GetState(MEDIAEVENT_TIMEOUT, &fsBefore);
if(FAILED(hr))
{
FAIL(TEXT("CCaptureFramework: Retrieving the graph state failed."));
goto cleanup;
}

// BUGBUG: 107737 - telling a running graph to run again breaks the graph time
if(fsBefore != State_Running)
{
hr = m_pMediaControl->Run(); if(FAILED(hr))
{
DETAIL(TEXT("CCaptureFramework: Starting the graph failed."));
goto cleanup;
}
}

hr = m_pMediaControl->GetState(MEDIAEVENT_TIMEOUT, &fsAfter);
if(FAILED(hr))
{
FAIL(TEXT("CCaptureFramework: Retrieving the graph state failed."));
goto cleanup;
}

if(fsAfter != State_Running)
{
FAIL(TEXT("CCaptureFramework: Failed to change the filter state."));
goto cleanup;
}

// if the graph state was stopped, then set the new file name. if it was running or paused, then don't because we may still be doing
// a capture. A previous capture doesn't end until the graph is stopped.
if(fsBefore == State_Stopped)
{
// increment the file name before the capture (so the current file name is the file being captured until a new capture starts).
m_lCaptureNumber++;

// send the file name to the file sink now
if(FAILED(hr = PropogateFilenameToCaptureFilter()))
{
FAIL(TEXT("CCaptureFramework: Failed to set the capture file name."));
goto cleanup;
}
}

cleanup:
return hr;
}
当运行hr = m_pMediaControl->Run()后系统声音就没了,该函数是微软写好的代码,在MSDN里可以看到run()就是Runs all the filters in the filter graph,显然问题不会出在这些代码上。由于对DirectShow了解不多,不能明白为什么会出现这样的问题,我觉得可能是存在某些冲突才会出现这样的问题。还望高手指点指点。

19,504

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧