Loading media/libmediatranscoding/aidl/android/media/TranscodingTestConfig.aidl +10 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ * {@hide} */ parcelable TranscodingTestConfig { /** * Whether to use SimulatedTranscoder for testing. Note that SimulatedTranscoder does not send * transcoding jobs to real MediaTranscoder. */ boolean useSimulatedTranscoder = false; /** * Passthrough mode used for testing. The transcoding service will assume the destination * path already contains the transcoding of the source file and return it to client directly. Loading @@ -29,9 +35,9 @@ parcelable TranscodingTestConfig { boolean passThroughMode = false; /** * Delay of processing the job in milliseconds. Used only for testing. This comebines with * passThroughMode are used to simulate the transcoding latency in transcoding without involvign * MediaTranscoder. * Time of processing the job in milliseconds. Service will return the job result at least after * processingTotalTimeMs from the time it starts to process the job. Note that if service uses * real MediaTranscoder to do transcoding, the time spent on transcoding may be more than that. */ int processingDelayMs = 0; int processingTotalTimeMs = 0; } services/mediatranscoding/SimulatedTranscoder.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,12 @@ void SimulatedTranscoder::setCallback(const std::shared_ptr<TranscoderCallbackIn } void SimulatedTranscoder::start(ClientIdType clientId, JobIdType jobId, const TranscodingRequestParcel& /*request*/) { const TranscodingRequestParcel& request) { if (request.testConfig.processingTotalTimeMs > 0) { mJobProcessingTimeMs = request.testConfig.processingTotalTimeMs; } ALOGV("%s: job {%d}: processingTime: %lld", __FUNCTION__, jobId, (long long)mJobProcessingTimeMs); queueEvent(Event::Start, clientId, jobId); } Loading Loading @@ -123,7 +128,7 @@ void SimulatedTranscoder::threadLoop() { lastRunningTime = std::chrono::system_clock::now(); lastRunningEvent = event; if (event.type == Event::Start) { remainingUs = std::chrono::microseconds(kJobDurationUs); remainingUs = std::chrono::milliseconds(mJobProcessingTimeMs); } } else if (running && (event.type == Event::Pause || event.type == Event::Stop)) { running = false; Loading services/mediatranscoding/SimulatedTranscoder.h +5 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ namespace android { * SimulatedTranscoder is currently used to instantiate MediaTranscodingService * on service side for testing, so that we could actually test the IPC calls of * MediaTranscodingService to expose issues that's observable only over IPC. * SimulatedTranscoder is used when useSimulatedTranscoder in TranscodingTestConfig * is set to true. * * SimulatedTranscoder simulates job execution by reporting finish after kJobDurationUs. * Job lifecycle events are reported via progress updates with special progress Loading Loading @@ -61,6 +63,9 @@ private: std::condition_variable mCondition; std::list<Event> mQueue GUARDED_BY(mLock); // Minimum time spent on transcode the video. This is used just for testing. int64_t mJobProcessingTimeMs = kJobDurationUs / 1000; static const char* toString(Event::Type type); void queueEvent(Event::Type type, ClientIdType clientId, JobIdType jobId); void threadLoop(); Loading Loading
media/libmediatranscoding/aidl/android/media/TranscodingTestConfig.aidl +10 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,12 @@ * {@hide} */ parcelable TranscodingTestConfig { /** * Whether to use SimulatedTranscoder for testing. Note that SimulatedTranscoder does not send * transcoding jobs to real MediaTranscoder. */ boolean useSimulatedTranscoder = false; /** * Passthrough mode used for testing. The transcoding service will assume the destination * path already contains the transcoding of the source file and return it to client directly. Loading @@ -29,9 +35,9 @@ parcelable TranscodingTestConfig { boolean passThroughMode = false; /** * Delay of processing the job in milliseconds. Used only for testing. This comebines with * passThroughMode are used to simulate the transcoding latency in transcoding without involvign * MediaTranscoder. * Time of processing the job in milliseconds. Service will return the job result at least after * processingTotalTimeMs from the time it starts to process the job. Note that if service uses * real MediaTranscoder to do transcoding, the time spent on transcoding may be more than that. */ int processingDelayMs = 0; int processingTotalTimeMs = 0; }
services/mediatranscoding/SimulatedTranscoder.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,12 @@ void SimulatedTranscoder::setCallback(const std::shared_ptr<TranscoderCallbackIn } void SimulatedTranscoder::start(ClientIdType clientId, JobIdType jobId, const TranscodingRequestParcel& /*request*/) { const TranscodingRequestParcel& request) { if (request.testConfig.processingTotalTimeMs > 0) { mJobProcessingTimeMs = request.testConfig.processingTotalTimeMs; } ALOGV("%s: job {%d}: processingTime: %lld", __FUNCTION__, jobId, (long long)mJobProcessingTimeMs); queueEvent(Event::Start, clientId, jobId); } Loading Loading @@ -123,7 +128,7 @@ void SimulatedTranscoder::threadLoop() { lastRunningTime = std::chrono::system_clock::now(); lastRunningEvent = event; if (event.type == Event::Start) { remainingUs = std::chrono::microseconds(kJobDurationUs); remainingUs = std::chrono::milliseconds(mJobProcessingTimeMs); } } else if (running && (event.type == Event::Pause || event.type == Event::Stop)) { running = false; Loading
services/mediatranscoding/SimulatedTranscoder.h +5 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ namespace android { * SimulatedTranscoder is currently used to instantiate MediaTranscodingService * on service side for testing, so that we could actually test the IPC calls of * MediaTranscodingService to expose issues that's observable only over IPC. * SimulatedTranscoder is used when useSimulatedTranscoder in TranscodingTestConfig * is set to true. * * SimulatedTranscoder simulates job execution by reporting finish after kJobDurationUs. * Job lifecycle events are reported via progress updates with special progress Loading Loading @@ -61,6 +63,9 @@ private: std::condition_variable mCondition; std::list<Event> mQueue GUARDED_BY(mLock); // Minimum time spent on transcode the video. This is used just for testing. int64_t mJobProcessingTimeMs = kJobDurationUs / 1000; static const char* toString(Event::Type type); void queueEvent(Event::Type type, ClientIdType clientId, JobIdType jobId); void threadLoop(); Loading