Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[video_player_avplay]No return empty error message #703

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/video_player_avplay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Remove wrong information in README.
* Add plusplayer ini.
* Fix crash issue when error message is empty.

## 0.4.3

Expand Down
3 changes: 2 additions & 1 deletion packages/video_player_avplay/tizen/src/media_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ void MediaPlayer::OnError(int error_code, void *user_data) {
get_error_message(error_code));

MediaPlayer *self = static_cast<MediaPlayer *>(user_data);
self->SendError("Media Player error", get_error_message(error_code));
self->SendError("Media Player error",
std::string("Error: ") + get_error_message(error_code));
}

void MediaPlayer::OnSubtitleUpdated(unsigned long duration, char *text,
Expand Down
90 changes: 88 additions & 2 deletions packages/video_player_avplay/tizen/src/plus_player.cc
Original file line number Diff line number Diff line change
Expand Up @@ -657,20 +657,106 @@ void PlusPlayer::OnResourceConflicted(void *user_data) {
self->SendError("PlusPlayer error", "Resource conflicted");
}

std::string GetErrorMessage(plusplayer::ErrorType error_code) {
switch (error_code) {
case plusplayer::ErrorType::kNone: {
return "Successful";
}
swift-kim marked this conversation as resolved.
Show resolved Hide resolved
case plusplayer::ErrorType::kOutOfMemory: {
return "Out of memory";
}
case plusplayer::ErrorType::kInvalidParameter: {
return "Invalid parameter";
}
case plusplayer::ErrorType::kNoSuchFile: {
return "No such file or directory";
}
case plusplayer::ErrorType::kInvalidOperation: {
return "Invalid operation";
}
case plusplayer::ErrorType::kFileNoSpaceOnDevice: {
return "No space left on the device";
}
case plusplayer::ErrorType::kFeatureNotSupportedOnDevice: {
return "Not supported file on this device";
}
case plusplayer::ErrorType::kSeekFailed: {
return "Seek operation failure";
}
case plusplayer::ErrorType::kInvalidState: {
return "Invalid player state";
}
case plusplayer::ErrorType::kNotSupportedFile: {
return "File format not supported";
}
case plusplayer::ErrorType::kNotSupportedFormat: {
return "Not supported media format";
}
case plusplayer::ErrorType::kInvalidUri: {
return "Invalid URI";
}
case plusplayer::ErrorType::kSoundPolicy: {
return "Sound policy error";
}
case plusplayer::ErrorType::kConnectionFailed: {
return "Streaming connection failed";
}
case plusplayer::ErrorType::kVideoCaptureFailed: {
return "Video capture failed";
}
case plusplayer::ErrorType::kDrmExpired: {
return "DRM license expired";
}
case plusplayer::ErrorType::kDrmNoLicense: {
return "DRM no license";
}
case plusplayer::ErrorType::kDrmFutureUse: {
return "License for future use";
}
case plusplayer::ErrorType::kDrmNotPermitted: {
return "DRM format not permitted";
}
case plusplayer::ErrorType::kResourceLimit: {
return "Resource limit";
}
case plusplayer::ErrorType::kPermissionDenied: {
return "Permission denied";
}
case plusplayer::ErrorType::kServiceDisconnected: {
return "Service disconnected";
}
case plusplayer::ErrorType::kBufferSpace: {
return "No buffer space available";
}
case plusplayer::ErrorType::kNotSupportedAudioCodec: {
return "Not supported audio codec but video can be played";
}
case plusplayer::ErrorType::kNotSupportedVideoCodec: {
return "Not supported video codec but audio can be played";
}
case plusplayer::ErrorType::kNotSupportedSubtitle: {
return "Not supported subtitle format";
}
default:
return "Not defined error";
}
}

void PlusPlayer::OnError(const plusplayer::ErrorType &error_code,
void *user_data) {
LOG_ERROR("[PlusPlayer] Error code: %d", error_code);
PlusPlayer *self = reinterpret_cast<PlusPlayer *>(user_data);

self->SendError("[PlusPlayer] OnError", "");
self->SendError("[PlusPlayer] error",
std::string("Error: ") + GetErrorMessage(error_code));
}

void PlusPlayer::OnErrorMsg(const plusplayer::ErrorType &error_code,
const char *error_msg, void *user_data) {
LOG_ERROR("[PlusPlayer] Error code: %d, message: %s.", error_code, error_msg);
PlusPlayer *self = reinterpret_cast<PlusPlayer *>(user_data);

self->SendError("PlusPlayer error", error_msg);
self->SendError("PlusPlayer error", std::string("Error: ") + error_msg);
}

void PlusPlayer::OnDrmInitData(int *drm_handle, unsigned int len,
Expand Down
Loading