locked
Failed to set Bitrate for MediaCapture

    Question

  • ......
    MediaEncodingProfile^ recordProfile=MediaEncodingProfile::CreateMp3(Windows::Media::MediaProperties::AudioEncodingQuality::Low);
    
    		AudioEncodingProperties^ audioProfile = ref new AudioEncodingProperties();
    
    		audioProfile->Bitrate = 32000;
    		audioProfile->BitsPerSample = 16;
    		audioProfile->ChannelCount = 2;
    		audioProfile->SampleRate = 44100;
    		audioProfile->Subtype = "MP3";
    
    		recordProfile->Audio = audioProfile;
    
    		try
    		{
    		auto opStartRecord = m_mediaCaptureMgr->StartRecordToStreamAsync(recordProfile, this->m_randomAccessStream);
            opStartRecord->Completed = ref new AsyncActionCompletedHandler(this, &CAudioCapture::OnStartRecordCB);
    		}
    		catch(Platform::Exception^ e)
    		{
    			String^ msg=e->Message;
    		}
    ................
    
    
    void CAudioCapture::OnStartRecordCB(Windows::Foundation::IAsyncAction^ op,Windows::Foundation::AsyncStatus status)
    {
    	Windows::UI::Core::InvokedHandler^ handler = ref new Windows::UI::Core::InvokedHandler(this, &CAudioCapture::OnStartRecordComplete, Platform::CallbackContext::Any);
    	this->_EnvetDispatcher->InvokeAsync(Windows::UI::Core::CoreDispatcherPriority::High, handler, this, op);
    }
    I want to change the bitrate to 32000,but the AsyncStatus show me  an error...I want to know if I can change the bitrate or I can only use the three profiles  
    Tuesday, April 17, 2012 11:05 AM

All replies

  • Hello,

    What error message do you get?

    Would you please upload this project to skydriver?
    http://skydrive.live.com/

    It is not necessary that you send out the whole of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business details from it.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 18, 2012 6:28 AM
  • Thank you for reply,but now I'm a little busy,I will upload the code when I'm free.

    I just Got a Windows::Foundation::AsyncStatus 3,I want to know how can I get more detail about this error,there is no exception throwed,I have no idea...

    Should the bitrate of the capture be set to some special value?

    Wednesday, April 18, 2012 6:39 AM
  • Does try-catch block in your codes not get any error message?

     

    Best regards,

    Jesse



    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 18, 2012 7:44 AM
  • I did the try-catch but no exception throw,the code is

    try
    {
       auto opStartRecord = m_mediaCaptureMgr->StartRecordToStreamAsync(recordProfile, this->m_randomAccessStream);
       opStartRecord->Completed = ref new AsyncActionCompletedHandler(this, &CAudioCapture::OnStartRecordCB);
    }
    catch(Platform::Exception^ e)
    {
       String^ msg=e->Message;
    }

    If I missed something or I did try-catch in wrong place,please tell me.Thank you.

    • Proposed as answer by tommy0701 Tuesday, May 22, 2012 2:50 AM
    • Unproposed as answer by tommy0701 Tuesday, May 22, 2012 2:50 AM
    Wednesday, April 18, 2012 9:46 AM
  • I have a same problem.

    Did you finda solution tothis problem?

    please tell me.Thank you.

    Tuesday, May 22, 2012 3:46 AM