| 57 | } |
| 58 | |
| 59 | CacheRet CacheModule::checkCanBeCached(const string &acturalPlayURL) |
| 60 | { |
| 61 | AF_LOGD("---> prepare()"); |
| 62 | { |
| 63 | unique_lock<mutex> lock(mStatusMutex); |
| 64 | |
| 65 | if (mStatus != Stopped) { |
| 66 | return CACHE_ERROR_STATUS; |
| 67 | } |
| 68 | |
| 69 | if (AfString::isLocalURL(acturalPlayURL)) { |
| 70 | mStatus = Status::Stopped; |
| 71 | AF_LOGE("url is local source"); |
| 72 | return CACHE_ERROR_LOCAL_SOURCE; |
| 73 | } |
| 74 | |
| 75 | const CacheRet &cacheRet = mCacheChecker.checkConfig(); |
| 76 | mStatus = (cacheRet.mCode == CACHE_SUCCESS.mCode ? Status::Prepared : Status::Stopped); |
| 77 | return cacheRet; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | void CacheModule::setMediaInfo(int64_t fileSize, int64_t duration) |
| 82 | { |