| Index: media/filters/blocking_url_protocol.h
|
| diff --git a/media/filters/blocking_url_protocol.h b/media/filters/blocking_url_protocol.h
|
| index 4f9ef4f3507490cf957186a8c937db5da498d42f..7e6a1eb4f314c61d2bee23eb9c2db117d8d0e386 100644
|
| --- a/media/filters/blocking_url_protocol.h
|
| +++ b/media/filters/blocking_url_protocol.h
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/callback.h"
|
| #include "base/macros.h"
|
| +#include "base/synchronization/lock.h"
|
| #include "base/synchronization/waitable_event.h"
|
| #include "media/filters/ffmpeg_glue.h"
|
|
|
| @@ -17,19 +18,19 @@ namespace media {
|
| class DataSource;
|
|
|
| // An implementation of FFmpegURLProtocol that blocks until the underlying
|
| -// asynchronous DataSource::Read() operation completes.
|
| +// asynchronous DataSource::Read() operation completes. Generally constructed on
|
| +// the media thread and used by ffmpeg through the AVIO interface from a
|
| +// sequenced blocking pool.
|
| class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
|
| public:
|
| // Implements FFmpegURLProtocol using the given |data_source|. |error_cb| is
|
| // fired any time DataSource::Read() returns an error.
|
| - //
|
| - // TODO(scherkus): After all blocking operations are isolated on a separate
|
| - // thread we should be able to eliminate |error_cb|.
|
| BlockingUrlProtocol(DataSource* data_source, const base::Closure& error_cb);
|
| virtual ~BlockingUrlProtocol();
|
|
|
| // Aborts any pending reads by returning a read error. After this method
|
| - // returns all subsequent calls to Read() will immediately fail.
|
| + // returns all subsequent calls to Read() will immediately fail. May be called
|
| + // from any thread and upon return ensures no further use of |data_source_|.
|
| void Abort();
|
|
|
| // FFmpegURLProtocol implementation.
|
| @@ -44,8 +45,14 @@ class MEDIA_EXPORT BlockingUrlProtocol : public FFmpegURLProtocol {
|
| // has completed.
|
| void SignalReadCompleted(int size);
|
|
|
| + // |data_source_lock_| allows Abort() to be called from any thread and stop
|
| + // all outstanding access to |data_source_|. Typically Abort() is called from
|
| + // the media thread while ffmpeg is operating on another thread.
|
| + base::Lock data_source_lock_;
|
| DataSource* data_source_;
|
| +
|
| base::Closure error_cb_;
|
| + const bool is_streaming_;
|
|
|
| // Used to unblock the thread during shutdown and when reads complete.
|
| base::WaitableEvent aborted_;
|
|
|