Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1031)

Unified Diff: media/cast/test/cast_benchmarks.cc

Issue 2048033003: Refactoring: CastTransport InitializeAudio/InitializeVideo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/test/cast_benchmarks.cc
diff --git a/media/cast/test/cast_benchmarks.cc b/media/cast/test/cast_benchmarks.cc
index 018b287c25f91b7bf2cfa1c5084397bb1271d6bb..580358c80635f9570ff30f4aa989b443d9401df9 100644
--- a/media/cast/test/cast_benchmarks.cc
+++ b/media/cast/test/cast_benchmarks.cc
@@ -97,16 +97,13 @@ class CastTransportWrapper : public CastTransport {
encoded_audio_bytes_ = encoded_audio_bytes;
}
- void InitializeAudio(const CastTransportRtpConfig& config,
- std::unique_ptr<RtcpObserver> rtcp_observer) final {
- audio_ssrc_ = config.ssrc;
- transport_->InitializeAudio(config, std::move(rtcp_observer));
- }
-
- void InitializeVideo(const CastTransportRtpConfig& config,
- std::unique_ptr<RtcpObserver> rtcp_observer) final {
- video_ssrc_ = config.ssrc;
- transport_->InitializeVideo(config, std::move(rtcp_observer));
+ void InitializeStream(const CastTransportRtpConfig& config,
+ std::unique_ptr<RtcpObserver> rtcp_observer) final {
+ if (config.rtp_payload_type <= RtpPayloadType::AUDIO_LAST)
+ audio_ssrc_ = config.ssrc;
+ else
+ video_ssrc_ = config.ssrc;
+ transport_->InitializeStream(config, std::move(rtcp_observer));
}
void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final {
@@ -456,9 +453,7 @@ class TransportClient : public CastTransport::Client {
: run_one_benchmark_(run_one_benchmark) {}
void OnStatusChanged(CastTransportStatus status) final {
- bool result = (status == TRANSPORT_AUDIO_INITIALIZED ||
- status == TRANSPORT_VIDEO_INITIALIZED);
- EXPECT_TRUE(result);
+ EXPECT_EQ(TRANSPORT_STREAM_INITIALIZED, status);
};
void OnLoggingEventsReceived(
std::unique_ptr<std::vector<FrameEvent>> frame_events,
@@ -481,14 +476,14 @@ void RunOneBenchmark::Create(const MeasuringPoint& p) {
transport_sender_.Init(
new CastTransportImpl(
testing_clock_sender_, base::TimeDelta::FromSeconds(1),
- base::WrapUnique(new TransportClient(nullptr)),
+ base::MakeUnique<TransportClient>(nullptr),
base::WrapUnique(sender_to_receiver_), task_runner_sender_),
&video_bytes_encoded_, &audio_bytes_encoded_);
receiver_to_sender_ = new LoopBackTransport(cast_environment_receiver_);
transport_receiver_.reset(new CastTransportImpl(
testing_clock_receiver_, base::TimeDelta::FromSeconds(1),
- base::WrapUnique(new TransportClient(this)),
+ base::MakeUnique<TransportClient>(this),
base::WrapUnique(receiver_to_sender_), task_runner_receiver_));
cast_receiver_ =
« no previous file with comments | « media/cast/sender/video_sender_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698