Chromium Code Reviews| Index: media/base/media_log.cc |
| diff --git a/media/base/media_log.cc b/media/base/media_log.cc |
| index b172bfbce912f828f4896769a215f1d7658a6877..436d586a96b07dd22e72801d4a191e6279f67658 100644 |
| --- a/media/base/media_log.cc |
| +++ b/media/base/media_log.cc |
| @@ -98,6 +98,32 @@ const char* MediaLog::PipelineStatusToString(PipelineStatus status) { |
| return NULL; |
| } |
| +bool MediaLog::StringToPipelineStatus(const std::string& status, |
| + PipelineStatus& out_status) { |
| + static std::map<std::string, PipelineStatus> status_map = { |
|
DaleCurtis
2014/11/06 23:49:08
Instead just create a parallel array of strings wh
prabhur1
2014/11/07 23:43:24
Done.
|
| + {"pipeline: ok", PIPELINE_OK}, |
| + {"pipeline: url not found", PIPELINE_ERROR_URL_NOT_FOUND}, |
| + {"pipeline: network error", PIPELINE_ERROR_NETWORK}, |
| + {"pipeline: decode error", PIPELINE_ERROR_DECODE}, |
| + {"pipeline: decrypt error", PIPELINE_ERROR_DECRYPT}, |
| + {"pipeline: abort", PIPELINE_ERROR_ABORT}, |
| + {"pipeline: initialization failed", PIPELINE_ERROR_INITIALIZATION_FAILED}, |
| + {"pipeline: could not render", PIPELINE_ERROR_COULD_NOT_RENDER}, |
| + {"pipeline: read error", PIPELINE_ERROR_READ}, |
| + {"pipeline: operation pending", PIPELINE_ERROR_OPERATION_PENDING}, |
| + {"pipeline: invalid state", PIPELINE_ERROR_INVALID_STATE}, |
| + {"demuxer: could not open", DEMUXER_ERROR_COULD_NOT_OPEN}, |
| + {"dumuxer: could not parse", DEMUXER_ERROR_COULD_NOT_PARSE}, |
| + {"demuxer: no supported streams", DEMUXER_ERROR_NO_SUPPORTED_STREAMS}, |
| + {"decoder: not supported", DECODER_ERROR_NOT_SUPPORTED}}; |
| + auto it = status_map.find(status); |
| + if (it != status_map.end()) { |
| + out_status = status_map[status]; |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| LogHelper::LogHelper(const LogCB& log_cb) : log_cb_(log_cb) {} |
| LogHelper::~LogHelper() { |