summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 23:55:58 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 23:55:58 +0000
commitb4ed8a38e90d0999f0c27950f807712996a3f800 (patch)
treeb2f317dd61a98096c507a86299395b0d65b0476a /media
parent6b0685f1c157bf0b8964ef60a30c36c25897f853 (diff)
downloadchromium_src-b4ed8a38e90d0999f0c27950f807712996a3f800.zip
chromium_src-b4ed8a38e90d0999f0c27950f807712996a3f800.tar.gz
chromium_src-b4ed8a38e90d0999f0c27950f807712996a3f800.tar.bz2
Fix a bug in audio/video decoder that the stopped variable is not initialized
stopped_ variable is not initialized in DecoderBase, results in dropping packets. Review URL: http://codereview.chromium.org/151170 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/decoder_base.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/media/filters/decoder_base.h b/media/filters/decoder_base.h
index 1508439..b36a9b8 100644
--- a/media/filters/decoder_base.h
+++ b/media/filters/decoder_base.h
@@ -80,7 +80,7 @@ class DecoderBase : public Decoder {
// within the OnDecode method.
void EnqueueResult(Output* output) {
DCHECK_EQ(PlatformThread::CurrentId(), thread_id_);
- if (!stopped_) {
+ if (!IsStopped()) {
result_queue_.push_back(output);
}
}
@@ -122,6 +122,7 @@ class DecoderBase : public Decoder {
// TODO(scherkus): another reason to add protected accessors to MediaFilter.
FilterHost* host() const { return Decoder::host_; }
MessageLoop* message_loop() const { return Decoder::message_loop_; }
+ bool IsStopped() { return state_ == STOPPED; }
void StopTask() {
DCHECK_EQ(PlatformThread::CurrentId(), thread_id_);
@@ -171,7 +172,7 @@ class DecoderBase : public Decoder {
void ReadTask(ReadCallback* read_callback) {
DCHECK_EQ(PlatformThread::CurrentId(), thread_id_);
// TODO(scherkus): should reply with a null operation (empty buffer).
- if (stopped_) {
+ if (IsStopped()) {
delete read_callback;
return;
}
@@ -191,7 +192,7 @@ class DecoderBase : public Decoder {
DCHECK_EQ(PlatformThread::CurrentId(), thread_id_);
DCHECK_GT(pending_reads_, 0u);
--pending_reads_;
- if (stopped_) {
+ if (IsStopped()) {
return;
}
@@ -250,10 +251,6 @@ class DecoderBase : public Decoder {
// Using size_t since it is always compared against deque::size().
size_t pending_reads_;
- // If true, then Stop() has been called and no further processing of buffers
- // should occur.
- bool stopped_;
-
// An internal state of the decoder that indicates that are waiting for seek
// to complete. We expect to receive a discontinuous frame/packet from the
// demuxer to signal that seeking is completed.