Backed out 2 changesets (bug 1552607) for causing checkstyle failures. CLOSED TREE

Backed out changeset 53a39e402451 (bug 1552607)
Backed out changeset 6385b8616d54 (bug 1552607)
This commit is contained in:
Mihai Alexandru Michis 2019-07-02 04:19:01 +03:00
parent 01bd4dbcc7
commit 74781bb639
6 changed files with 14 additions and 38 deletions

View file

@ -437,7 +437,7 @@ class RemoteAudioDecoder : public RemoteDataDecoder {
return mFirstDemuxedSampleTime->ToMicroseconds() > aTime;
}
bool ShouldDiscardSample(int64_t aSession) const {
bool ShouldDiscardSample() const {
AssertOnTaskQueue();
// HandleOutput() runs on Android binder thread pool and could be preempted
// by RemoteDateDecoder task queue. That means ProcessOutput() could be
@ -445,8 +445,7 @@ class RemoteAudioDecoder : public RemoteDataDecoder {
// sample which is returned after calling Shutdown() and Flush(). We can
// check mFirstDemuxedSampleTime to know whether the Flush() has been
// called, becasue it would be reset in Flush().
return GetState() == State::SHUTDOWN || !mFirstDemuxedSampleTime ||
mSession != aSession;
return GetState() == State::SHUTDOWN || !mFirstDemuxedSampleTime;
}
// Param and LocalRef are only valid for the duration of a JNI method call.
@ -467,7 +466,7 @@ class RemoteAudioDecoder : public RemoteDataDecoder {
AssertOnTaskQueue();
if (ShouldDiscardSample(aSample->Session()) || !aBuffer->IsValid()) {
if (ShouldDiscardSample() || !aBuffer->IsValid()) {
aSample->Dispose();
return;
}
@ -591,7 +590,6 @@ RemoteDataDecoder::RemoteDataDecoder(MediaData::Type aType,
mFormat(aFormat),
mDrmStubId(aDrmStubId),
mTaskQueue(aTaskQueue),
mSession(0),
mNumPendingInputs(0) {}
RefPtr<MediaDataDecoder::FlushPromise> RemoteDataDecoder::Flush() {
@ -608,7 +606,6 @@ RefPtr<MediaDataDecoder::FlushPromise> RemoteDataDecoder::ProcessFlush() {
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
SetState(State::DRAINED);
mSession++;
mJavaDecoder->Flush();
return FlushPromise::CreateAndResolve(true, __func__);
}
@ -636,7 +633,7 @@ RefPtr<MediaDataDecoder::DecodePromise> RemoteDataDecoder::Drain() {
SetState(State::DRAINING);
self->mInputBufferInfo->Set(0, 0, -1,
MediaCodec::BUFFER_FLAG_END_OF_STREAM);
mJavaDecoder->Input(nullptr, self->mInputBufferInfo, nullptr, mSession);
mJavaDecoder->Input(nullptr, self->mInputBufferInfo, nullptr);
return p;
});
}
@ -743,7 +740,7 @@ RefPtr<MediaDataDecoder::DecodePromise> RemoteDataDecoder::ProcessDecode(
SetState(State::DRAINABLE);
mInputBufferInfo->Set(0, aSample->Size(), aSample->mTime.ToMicroseconds(), 0);
return mJavaDecoder->Input(bytes, mInputBufferInfo,
GetCryptoInfoFromSample(aSample), mSession)
GetCryptoInfoFromSample(aSample))
? mDecodePromise.Ensure(__func__)
: DecodePromise::CreateAndReject(
MediaResult(NS_ERROR_OUT_OF_MEMORY, __func__), __func__);
@ -831,7 +828,6 @@ void RemoteDataDecoder::DrainComplete() {
}
SetState(State::DRAINED);
ReturnDecodedData();
mSession++;
// Make decoder accept input again.
mJavaDecoder->Flush();
}

View file

@ -82,10 +82,6 @@ class RemoteDataDecoder : public MediaDataDecoder,
// information. Contents must be changed only on mTaskQueue.
java::sdk::BufferInfo::GlobalRef mInputBufferInfo;
// Session ID attached to samples. It's increased every time
// CodecProxy::Flush() is called. Accessed on mTaskqueue only.
int64_t mSession;
private:
enum class PendingOp { INCREASE, DECREASE, CLEAR };
void UpdatePendingInputStatus(PendingOp aOp);

View file

@ -1113,7 +1113,7 @@ int32_t WebrtcMediaCodecVP8VideoRemoteEncoder::Encode(
bufferInfo->Set(0, size, inputImage.render_time_ms() * PR_USEC_PER_MSEC, 0);
}
mJavaEncoder->Input(bytes, bufferInfo, nullptr, 0);
mJavaEncoder->Input(bytes, bufferInfo, nullptr);
return WEBRTC_VIDEO_CODEC_OK;
}

View file

@ -69,7 +69,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
private Queue<Sample> mDequeuedSamples = new LinkedList<>();
private Queue<Input> mInputSamples = new LinkedList<>();
private boolean mStopped;
private long mSession;
private synchronized Sample onAllocate(final int size) {
Sample sample = mSamplePool.obtainInput(size);
@ -90,12 +89,10 @@ import org.mozilla.gecko.gfx.GeckoSurface;
return;
}
if (sample.session >= mSession) {
Sample dequeued = mDequeuedSamples.remove();
dequeued.setBufferInfo(sample.info);
dequeued.setCryptoInfo(sample.cryptoInfo);
queueSample(dequeued);
}
Sample dequeued = mDequeuedSamples.remove();
dequeued.setBufferInfo(sample.info);
dequeued.setCryptoInfo(sample.cryptoInfo);
queueSample(dequeued);
sample.dispose();
}
@ -148,9 +145,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
private void feedSampleToBuffer() {
while (!mAvailableInputBuffers.isEmpty() && !mInputSamples.isEmpty()) {
int index = mAvailableInputBuffers.poll();
if (!isValidBuffer(index)) {
continue;
}
int len = 0;
final Sample sample = mInputSamples.poll().sample;
long pts = sample.info.presentationTimeUs;
@ -213,7 +207,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
mDequeuedSamples.clear();
mAvailableInputBuffers.clear();
mSession++;
}
private synchronized void start() {
@ -247,7 +240,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
private boolean mHasOutputCapacitySet;
private Queue<Output> mSentOutputs = new LinkedList<>();
private boolean mStopped;
private long mSession;
private OutputProcessor(final boolean renderToSurface) {
mRenderToSurface = renderToSurface;
@ -261,7 +253,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
try {
Sample output = obtainOutputSample(index, info);
mSentOutputs.add(new Output(output, index));
output.session = mSession;
mCallbacks.onOutput(output);
} catch (Exception e) {
e.printStackTrace();
@ -341,7 +332,6 @@ import org.mozilla.gecko.gfx.GeckoSurface;
mSamplePool.recycleOutput(o.sample);
}
mSentOutputs.clear();
mSession++;
}
private synchronized void start() {

View file

@ -224,7 +224,7 @@ public final class CodecProxy {
@WrapForJNI
public synchronized boolean input(final ByteBuffer bytes, final BufferInfo info,
final CryptoInfo cryptoInfo, final long session) {
final CryptoInfo cryptoInfo) {
if (mRemote == null) {
Log.e(LOGTAG, "cannot send input to an ended codec");
return false;
@ -239,7 +239,7 @@ public final class CodecProxy {
try {
Sample s = mRemote.dequeueInput(info.size);
fillInputBuffer(s.bufferId, bytes, info.offset, info.size);
return sendInput(s.set(info, cryptoInfo, session));
return sendInput(s.set(info, cryptoInfo));
} catch (RemoteException | NullPointerException e) {
Log.e(LOGTAG, "fail to dequeue input buffer", e);
} catch (IOException e) {

View file

@ -22,8 +22,6 @@ public final class Sample implements Parcelable {
EOS = new Sample();
EOS.info.set(0, 0, Long.MIN_VALUE, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
}
@WrapForJNI
public long session;
public static final int NO_BUFFER = -1;
@ -73,10 +71,9 @@ public final class Sample implements Parcelable {
mode);
}
public Sample set(final BufferInfo info, final CryptoInfo cryptoInfo, long session) {
public Sample set(final BufferInfo info, final CryptoInfo cryptoInfo) {
setBufferInfo(info);
setCryptoInfo(cryptoInfo);
this.session = session;
return this;
}
@ -147,7 +144,6 @@ public final class Sample implements Parcelable {
} else {
s = new Sample();
}
s.session = in.readLong();
s.bufferId = in.readInt();
s.readInfo(in);
s.readCrypto(in);
@ -162,7 +158,6 @@ public final class Sample implements Parcelable {
@Override
public void writeToParcel(final Parcel dest, final int parcelableFlags) {
dest.writeLong(session);
dest.writeInt(bufferId);
writeInfo(dest);
writeCrypto(dest);
@ -211,8 +206,7 @@ public final class Sample implements Parcelable {
}
StringBuilder str = new StringBuilder();
str.append("{ session#:").append(session).
append(", buffer#").append(bufferId).
str.append("{ buffer#").append(bufferId).
append(", info=").
append("{ offset=").append(info.offset).
append(", size=").append(info.size).