Access ImplementationName() from task queue.

Accessing this method from the test thread is illegal,
but doesn't always fail.

Bug: webrtc:8524
Change-Id: Ie0e84cc2fb63268fb6d7cbf0c3a58cb35312c16b
Reviewed-on: https://webrtc-review.googlesource.com/49061
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21930}
This commit is contained in:
Rasmus Brandt
2018-02-07 11:49:02 +01:00
committed by Commit Bot
parent 1e06289cdb
commit 17cdcbb57b
2 changed files with 17 additions and 9 deletions

View File

@ -180,7 +180,7 @@ void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify(
SetUpAndInitObjects(
&task_queue, static_cast<const int>(rate_profiles[0].target_kbps),
static_cast<const int>(rate_profiles[0].input_fps), visualization_params);
PrintSettings();
PrintSettings(&task_queue);
ProcessAllFrames(&task_queue, rate_profiles);
@ -516,20 +516,28 @@ void VideoProcessorIntegrationTest::ReleaseAndCloseObjects(
}
}
void VideoProcessorIntegrationTest::PrintSettings() const {
void VideoProcessorIntegrationTest::PrintSettings(
rtc::TaskQueue* task_queue) const {
printf("VideoProcessor settings\n==\n");
printf(" Total # of frames : %d",
source_frame_reader_->NumberOfFrames());
printf("%s\n", config_.ToString().c_str());
printf("VideoProcessorIntegrationTest settings\n==\n");
const char* encoder_name = encoder_->ImplementationName();
printf(" Encoder implementation name: %s\n", encoder_name);
const char* decoder_name = decoders_.at(0)->ImplementationName();
printf(" Decoder implementation name: %s\n", decoder_name);
if (strcmp(encoder_name, decoder_name) == 0) {
std::string encoder_name;
std::string decoder_name;
rtc::Event sync_event(false, false);
task_queue->PostTask([this, &encoder_name, &decoder_name, &sync_event] {
encoder_name = encoder_->ImplementationName();
decoder_name = decoders_.at(0)->ImplementationName();
sync_event.Set();
});
sync_event.Wait(rtc::Event::kForever);
printf(" Encoder implementation name: %s\n", encoder_name.c_str());
printf(" Decoder implementation name: %s\n", decoder_name.c_str());
if (encoder_name == decoder_name) {
printf(" Codec implementation name : %s_%s\n", config_.CodecName().c_str(),
encoder_name);
encoder_name.c_str());
}
printf("\n");
}

View File

@ -130,7 +130,7 @@ class VideoProcessorIntegrationTest : public testing::Test {
const BitstreamThresholds* bs_thresholds);
void PrintFrameLevelStats(const std::vector<FrameStatistic>& stats) const;
void PrintSettings() const;
void PrintSettings(rtc::TaskQueue* task_queue) const;
// Codecs.
std::unique_ptr<VideoEncoder> encoder_;