summaryrefslogtreecommitdiffstats
path: root/media/base/buffers.h
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:16:10 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-04 20:16:10 +0000
commit80a609dc8bb5cdd53a0383f2f173d3e94257c5a6 (patch)
treee1ed6eec1977eceeda384bc49ebaf7fae64ba812 /media/base/buffers.h
parente116a526fce847f7d19a0576d30b3e8de812d923 (diff)
downloadchromium_src-80a609dc8bb5cdd53a0383f2f173d3e94257c5a6.zip
chromium_src-80a609dc8bb5cdd53a0383f2f173d3e94257c5a6.tar.gz
chromium_src-80a609dc8bb5cdd53a0383f2f173d3e94257c5a6.tar.bz2
Handle end of stream for media
When FFmpegDemuxer failed to decode a raw packet, the signal of end of stream should bubble up to the renderers. It is done in this CL by creating fake buffers. This change also fixes a bug with video of only 1 frame. Review URL: http://codereview.chromium.org/113611 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/buffers.h')
-rw-r--r--media/base/buffers.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/media/base/buffers.h b/media/base/buffers.h
index 527f9e6..6fa0cfe 100644
--- a/media/base/buffers.h
+++ b/media/base/buffers.h
@@ -45,10 +45,10 @@ class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
return duration_;
}
- // Indicates that the sample is the last one in the stream.
- bool IsEndOfStream() const {
- return end_of_stream_;
- }
+ // Indicates that the sample is the last one in the stream. This method is
+ // pure virtual so implementors can decide when to declare end of stream
+ // depending on specific data.
+ virtual bool IsEndOfStream() const = 0;
// Indicates that this sample is discontinuous from the previous one, for
// example, following a seek.
@@ -66,11 +66,6 @@ class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
duration_ = duration;
}
- // Sets the value returned by IsEndOfStream().
- void SetEndOfStream(bool end_of_stream) {
- end_of_stream_ = end_of_stream;
- }
-
// Sets the value returned by IsDiscontinuous().
void SetDiscontinuous(bool discontinuous) {
discontinuous_ = discontinuous;
@@ -79,14 +74,12 @@ class StreamSample : public base::RefCountedThreadSafe<StreamSample> {
protected:
friend class base::RefCountedThreadSafe<StreamSample>;
StreamSample()
- : end_of_stream_(false),
- discontinuous_(false) {
+ : discontinuous_(false) {
}
virtual ~StreamSample() {}
base::TimeDelta timestamp_;
base::TimeDelta duration_;
- bool end_of_stream_;
bool discontinuous_;
private:
@@ -101,6 +94,9 @@ class Buffer : public StreamSample {
// Returns the size of valid data in bytes.
virtual size_t GetDataSize() const = 0;
+
+ // If there's no data in this buffer, it represents end of stream.
+ virtual bool IsEndOfStream() const { return GetData() == NULL; }
};
@@ -143,6 +139,7 @@ struct VideoSurface {
RGBA, // 32bpp RGBA packed 8:8:8:8
YV12, // 12bpp YVU planar 1x1 Y, 2x2 VU samples
YV16, // 16bpp YVU planar 1x1 Y, 2x1 VU samples
+ EMPTY, // An empty frame.
};
// Surface format.
@@ -176,6 +173,8 @@ class VideoFrame : public StreamSample {
// Unlocks the underlying surface, the VideoSurface acquired from Lock is no
// longer guaranteed to be valid.
virtual void Unlock() = 0;
+
+ virtual bool IsEndOfStream() const = 0;
};
} // namespace media