summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-12 23:46:27 +0000
committerimcheng@chromium.org <imcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-12 23:46:27 +0000
commit728324d1b0db65109077f64ac582d2022bf0cb52 (patch)
tree8c3f05ca385e637fb4b5c7bdedc9dd1c260a6f8e /media
parenta6ea07820ed6abd5a12e95c2a041f9ec37d54a01 (diff)
downloadchromium_src-728324d1b0db65109077f64ac582d2022bf0cb52.zip
chromium_src-728324d1b0db65109077f64ac582d2022bf0cb52.tar.gz
chromium_src-728324d1b0db65109077f64ac582d2022bf0cb52.tar.bz2
Cast: Added missing DCHECKs to ThreadChecker calls and minor cleanup.
Also included in this CL are: - Removed task_runner in constructor of RawEventSubscriber impls - Minor fixes in unittests Review URL: https://codereview.chromium.org/145873007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/cast/audio_receiver/audio_receiver.cc2
-rw-r--r--media/cast/logging/logging_impl_unittest.cc23
-rw-r--r--media/cast/logging/logging_raw_unittest.cc11
-rw-r--r--media/cast/logging/simple_event_subscriber.cc19
-rw-r--r--media/cast/logging/simple_event_subscriber.h10
-rw-r--r--media/cast/logging/simple_event_subscriber_unittest.cc3
-rw-r--r--media/cast/rtcp/receiver_rtcp_event_subscriber.cc15
-rw-r--r--media/cast/rtcp/receiver_rtcp_event_subscriber.h8
-rw-r--r--media/cast/rtcp/receiver_rtcp_event_subscriber_unittest.cc4
-rw-r--r--media/cast/rtcp/sender_rtcp_event_subscriber.cc15
-rw-r--r--media/cast/rtcp/sender_rtcp_event_subscriber.h13
-rw-r--r--media/cast/rtcp/sender_rtcp_event_subscriber_unittest.cc23
-rw-r--r--media/cast/test/end2end_unittest.cc3
-rw-r--r--media/cast/video_receiver/video_receiver.cc2
-rw-r--r--media/cast/video_sender/video_sender.cc5
15 files changed, 52 insertions, 104 deletions
diff --git a/media/cast/audio_receiver/audio_receiver.cc b/media/cast/audio_receiver/audio_receiver.cc
index 30ce561..71c2095 100644
--- a/media/cast/audio_receiver/audio_receiver.cc
+++ b/media/cast/audio_receiver/audio_receiver.cc
@@ -95,8 +95,6 @@ AudioReceiver::AudioReceiver(scoped_refptr<CastEnvironment> cast_environment,
transport::PacedPacketSender* const packet_sender)
: cast_environment_(cast_environment),
event_subscriber_(
- cast_environment->GetMessageSingleThreadTaskRunnerForThread(
- CastEnvironment::MAIN),
kMaxEventSubscriberEntries,
ReceiverRtcpEventSubscriber::kAudioEventSubscriber),
codec_(audio_config.codec),
diff --git a/media/cast/logging/logging_impl_unittest.cc b/media/cast/logging/logging_impl_unittest.cc
index b3ad6fb..190a6b4 100644
--- a/media/cast/logging/logging_impl_unittest.cc
+++ b/media/cast/logging/logging_impl_unittest.cc
@@ -36,19 +36,18 @@ class LoggingImplTest : public ::testing::Test {
base::TimeDelta::FromMilliseconds(kStartMillisecond));
task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_);
logging_.reset(new LoggingImpl(task_runner_, config_));
- event_subscriber_.reset(new SimpleEventSubscriber(task_runner_));
- logging_->AddRawEventSubscriber(event_subscriber_.get());
+ logging_->AddRawEventSubscriber(&event_subscriber_);
}
virtual ~LoggingImplTest() {
- logging_->RemoveRawEventSubscriber(event_subscriber_.get());
+ logging_->RemoveRawEventSubscriber(&event_subscriber_);
}
CastLoggingConfig config_;
scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
scoped_ptr<LoggingImpl> logging_;
base::SimpleTestTickClock testing_clock_;
- scoped_ptr<SimpleEventSubscriber> event_subscriber_;
+ SimpleEventSubscriber event_subscriber_;
DISALLOW_COPY_AND_ASSIGN(LoggingImplTest);
};
@@ -73,7 +72,7 @@ TEST_F(LoggingImplTest, BasicFrameLogging) {
// Get logging data.
std::vector<FrameEvent> frame_events;
- event_subscriber_->GetFrameEventsAndReset(&frame_events);
+ event_subscriber_.GetFrameEventsAndReset(&frame_events);
// Size of vector should be equal to the number of events logged,
// which equals to number of frames in this case.
EXPECT_EQ(frame_id, frame_events.size());
@@ -115,7 +114,7 @@ TEST_F(LoggingImplTest, FrameLoggingWithSize) {
} while (time_interval.InSeconds() < kIntervalTime1S);
// Get logging data.
std::vector<FrameEvent> frame_events;
- event_subscriber_->GetFrameEventsAndReset(&frame_events);
+ event_subscriber_.GetFrameEventsAndReset(&frame_events);
// Size of vector should be equal to the number of events logged, which
// equals to number of frames in this case.
EXPECT_EQ(frame_id, frame_events.size());
@@ -152,7 +151,7 @@ TEST_F(LoggingImplTest, FrameLoggingWithDelay) {
} while (time_interval.InSeconds() < kIntervalTime1S);
// Get logging data.
std::vector<FrameEvent> frame_events;
- event_subscriber_->GetFrameEventsAndReset(&frame_events);
+ event_subscriber_.GetFrameEventsAndReset(&frame_events);
// Size of vector should be equal to the number of frames logged.
EXPECT_EQ(frame_id, frame_events.size());
// Verify stats.
@@ -198,7 +197,7 @@ TEST_F(LoggingImplTest, MultipleEventFrameLogging) {
} while (time_interval.InSeconds() < kIntervalTime1S);
// Get logging data.
std::vector<FrameEvent> frame_events;
- event_subscriber_->GetFrameEventsAndReset(&frame_events);
+ event_subscriber_.GetFrameEventsAndReset(&frame_events);
// Size of vector should be equal to the number of frames logged.
EXPECT_EQ(num_events, frame_events.size());
// Multiple events captured per frame.
@@ -226,7 +225,7 @@ TEST_F(LoggingImplTest, PacketLogging) {
} while (time_interval.InSeconds() < kIntervalTime1S);
// Get logging data.
std::vector<PacketEvent> packet_events;
- event_subscriber_->GetPacketEventsAndReset(&packet_events);
+ event_subscriber_.GetPacketEventsAndReset(&packet_events);
// Size of vector should be equal to the number of packets logged.
EXPECT_EQ(frame_id * kNumPacketsPerFrame, packet_events.size());
// Verify stats.
@@ -287,7 +286,7 @@ TEST_F(LoggingImplTest, GenericLogging) {
// Size of generic event vector = number of generic events logged.
std::vector<GenericEvent> generic_events;
- event_subscriber_->GetGenericEventsAndReset(&generic_events);
+ event_subscriber_.GetGenericEventsAndReset(&generic_events);
EXPECT_EQ(num_events, generic_events.size());
// Verify each type of event has expected number of events logged.
@@ -326,7 +325,7 @@ TEST_F(LoggingImplTest, GenericLogging) {
}
TEST_F(LoggingImplTest, MultipleRawEventSubscribers) {
- SimpleEventSubscriber event_subscriber_2(task_runner_);
+ SimpleEventSubscriber event_subscriber_2;
// Now logging_ has two subscribers.
logging_->AddRawEventSubscriber(&event_subscriber_2);
@@ -336,7 +335,7 @@ TEST_F(LoggingImplTest, MultipleRawEventSubscribers) {
/*frame_id*/ 0u);
std::vector<FrameEvent> frame_events;
- event_subscriber_->GetFrameEventsAndReset(&frame_events);
+ event_subscriber_.GetFrameEventsAndReset(&frame_events);
EXPECT_EQ(1u, frame_events.size());
frame_events.clear();
event_subscriber_2.GetFrameEventsAndReset(&frame_events);
diff --git a/media/cast/logging/logging_raw_unittest.cc b/media/cast/logging/logging_raw_unittest.cc
index 4446070..135aed5e 100644
--- a/media/cast/logging/logging_raw_unittest.cc
+++ b/media/cast/logging/logging_raw_unittest.cc
@@ -2,12 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/scoped_ptr.h"
-#include "base/test/simple_test_tick_clock.h"
#include "media/cast/logging/logging_defines.h"
#include "media/cast/logging/logging_raw.h"
#include "media/cast/logging/simple_event_subscriber.h"
-#include "media/cast/test/fake_single_thread_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
@@ -15,17 +12,13 @@ namespace cast {
class LoggingRawTest : public ::testing::Test {
protected:
- LoggingRawTest()
- : task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)),
- event_subscriber_(task_runner_) {
+ LoggingRawTest() {
raw_.AddSubscriber(&event_subscriber_);
}
virtual ~LoggingRawTest() { raw_.RemoveSubscriber(&event_subscriber_); }
LoggingRaw raw_;
- base::SimpleTestTickClock testing_clock_;
- scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
SimpleEventSubscriber event_subscriber_;
std::vector<FrameEvent> frame_events_;
std::vector<PacketEvent> packet_events_;
@@ -153,7 +146,7 @@ TEST_F(LoggingRawTest, GenericEvent) {
}
TEST_F(LoggingRawTest, MultipleSubscribers) {
- SimpleEventSubscriber event_subscriber_2(task_runner_);
+ SimpleEventSubscriber event_subscriber_2;
// Now raw_ has two subscribers.
raw_.AddSubscriber(&event_subscriber_2);
diff --git a/media/cast/logging/simple_event_subscriber.cc b/media/cast/logging/simple_event_subscriber.cc
index f0b2250..78f932d 100644
--- a/media/cast/logging/simple_event_subscriber.cc
+++ b/media/cast/logging/simple_event_subscriber.cc
@@ -7,53 +7,50 @@
#include <vector>
#include "base/logging.h"
-#include "base/single_thread_task_runner.h"
namespace media {
namespace cast {
-SimpleEventSubscriber::SimpleEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy) {
- DCHECK(main_thread_proxy->RunsTasksOnCurrentThread());
-}
+SimpleEventSubscriber::SimpleEventSubscriber() {}
SimpleEventSubscriber::~SimpleEventSubscriber() {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void SimpleEventSubscriber::OnReceiveFrameEvent(const FrameEvent& frame_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
frame_events_.push_back(frame_event);
}
void SimpleEventSubscriber::OnReceivePacketEvent(
const PacketEvent& packet_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
packet_events_.push_back(packet_event);
}
void SimpleEventSubscriber::OnReceiveGenericEvent(
const GenericEvent& generic_event) {
+ DCHECK(thread_checker_.CalledOnValidThread());
generic_events_.push_back(generic_event);
}
void SimpleEventSubscriber::GetFrameEventsAndReset(
std::vector<FrameEvent>* frame_events) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
frame_events->swap(frame_events_);
frame_events_.clear();
}
void SimpleEventSubscriber::GetPacketEventsAndReset(
std::vector<PacketEvent>* packet_events) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
packet_events->swap(packet_events_);
packet_events_.clear();
}
void SimpleEventSubscriber::GetGenericEventsAndReset(
std::vector<GenericEvent>* generic_events) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
generic_events->swap(generic_events_);
generic_events_.clear();
}
diff --git a/media/cast/logging/simple_event_subscriber.h b/media/cast/logging/simple_event_subscriber.h
index b8f0b49..3cf890a 100644
--- a/media/cast/logging/simple_event_subscriber.h
+++ b/media/cast/logging/simple_event_subscriber.h
@@ -7,8 +7,6 @@
#include <vector>
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "media/cast/logging/raw_event_subscriber.h"
@@ -21,17 +19,13 @@ namespace cast {
// list of events that have acccumulated since last inovcation.
class SimpleEventSubscriber : public RawEventSubscriber {
public:
- // |main_thread_proxy|: Only used for ensuring the subscriber is only called
- // on the main thread. This object does not keep a reference on it.
- explicit SimpleEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy);
+ SimpleEventSubscriber();
virtual ~SimpleEventSubscriber();
+ // RawEventSubscriber implementations.
virtual void OnReceiveFrameEvent(const FrameEvent& frame_event) OVERRIDE;
-
virtual void OnReceivePacketEvent(const PacketEvent& packet_event) OVERRIDE;
-
virtual void OnReceiveGenericEvent(const GenericEvent& generic_event)
OVERRIDE;
diff --git a/media/cast/logging/simple_event_subscriber_unittest.cc b/media/cast/logging/simple_event_subscriber_unittest.cc
index 5a6b09d..ab03126 100644
--- a/media/cast/logging/simple_event_subscriber_unittest.cc
+++ b/media/cast/logging/simple_event_subscriber_unittest.cc
@@ -23,8 +23,7 @@ class SimpleEventSubscriberTest : public ::testing::Test {
cast_environment_(new CastEnvironment(
scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_,
task_runner_, task_runner_, task_runner_, task_runner_,
- task_runner_, GetLoggingConfigWithRawEventsAndStatsEnabled())),
- event_subscriber_(task_runner_) {
+ task_runner_, GetLoggingConfigWithRawEventsAndStatsEnabled())) {
cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
}
diff --git a/media/cast/rtcp/receiver_rtcp_event_subscriber.cc b/media/cast/rtcp/receiver_rtcp_event_subscriber.cc
index a5f963e..ac60d2d2 100644
--- a/media/cast/rtcp/receiver_rtcp_event_subscriber.cc
+++ b/media/cast/rtcp/receiver_rtcp_event_subscriber.cc
@@ -6,28 +6,23 @@
#include <utility>
-#include "base/single_thread_task_runner.h"
-#include "media/cast/cast_environment.h"
-
namespace media {
namespace cast {
ReceiverRtcpEventSubscriber::ReceiverRtcpEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy,
const size_t max_size_to_retain, Type type)
: max_size_to_retain_(max_size_to_retain), type_(type) {
- DCHECK(main_thread_proxy->RunsTasksOnCurrentThread());
DCHECK(max_size_to_retain_ > 0u);
DCHECK(type_ == kAudioEventSubscriber || type_ == kVideoEventSubscriber);
}
ReceiverRtcpEventSubscriber::~ReceiverRtcpEventSubscriber() {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void ReceiverRtcpEventSubscriber::OnReceiveFrameEvent(
const FrameEvent& frame_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
if (ShouldProcessEvent(frame_event.type)) {
RtcpEvent rtcp_event;
@@ -59,7 +54,7 @@ void ReceiverRtcpEventSubscriber::OnReceiveFrameEvent(
void ReceiverRtcpEventSubscriber::OnReceivePacketEvent(
const PacketEvent& packet_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
if (ShouldProcessEvent(packet_event.type)) {
RtcpEvent rtcp_event;
@@ -80,13 +75,13 @@ void ReceiverRtcpEventSubscriber::OnReceivePacketEvent(
void ReceiverRtcpEventSubscriber::OnReceiveGenericEvent(
const GenericEvent& generic_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
// Do nothing as RTP receiver is not interested in generic events for RTCP.
}
void ReceiverRtcpEventSubscriber::GetReceiverLogMessageAndReset(
RtcpReceiverLogMessage* receiver_log) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
receiver_log->clear();
diff --git a/media/cast/rtcp/receiver_rtcp_event_subscriber.h b/media/cast/rtcp/receiver_rtcp_event_subscriber.h
index caf0bc7..2200cdd 100644
--- a/media/cast/rtcp/receiver_rtcp_event_subscriber.h
+++ b/media/cast/rtcp/receiver_rtcp_event_subscriber.h
@@ -7,14 +7,12 @@
#include <map>
-#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
#include "media/cast/logging/logging_defines.h"
#include "media/cast/logging/raw_event_subscriber.h"
#include "media/cast/rtcp/rtcp_defines.h"
namespace base {
-
class SingleThreadTaskRunner;
}
@@ -39,17 +37,13 @@ class ReceiverRtcpEventSubscriber : public RawEventSubscriber {
kVideoEventSubscriber // Only processes video events
};
- // |main_thread_proxy|: Check that the object is created in main thread.
- // This object does not hold a reference on it.
// |max_size_to_retain|: The object will keep up to |max_size_to_retain|
// events
// in the map. Once threshold has been reached, an event with the smallest
// RTP timestamp will be removed.
// |type|: Determines whether the subscriber will process only audio or video
// events.
- ReceiverRtcpEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy,
- const size_t max_size_to_retain, Type type);
+ ReceiverRtcpEventSubscriber(const size_t max_size_to_retain, Type type);
virtual ~ReceiverRtcpEventSubscriber();
diff --git a/media/cast/rtcp/receiver_rtcp_event_subscriber_unittest.cc b/media/cast/rtcp/receiver_rtcp_event_subscriber_unittest.cc
index 8158f8d..a19c6a3 100644
--- a/media/cast/rtcp/receiver_rtcp_event_subscriber_unittest.cc
+++ b/media/cast/rtcp/receiver_rtcp_event_subscriber_unittest.cc
@@ -17,7 +17,7 @@ namespace cast {
namespace {
-const size_t kSizeThreshold = 10u;
+const size_t kMaxEventEntries = 10u;
const int64 kDelayMs = 20L;
} // namespace
@@ -43,7 +43,7 @@ class ReceiverRtcpEventSubscriberTest : public ::testing::Test {
void Init(ReceiverRtcpEventSubscriber::Type type) {
event_subscriber_.reset(
- new ReceiverRtcpEventSubscriber(task_runner_, kSizeThreshold, type));
+ new ReceiverRtcpEventSubscriber(kMaxEventEntries, type));
cast_environment_->Logging()->AddRawEventSubscriber(
event_subscriber_.get());
}
diff --git a/media/cast/rtcp/sender_rtcp_event_subscriber.cc b/media/cast/rtcp/sender_rtcp_event_subscriber.cc
index f16ff01..7b82f4a 100644
--- a/media/cast/rtcp/sender_rtcp_event_subscriber.cc
+++ b/media/cast/rtcp/sender_rtcp_event_subscriber.cc
@@ -6,28 +6,25 @@
#include <utility>
-#include "base/single_thread_task_runner.h"
-#include "media/cast/cast_environment.h"
+#include "base/logging.h"
#include "media/cast/rtcp/rtcp_defines.h"
namespace media {
namespace cast {
SenderRtcpEventSubscriber::SenderRtcpEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy,
const size_t max_size_to_retain)
: max_size_to_retain_(max_size_to_retain) {
- DCHECK(main_thread_proxy->RunsTasksOnCurrentThread());
DCHECK(max_size_to_retain_ > 0u);
}
SenderRtcpEventSubscriber::~SenderRtcpEventSubscriber() {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void SenderRtcpEventSubscriber::OnReceiveFrameEvent(
const FrameEvent& frame_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
if (frame_event.type != kVideoFrameCaptured &&
frame_event.type != kVideoFrameSentToEncoder &&
frame_event.type != kVideoFrameEncoded) {
@@ -68,19 +65,19 @@ void SenderRtcpEventSubscriber::OnReceiveFrameEvent(
void SenderRtcpEventSubscriber::OnReceivePacketEvent(
const PacketEvent& packet_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
// Do nothing as RTP sender is not interested in packet events for RTCP.
}
void SenderRtcpEventSubscriber::OnReceiveGenericEvent(
const GenericEvent& generic_event) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
// Do nothing as RTP sender is not interested in generic events for RTCP.
}
void SenderRtcpEventSubscriber::GetRtcpEventsAndReset(
RtcpEventMap* rtcp_events) {
- thread_checker_.CalledOnValidThread();
+ DCHECK(thread_checker_.CalledOnValidThread());
rtcp_events->swap(rtcp_events_);
rtcp_events_.clear();
}
diff --git a/media/cast/rtcp/sender_rtcp_event_subscriber.h b/media/cast/rtcp/sender_rtcp_event_subscriber.h
index fc57cbf..fdd36e3 100644
--- a/media/cast/rtcp/sender_rtcp_event_subscriber.h
+++ b/media/cast/rtcp/sender_rtcp_event_subscriber.h
@@ -7,17 +7,11 @@
#include <map>
-#include "base/memory/ref_counted.h"
#include "base/threading/thread_checker.h"
#include "media/cast/logging/logging_defines.h"
#include "media/cast/logging/raw_event_subscriber.h"
#include "media/cast/rtcp/rtcp_defines.h"
-namespace base {
-
-class SingleThreadTaskRunner;
-}
-
namespace media {
namespace cast {
@@ -37,15 +31,12 @@ typedef std::map<RtpTimestamp, RtcpEvent> RtcpEventMap;
// timestamp) up to the size limit.
class SenderRtcpEventSubscriber : public RawEventSubscriber {
public:
- // |main_thread_proxy|: Check that the object is created in main thread.
- // This object does not hold a reference on it.
// |max_size_to_retain|: The object will keep up to |max_size_to_retain|
// events
// in the map. Once threshold has been reached, an event with the smallest
// RTP timestamp will be removed.
- SenderRtcpEventSubscriber(
- const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_proxy,
- const size_t max_size_to_retain);
+ SenderRtcpEventSubscriber(const size_t max_size_to_retain);
+
virtual ~SenderRtcpEventSubscriber();
// RawEventSubscriber implementation.
diff --git a/media/cast/rtcp/sender_rtcp_event_subscriber_unittest.cc b/media/cast/rtcp/sender_rtcp_event_subscriber_unittest.cc
index a9a24a1..56897c2 100644
--- a/media/cast/rtcp/sender_rtcp_event_subscriber_unittest.cc
+++ b/media/cast/rtcp/sender_rtcp_event_subscriber_unittest.cc
@@ -17,7 +17,7 @@ namespace cast {
namespace {
-const size_t kSizeThreshold = 10u;
+const size_t kMaxEventEntries = 10u;
} // namespace
@@ -30,21 +30,18 @@ class SenderRtcpEventSubscriberTest : public ::testing::Test {
scoped_ptr<base::TickClock>(testing_clock_).Pass(), task_runner_,
task_runner_, task_runner_, task_runner_, task_runner_,
task_runner_, GetLoggingConfigWithRawEventsAndStatsEnabled())),
- event_subscriber_(
- new SenderRtcpEventSubscriber(task_runner_, kSizeThreshold)) {
- cast_environment_->Logging()->AddRawEventSubscriber(
- event_subscriber_.get());
+ event_subscriber_(kMaxEventEntries) {
+ cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
}
virtual ~SenderRtcpEventSubscriberTest() {
- cast_environment_->Logging()->RemoveRawEventSubscriber(
- event_subscriber_.get());
+ cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_);
}
base::SimpleTestTickClock* testing_clock_; // Owned by CastEnvironment.
scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_;
scoped_refptr<CastEnvironment> cast_environment_;
- scoped_ptr<SenderRtcpEventSubscriber> event_subscriber_;
+ SenderRtcpEventSubscriber event_subscriber_;
};
TEST_F(SenderRtcpEventSubscriberTest, InsertEntry) {
@@ -62,7 +59,7 @@ TEST_F(SenderRtcpEventSubscriberTest, InsertEntry) {
testing_clock_->NowTicks(), kVideoFrameSentToEncoder, 300u, 3u);
RtcpEventMap events;
- event_subscriber_->GetRtcpEventsAndReset(&events);
+ event_subscriber_.GetRtcpEventsAndReset(&events);
ASSERT_EQ(3u, events.size());
@@ -84,11 +81,11 @@ TEST_F(SenderRtcpEventSubscriberTest, MapReset) {
kVideoFrameCaptured, 100u, 1u);
RtcpEventMap events;
- event_subscriber_->GetRtcpEventsAndReset(&events);
+ event_subscriber_.GetRtcpEventsAndReset(&events);
EXPECT_EQ(1u, events.size());
// Call again without any logging in between, should return empty map.
- event_subscriber_->GetRtcpEventsAndReset(&events);
+ event_subscriber_.GetRtcpEventsAndReset(&events);
EXPECT_TRUE(events.empty());
}
@@ -99,7 +96,7 @@ TEST_F(SenderRtcpEventSubscriberTest, DropEventsWhenSizeExceeded) {
}
RtcpEventMap events;
- event_subscriber_->GetRtcpEventsAndReset(&events);
+ event_subscriber_.GetRtcpEventsAndReset(&events);
ASSERT_EQ(10u, events.size());
EXPECT_EQ(10u, events.begin()->first);
@@ -110,7 +107,7 @@ TEST_F(SenderRtcpEventSubscriberTest, DropEventsWhenSizeExceeded) {
testing_clock_->NowTicks(), kVideoFrameCaptured, i * 10, i);
}
- event_subscriber_->GetRtcpEventsAndReset(&events);
+ event_subscriber_.GetRtcpEventsAndReset(&events);
// Event with RTP timestamp 10 should have been dropped when 110 is inserted.
ASSERT_EQ(10u, events.size());
diff --git a/media/cast/test/end2end_unittest.cc b/media/cast/test/end2end_unittest.cc
index f42c4c5..656df64 100644
--- a/media/cast/test/end2end_unittest.cc
+++ b/media/cast/test/end2end_unittest.cc
@@ -393,8 +393,7 @@ class End2EndTest : public ::testing::Test {
receiver_to_sender_(cast_environment_),
sender_to_receiver_(cast_environment_),
test_receiver_audio_callback_(new TestReceiverAudioCallback()),
- test_receiver_video_callback_(new TestReceiverVideoCallback()),
- event_subscriber_(task_runner_) {
+ test_receiver_video_callback_(new TestReceiverVideoCallback()) {
testing_clock_->Advance(
base::TimeDelta::FromMilliseconds(kStartMillisecond));
cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_);
diff --git a/media/cast/video_receiver/video_receiver.cc b/media/cast/video_receiver/video_receiver.cc
index 82a2c29..745dc4e 100644
--- a/media/cast/video_receiver/video_receiver.cc
+++ b/media/cast/video_receiver/video_receiver.cc
@@ -103,8 +103,6 @@ VideoReceiver::VideoReceiver(scoped_refptr<CastEnvironment> cast_environment,
transport::PacedPacketSender* const packet_sender)
: cast_environment_(cast_environment),
event_subscriber_(
- cast_environment->GetMessageSingleThreadTaskRunnerForThread(
- CastEnvironment::MAIN),
kMaxEventSubscriberEntries,
ReceiverRtcpEventSubscriber::kVideoEventSubscriber),
codec_(video_config.codec),
diff --git a/media/cast/video_sender/video_sender.cc b/media/cast/video_sender/video_sender.cc
index bb1e2e9..7e873ff 100644
--- a/media/cast/video_sender/video_sender.cc
+++ b/media/cast/video_sender/video_sender.cc
@@ -94,10 +94,7 @@ VideoSender::VideoSender(
max_frame_rate_(video_config.max_frame_rate),
cast_environment_(cast_environment),
transport_sender_(transport_sender),
- event_subscriber_(
- cast_environment_->GetMessageSingleThreadTaskRunnerForThread(
- CastEnvironment::MAIN),
- kMaxEventSubscriberEntries),
+ event_subscriber_(kMaxEventSubscriberEntries),
rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)),
last_acked_frame_id_(-1),
last_sent_frame_id_(-1),