Skip to content
Snippets Groups Projects
Commit 478155af authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Steve Lhomme
Browse files

test: record: remove file when it exists

We need to remove the file after the test, in particular because that's
what `make distcheck` will expect, and it will error out if the file is
left at the test location.

However, the current design of the recording feature doesn't guarantee
that the file will exist as soon as the recording event is signaled, or
even that it will even exist after the media player and libvlc instance
are released, if no track data has been pushed to the pipeline.
parent 0c8d3173
No related branches found
No related tags found
Loading
Pipeline #356370 passed with stage
in 13 minutes and 53 seconds
......@@ -56,6 +56,7 @@ static void test_media_player_record(const char** argv, int argc)
libvlc_media_player_play (mp);
const char path[] = "./";
char *filepath;
libvlc_media_player_record(mp, true, path);
......@@ -72,12 +73,23 @@ static void test_media_player_record(const char** argv, int argc)
const struct libvlc_event_t *ev = event_ctx_wait_event(&ctx);
assert(!ev->u.media_player_record_changed.recording);
assert(ev->u.media_player_record_changed.recorded_file_path != NULL);
filepath = strdup(ev->u.media_player_record_changed.recorded_file_path);
assert(filepath != NULL);
event_ctx_release(&ctx);
}
libvlc_media_player_stop_async (mp);
libvlc_media_player_release (mp);
libvlc_release (vlc);
res = unlink(filepath);
/** TODO:
* We should check assert(res == 0);, but the record is currently
* creating a stream output pipeline instance for recording with
* a specific mux after the end of the Open() of the recording
* module, with a file{no-overwrite} option. It means that the
* file might not exist yet. */
free(filepath);
}
int main(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment