Fix issue on thread apartment switching

This commit is contained in:
bossiel 2013-07-16 05:25:18 +00:00
parent deab41ccb3
commit 2c7ca7bc03
5 changed files with 7 additions and 5 deletions

View File

@ -373,7 +373,7 @@ HRESULT MFCodecVideo::Initialize(
CHECK_HR(hr = m_pOutputType->SetGUID(MF_MT_SUBTYPE, (m_eType == MFCodecType_Encoder) ? m_guidCompressedFormat : kMFCodecUncompressedFormat));
CHECK_HR(hr = m_pInputType->SetGUID(MF_MT_SUBTYPE, (m_eType == MFCodecType_Encoder) ? kMFCodecUncompressedFormat : m_guidCompressedFormat));
CHECK_HR(hr = m_pOutputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, (m_eType == MFCodecType_Encoder) ? FALSE : TRUE));
CHECK_HR(hr = m_pInputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, (m_eType == MFCodecType_Encoder) ? TRUE : FALSE));

View File

@ -53,7 +53,7 @@ HRESULT MFUtils::Startup()
if(!g_bStarted)
{
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if(SUCCEEDED(hr))
if(SUCCEEDED(hr) || hr == 0x80010106) // 0x80010106 when called from managed code (e.g. Boghe) - More info: http://support.microsoft.com/kb/824480
{
hr = MFStartup(MF_VERSION);
}

View File

@ -415,7 +415,7 @@ bail:
if(rtp_hdr->marker) {
h264->decoder.accumulator_pos = 0;
}
if(FAILED(hr)){
if(FAILED(hr) /*|| (!pSampleOut && rtp_hdr->marker)*/){
TSK_DEBUG_INFO("Failed to decode the buffer with error code =%d, size=%u, append=%s", ret, h264->decoder.accumulator_pos, append_scp ? "yes" : "no");
if(TMEDIA_CODEC_VIDEO(self)->in.callback){
TMEDIA_CODEC_VIDEO(self)->in.result.type = tmedia_video_decode_result_type_error;

View File

@ -296,7 +296,9 @@ static int plugin_win_mf_producer_video_prepare(tmedia_producer_t* self, const t
CHECK_HR(hr = pSelf->pGrabberInputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video));
CHECK_HR(hr = pSelf->pGrabberInputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive));
CHECK_HR(hr = MFSetAttributeSize(pSelf->pGrabberInputType, MF_MT_FRAME_SIZE, TMEDIA_PRODUCER(pSelf)->video.width, TMEDIA_PRODUCER(pSelf)->video.height));
CHECK_HR(hr = MFSetAttributeRatio(pSelf->pGrabberInputType, MF_MT_FRAME_RATE, TMEDIA_PRODUCER(pSelf)->video.fps, 1));
if(pSelf->pEncoder) { // FIXME: Fails on Boghe and not on Gotham when no encoder.
CHECK_HR(hr = MFSetAttributeRatio(pSelf->pGrabberInputType, MF_MT_FRAME_RATE, TMEDIA_PRODUCER(pSelf)->video.fps, 1));
}
CHECK_HR(hr = MFSetAttributeRatio(pSelf->pGrabberInputType, MF_MT_PIXEL_ASPECT_RATIO, 1, 1));
CHECK_HR(hr = pSelf->pGrabberInputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, pSelf->pEncoder ? FALSE : TRUE));
CHECK_HR(hr = pSelf->pGrabberInputType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, pSelf->pEncoder ? FALSE : TRUE));

View File

@ -1248,7 +1248,7 @@ int tsip_dialog_get_lasterror(const tsip_dialog_t* self, short *code, const char
int tsip_dialog_hangup(tsip_dialog_t *self, const tsip_action_t* action)
{
if(self){
// CANCEL should only be send for INVITE dialog
// CANCEL should only be sent for INVITE dialog
if(self->type != tsip_dialog_INVITE || self->state == tsip_established){
return tsip_dialog_fsm_act(self, tsip_atype_hangup, tsk_null, action);
}