From 01a95ea87dbf0abdaade7176c9ddace2f84fe83c Mon Sep 17 00:00:00 2001 From: Ravindra Kumar Mishra Date: Mon, 29 Apr 2013 13:31:16 +0530 Subject: [PATCH] Fix for File SysAsset in AudioDecoder Signed-off-by: Ravindra Kumar Mishra --- project/src/Codec/AudioDecoderForm.cpp | 19 +++++++++++++++++-- project/src/Codec/AudioDecoderForm.h | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/project/src/Codec/AudioDecoderForm.cpp b/project/src/Codec/AudioDecoderForm.cpp index d37e4bc..0770264 100644 --- a/project/src/Codec/AudioDecoderForm.cpp +++ b/project/src/Codec/AudioDecoderForm.cpp @@ -118,6 +118,7 @@ AudioDecoderForm::~AudioDecoderForm(void) SAFE_DELETE(__pSrcBuf); SAFE_DELETE(__pDstBuf); SAFE_DELETE(__pDec); + SAFE_DELETE(__pDestFile); AppLog("~AudioDecoderForm completed"); } @@ -243,6 +244,7 @@ AudioDecoderForm::OnInitializing(void) __pSrcBuf = null; __pDstBuf = null; __pDec = null; + __pDestFile = null; AppLog(" AudioDecoderForm::OnInitializing! DONE \n"); return r; @@ -738,6 +740,19 @@ AudioDecoderForm::StartAudioDecoding(void) AppLog(" The current positions are input :: %d and output : %d", __pSrcBuf->GetPosition(), __pDstBuf->GetPosition()); AppLog(" The remaining of input :: %d and output buffer is %d", __pSrcBuf->GetRemaining(), __pDstBuf->GetRemaining()); + if (__pDestFile != null) + { + delete __pDestFile; + __pDestFile = null; + } + + __pDestFile = new (std::nothrow) File; + if (__pDestFile == null) + { + ShowError(E_OUT_OF_MEMORY, METHOD_FILE_LINENO); + return E_OUT_OF_MEMORY; + } + __maxBytes = __pSrcBuf->GetRemaining(); r = __pDec->Construct(__audioCodecId, pOption.get()); @@ -762,7 +777,7 @@ AudioDecoderForm::StartAudioDecoding(void) fileName.Format(1024, L"%ls%ls_%d_%d_%d.pcm", App::GetInstance()->GetAppDataPath().GetPointer(),tmp.GetPointer(), __channelCount, sampleType, __sampleRate); - r = __destFile.Construct(fileName, "w+"); + r = __pDestFile->Construct(fileName, "w+"); TryCatch( r == E_SUCCESS, , "Error Occurred:%ls", fileName.GetPointer() ); } @@ -813,7 +828,7 @@ AudioDecoderForm::ContinueAudioDecoding(void) if (__dumpFlag == true) { __pDstBuf->Flip(); - r = __destFile.Write(*__pDstBuf); + r = __pDestFile->Write(*__pDstBuf); } return; } diff --git a/project/src/Codec/AudioDecoderForm.h b/project/src/Codec/AudioDecoderForm.h index c5b78ed..84d928b 100644 --- a/project/src/Codec/AudioDecoderForm.h +++ b/project/src/Codec/AudioDecoderForm.h @@ -136,7 +136,7 @@ private: Tizen::Base::ByteBuffer* __pDstBuf; Tizen::Media::AudioDecoder* __pDec; int __maxBytes; - Tizen::Io::File __destFile; + Tizen::Io::File* __pDestFile; Tizen::Base::Runtime::Timer __updateTimer; bool __inErrorState; int __sampleRate; -- 2.7.4