Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c292a161 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "DataSourceDesc: set max time in ms and us"

parents 9cc2d5ad e31ac8a2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ struct MediaHTTPService;
// A binder interface for implementing a stagefright DataSource remotely.
struct DataSourceDesc : public RefBase {
public:
    // intentionally less than INT64_MAX
    // keep consistent with JAVA code
    static const int64_t kMaxTimeMs = 0x7ffffffffffffffll / 1000;
    static const int64_t kMaxTimeUs = kMaxTimeMs * 1000;

    enum {
        /* No data source has been set yet */
        TYPE_NONE     = 0,
+4 −4
Original line number Diff line number Diff line
@@ -404,12 +404,12 @@ status_t MediaPlayer2::setDataSource(const sp<DataSourceDesc> &dsd) {
        return BAD_VALUE;
    }
    // Microsecond is used in NuPlayer2.
    if (dsd->mStartPositionMs > INT64_MAX / 1000) {
        dsd->mStartPositionMs = INT64_MAX / 1000;
    if (dsd->mStartPositionMs > DataSourceDesc::kMaxTimeMs) {
        dsd->mStartPositionMs = DataSourceDesc::kMaxTimeMs;
        ALOGW("setDataSource, start poistion clamped to %lld ms", (long long)dsd->mStartPositionMs);
    }
    if (dsd->mEndPositionMs > INT64_MAX / 1000) {
        dsd->mEndPositionMs = INT64_MAX / 1000;
    if (dsd->mEndPositionMs > DataSourceDesc::kMaxTimeMs) {
        dsd->mEndPositionMs = DataSourceDesc::kMaxTimeMs;
        ALOGW("setDataSource, end poistion clamped to %lld ms", (long long)dsd->mStartPositionMs);
    }
    ALOGV("setDataSource type(%d), srcId(%lld)", dsd->mType, (long long)dsd->mId);
+7 −2
Original line number Diff line number Diff line
@@ -1753,8 +1753,13 @@ void NuPlayer2::onStart(bool play) {
}

void NuPlayer2::addEndTimeMonitor() {
    sp<AMessage> msg = new AMessage(kWhatEOSMonitor, this);
    ++mEOSMonitorGeneration;

    if (mCurrentSourceInfo.mEndTimeUs == DataSourceDesc::kMaxTimeUs) {
        return;
    }

    sp<AMessage> msg = new AMessage(kWhatEOSMonitor, this);
    msg->setInt32("generation", mEOSMonitorGeneration);
    mMediaClock->addTimer(msg, mCurrentSourceInfo.mEndTimeUs);
}
@@ -3216,7 +3221,7 @@ NuPlayer2::SourceInfo::SourceInfo()
      mSrcId(0),
      mSourceFlags(0),
      mStartTimeUs(0),
      mEndTimeUs(INT64_MAX) {
      mEndTimeUs(DataSourceDesc::kMaxTimeUs) {
}

NuPlayer2::SourceInfo & NuPlayer2::SourceInfo::operator=(const NuPlayer2::SourceInfo &other) {