Improve bitstream dumping logic in VideoReceiveStream

Specifying relative path like "~" somehow doesn't work in some cases.
To pass an absolute path some parameter rewriting is required.
Also, as the stream gets recreated several times at the beginning of the
call, append the time to the filename to make them unique.

Bug: none
Change-Id: I1c914f9081adb4ac5c34584d96e542e8a863547b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/126700
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27101}
This commit is contained in:
Ilya Nikolaevskiy 2019-03-11 11:18:26 +01:00 committed by Commit Bot
parent 133b307c7d
commit c032109cda

View File

@ -338,11 +338,16 @@ void VideoReceiveStream::Start() {
std::string decoded_output_file =
field_trial::FindFullName("WebRTC-DecoderDataDumpDirectory");
// Because '/' can't be used inside a field trial parameter, we use ':'
// instead.
std::replace(decoded_output_file.begin(), decoded_output_file.end(), ':',
'/');
if (!decoded_output_file.empty()) {
char filename_buffer[256];
rtc::SimpleStringBuilder ssb(filename_buffer);
ssb << decoded_output_file << "/webrtc_receive_stream_"
<< this->config_.rtp.local_ssrc << ".ivf";
<< this->config_.rtp.remote_ssrc << "-" << rtc::TimeMicros()
<< ".ivf";
video_decoder = absl::make_unique<FrameDumpingDecoder>(
std::move(video_decoder), FileWrapper::OpenWriteOnly(ssb.str()));
}