add defense code for player TC
Add error handling logics
for filesystem and file open file cases
****************************************************************************/
#include <memory>
+#include <string.h>
#include <media/MediaPlayer.h>
#include <media/FileInputDataSource.h>
#include "tc_common.h"
@@ -51,9 +52,15 @@ void EmptyObserver::onPlaybackPaused(media::MediaPlayer &mediaPlayer)
static void SetUp(void)
{
FILE *fp = fopen(dummyfilepath, "w");
- fputs("dummydata", fp);
+
+ if (fp != nullptr) {
+ int ret = fputs("dummydata", fp);
+ if (ret != (int)strlen("dummydata")) {
+ printf("MediaPlayer SetUp Failed\n");
+ }
fclose(fp);
}
+}
static void TearDown()
{
