transcoding: separate pause&stop on transcoder<->scheduler interface

Separate stop from pause, and use stop when a job is being cancelled.
This tells the transcoder to discard the job and all states for it.
Also send the original request to the transcoder start.

bug: 154734285
bug: 145233472
test: unit tests
Change-Id: I112c08b909f3432dfd4b4803c0786a1ea01deea6
diff --git a/services/mediatranscoding/SimulatedTranscoder.cpp b/services/mediatranscoding/SimulatedTranscoder.cpp
index aa397d8..1b68d5c 100644
--- a/services/mediatranscoding/SimulatedTranscoder.cpp
+++ b/services/mediatranscoding/SimulatedTranscoder.cpp
@@ -47,7 +47,8 @@
     mCallback = cb;
 }
 
-void SimulatedTranscoder::start(ClientIdType clientId, JobIdType jobId) {
+void SimulatedTranscoder::start(ClientIdType clientId, JobIdType jobId,
+                                const TranscodingRequestParcel& /*request*/) {
     queueEvent(Event::Start, clientId, jobId);
 }
 
@@ -59,6 +60,10 @@
     queueEvent(Event::Resume, clientId, jobId);
 }
 
+void SimulatedTranscoder::stop(ClientIdType clientId, JobIdType jobId) {
+    queueEvent(Event::Stop, clientId, jobId);
+}
+
 void SimulatedTranscoder::queueEvent(Event::Type type, ClientIdType clientId, JobIdType jobId) {
     ALOGV("%s: job {%lld, %d}: %s", __FUNCTION__, (long long)clientId, jobId, toString(type));
 
@@ -120,12 +125,12 @@
                 if (event.type == Event::Start) {
                     remainingUs = std::chrono::microseconds(kJobDurationUs);
                 }
-            } else if (running && event.type == Event::Pause) {
+            } else if (running && (event.type == Event::Pause || event.type == Event::Stop)) {
                 running = false;
                 remainingUs -= (std::chrono::system_clock::now() - lastRunningTime);
             } else {
                 ALOGW("%s: discarding bad event: job {%lld, %d}: %s", __FUNCTION__,
-                        (long long)event.clientId, event.jobId, toString(event.type));
+                      (long long)event.clientId, event.jobId, toString(event.type));
                 continue;
             }