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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2745083002: Avoid holding lock while calling stream_resetter_ in MaxPaddingSetTest (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> // max 10 #include <algorithm> // max
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 static const uint32_t kMinPacketsToSend = 50; 1528 static const uint32_t kMinPacketsToSend = 50;
1529 1529
1530 explicit MaxPaddingSetTest(bool test_switch_content_type, T* stream_reset_fun) 1530 explicit MaxPaddingSetTest(bool test_switch_content_type, T* stream_reset_fun)
1531 : SendTest(test::CallTest::kDefaultTimeoutMs), 1531 : SendTest(test::CallTest::kDefaultTimeoutMs),
1532 content_switch_event_(false, false), 1532 content_switch_event_(false, false),
1533 call_(nullptr), 1533 call_(nullptr),
1534 send_stream_(nullptr), 1534 send_stream_(nullptr),
1535 send_stream_config_(nullptr), 1535 send_stream_config_(nullptr),
1536 packets_sent_(0), 1536 packets_sent_(0),
1537 running_without_padding_(test_switch_content_type), 1537 running_without_padding_(test_switch_content_type),
1538 stream_resetter_(stream_reset_fun) {} 1538 stream_resetter_(stream_reset_fun) {
1539 RTC_DCHECK(stream_resetter_);
1540 }
1539 1541
1540 void OnVideoStreamsCreated( 1542 void OnVideoStreamsCreated(
1541 VideoSendStream* send_stream, 1543 VideoSendStream* send_stream,
1542 const std::vector<VideoReceiveStream*>& receive_streams) override { 1544 const std::vector<VideoReceiveStream*>& receive_streams) override {
1543 rtc::CritScope lock(&crit_); 1545 rtc::CritScope lock(&crit_);
1544 send_stream_ = send_stream; 1546 send_stream_ = send_stream;
1545 } 1547 }
1546 1548
1547 void ModifyVideoConfigs( 1549 void ModifyVideoConfigs(
1548 VideoSendStream::Config* send_config, 1550 VideoSendStream::Config* send_config,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 if (call_->GetStats().max_padding_bitrate_bps > 0) 1593 if (call_->GetStats().max_padding_bitrate_bps > 0)
1592 observation_complete_.Set(); 1594 observation_complete_.Set();
1593 1595
1594 return SEND_PACKET; 1596 return SEND_PACKET;
1595 } 1597 }
1596 1598
1597 void PerformTest() override { 1599 void PerformTest() override {
1598 if (RunningWithoutPadding()) { 1600 if (RunningWithoutPadding()) {
1599 ASSERT_TRUE( 1601 ASSERT_TRUE(
1600 content_switch_event_.Wait(test::CallTest::kDefaultTimeoutMs)); 1602 content_switch_event_.Wait(test::CallTest::kDefaultTimeoutMs));
1601 rtc::CritScope lock(&crit_);
1602 RTC_DCHECK(stream_resetter_);
1603 (*stream_resetter_)(send_stream_config_, encoder_config_); 1603 (*stream_resetter_)(send_stream_config_, encoder_config_);
1604 } 1604 }
1605 1605
1606 ASSERT_TRUE(Wait()) << "Timed out waiting for a valid padding bitrate."; 1606 ASSERT_TRUE(Wait()) << "Timed out waiting for a valid padding bitrate.";
1607 } 1607 }
1608 1608
1609 private: 1609 private:
1610 bool RunningWithoutPadding() const { 1610 bool RunningWithoutPadding() const {
1611 rtc::CritScope lock(&crit_); 1611 rtc::CritScope lock(&crit_);
1612 return running_without_padding_; 1612 return running_without_padding_;
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 rtc::CriticalSection crit_; 3284 rtc::CriticalSection crit_;
3285 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); 3285 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_);
3286 bool first_packet_sent_ GUARDED_BY(&crit_); 3286 bool first_packet_sent_ GUARDED_BY(&crit_);
3287 rtc::Event bitrate_changed_event_; 3287 rtc::Event bitrate_changed_event_;
3288 } test; 3288 } test;
3289 3289
3290 RunBaseTest(&test); 3290 RunBaseTest(&test);
3291 } 3291 }
3292 3292
3293 } // namespace webrtc 3293 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698