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

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 8301011: Fix 99596. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 DemuxerStream::Type FFmpegDemuxerStream::type() { 155 DemuxerStream::Type FFmpegDemuxerStream::type() {
156 return type_; 156 return type_;
157 } 157 }
158 158
159 void FFmpegDemuxerStream::Read(const ReadCallback& read_callback) { 159 void FFmpegDemuxerStream::Read(const ReadCallback& read_callback) {
160 DCHECK(!read_callback.is_null()); 160 DCHECK(!read_callback.is_null());
161 161
162 base::AutoLock auto_lock(lock_); 162 base::AutoLock auto_lock(lock_);
163 // Don't accept any additional reads if we've been told to stop.
164 // The demuxer_ may have been destroyed in the pipleine thread.
165 //
166 // TODO(scherkus): it would be cleaner if we replied with an error message.
167 if (stopped_) {
168 return;
acolwell GONE FROM CHROMIUM 2011/10/14 21:37:35 I think it would be better to return an EndOfStrea
ddorwin 2011/10/14 23:41:54 Okay. I suppose we should be doing that in ReadTas
169 }
170
163 if (!buffer_queue_.empty()) { 171 if (!buffer_queue_.empty()) {
164 // Dequeue a buffer send back. 172 // Dequeue a buffer send back.
165 scoped_refptr<Buffer> buffer = buffer_queue_.front(); 173 scoped_refptr<Buffer> buffer = buffer_queue_.front();
166 buffer_queue_.pop_front(); 174 buffer_queue_.pop_front();
167 175
168 // Execute the callback. 176 // Execute the callback.
169 read_callback.Run(buffer); 177 read_callback.Run(buffer);
170 178
171 if (!read_queue_.empty()) 179 if (!read_queue_.empty())
172 demuxer_->PostDemuxTask(); 180 demuxer_->PostDemuxTask();
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 read_event_.Wait(); 728 read_event_.Wait();
721 return last_read_bytes_; 729 return last_read_bytes_;
722 } 730 }
723 731
724 void FFmpegDemuxer::SignalReadCompleted(size_t size) { 732 void FFmpegDemuxer::SignalReadCompleted(size_t size) {
725 last_read_bytes_ = size; 733 last_read_bytes_ = size;
726 read_event_.Signal(); 734 read_event_.Signal();
727 } 735 }
728 736
729 } // namespace media 737 } // namespace media
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