status_t AuthorDriver::enqueueCommand(author_command *ac, media_completion_f comp, void *cookie)
{
+ if (mAuthor == NULL) {
+ return NO_INIT;
+ }
// If the user didn't specify a completion callback, we
// are running in synchronous mode.
if (comp == NULL) {
status_t PlayerDriver::enqueueCommand(PlayerCommand* command)
{
if (mPlayer == NULL) {
- delete command;
+ // Only commands which can come in this use-case is PLAYER_SETUP and PLAYER_QUIT
+ // The calling function should take responsibility to delete the command and cleanup
return NO_INIT;
}
LOGV("construct PlayerDriver");
mPlayerDriver = new PlayerDriver(this);
LOGV("send PLAYER_SETUP");
- mInit = mPlayerDriver->enqueueCommand(new PlayerSetup(0,0));
+ PlayerSetup* setup = new PlayerSetup(0,0);
+ mInit = mPlayerDriver->enqueueCommand(setup);
+ if (mInit == NO_INIT) {
+ delete setup;
+ }
}
status_t PVPlayer::initCheck()