mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1678352
- Upload a wav file when the test fails, for diagnosis. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D102218
This commit is contained in:
parent
4f508aaf21
commit
f25de5aaff
@ -29,6 +29,7 @@ class WavDumper {
|
||||
fclose(mFile);
|
||||
}
|
||||
}
|
||||
|
||||
void Open(const char* aBaseName, uint32_t aChannels, uint32_t aRate) {
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/SpinEventLoopUntil.h"
|
||||
#include "WaitFor.h"
|
||||
#include "WavDumper.h"
|
||||
|
||||
#define DRIFT_BUFFERING_PREF "media.clockdrift.buffering"
|
||||
|
||||
@ -534,6 +535,8 @@ TEST(TestAudioTrackGraph, AudioInputTrackDisabling)
|
||||
EXPECT_TRUE(stream->mHasInput);
|
||||
Unused << WaitFor(p);
|
||||
|
||||
stream->SetOutputRecordingEnabled(true);
|
||||
|
||||
// Wait for a second worth of audio data. GoFaster is dispatched through a
|
||||
// ControlMessage so that it is called in the first audio driver iteration.
|
||||
// Otherwise the audio driver might be going very fast while the fallback
|
||||
@ -591,6 +594,19 @@ TEST(TestAudioTrackGraph, AudioInputTrackDisabling)
|
||||
Tie(preSilenceSamples, estimatedFreq, nrDiscontinuities) =
|
||||
WaitFor(stream->OutputVerificationEvent());
|
||||
|
||||
const char* dir = getenv("MOZ_UPLOAD_DIR");
|
||||
if (dir && nrDiscontinuities != ITERATION_COUNT) {
|
||||
WavDumper dumper;
|
||||
char uploadPath[256];
|
||||
SprintfLiteral(
|
||||
uploadPath, "%s/%s.wav", dir,
|
||||
::testing::UnitTest::GetInstance()->current_test_info()->name());
|
||||
printf("Writing debug WAV to %s\n", uploadPath);
|
||||
dumper.OpenExplicit(uploadPath, 1, graph->GraphRate());
|
||||
auto data = stream->TakeRecordedOutput();
|
||||
dumper.Write(data.Elements(), data.Length());
|
||||
}
|
||||
|
||||
// We're enabling/disabling the track ITERATION_COUNT times, so we expect the
|
||||
// same number of discontinuities.
|
||||
std::cerr << "nrDiscontinuities" << nrDiscontinuities << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user