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

Side by Side Diff: media/base/video_decoder.h

Issue 239893002: Allow multiple concurrent Decode() requests in VideoDecoder interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | media/base/video_decoder.cc » ('j') | media/filters/fake_video_decoder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_VIDEO_DECODER_H_ 5 #ifndef MEDIA_BASE_VIDEO_DECODER_H_
6 #define MEDIA_BASE_VIDEO_DECODER_H_ 6 #define MEDIA_BASE_VIDEO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
(...skipping 28 matching lines...) Expand all
39 // Note: 39 // Note:
40 // 1) The VideoDecoder will be reinitialized if it was initialized before. 40 // 1) The VideoDecoder will be reinitialized if it was initialized before.
41 // Upon reinitialization, all internal buffered frames will be dropped. 41 // Upon reinitialization, all internal buffered frames will be dropped.
42 // 2) This method should not be called during pending decode, reset or stop. 42 // 2) This method should not be called during pending decode, reset or stop.
43 // 3) No VideoDecoder calls except for Stop() should be made before 43 // 3) No VideoDecoder calls except for Stop() should be made before
44 // |status_cb| is executed. 44 // |status_cb| is executed.
45 virtual void Initialize(const VideoDecoderConfig& config, 45 virtual void Initialize(const VideoDecoderConfig& config,
46 const PipelineStatusCB& status_cb) = 0; 46 const PipelineStatusCB& status_cb) = 0;
47 47
48 // Requests a |buffer| to be decoded. The status of the decoder and decoded 48 // Requests a |buffer| to be decoded. The status of the decoder and decoded
49 // frame are returned via the provided callback. Only one decode may be in 49 // frame are returned via the provided callback. Some decoders may allow
50 // flight at any given time. 50 // decoding multiple buffers in parallel. Callers should call
51 // GetMaxDecodeRequests() to get number of buffers that may be decoded in
52 // parallel. Decoder must call |decode_cb| in the same order in which Decode()
53 // is called.
51 // 54 //
52 // Implementations guarantee that the callback will not be called from within 55 // Implementations guarantee that the callback will not be called from within
53 // this method. 56 // this method and that |decode_cb| will not be blocked on the following
57 // Decode() calls (i.e. |decode_cb| will be called even Decode() is never
58 // called again).
54 // 59 //
55 // If the returned status is kOk: 60 // If the returned status is kOk:
56 // - Non-EOS (end of stream) frame contains decoded video data. 61 // - Non-EOS (end of stream) frame contains decoded video data.
57 // - EOS frame indicates the end of the stream. 62 // - EOS frame indicates the end of the stream.
58 // Otherwise the returned frame must be NULL. 63 // Otherwise the returned frame must be NULL.
59 typedef base::Callback<void(Status, 64 typedef base::Callback<void(Status,
60 const scoped_refptr<VideoFrame>&)> DecodeCB; 65 const scoped_refptr<VideoFrame>&)> DecodeCB;
61 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 66 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
62 const DecodeCB& decode_cb) = 0; 67 const DecodeCB& decode_cb) = 0;
63 68
64 // Some VideoDecoders may queue up multiple VideoFrames from a single 69 // Some VideoDecoders may queue up multiple VideoFrames from a single
65 // DecoderBuffer, if we have any such queued frames this will return the next 70 // DecoderBuffer, if we have any such queued frames this will return the next
66 // one. Otherwise we return a NULL VideoFrame. 71 // one. Otherwise we return a NULL VideoFrame.
72 //
73 // TODO(xhwang): Revisit this method.
67 virtual scoped_refptr<VideoFrame> GetDecodeOutput(); 74 virtual scoped_refptr<VideoFrame> GetDecodeOutput();
68 75
69 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra 76 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra
70 // queued decoded data. After this call, the decoder is back to an initialized 77 // queued decoded data. After this call, the decoder is back to an initialized
71 // clean state. 78 // clean state.
72 // Note: No VideoDecoder calls should be made before |closure| is executed. 79 // Note: No VideoDecoder calls should be made before |closure| is executed.
73 virtual void Reset(const base::Closure& closure) = 0; 80 virtual void Reset(const base::Closure& closure) = 0;
74 81
75 // Stops decoder, fires any pending callbacks and sets the decoder to an 82 // Stops decoder, fires any pending callbacks and sets the decoder to an
76 // uninitialized state. A VideoDecoder cannot be re-initialized after it has 83 // uninitialized state. A VideoDecoder cannot be re-initialized after it has
77 // been stopped. 84 // been stopped.
78 // Note that if Initialize() is pending or has finished successfully, Stop() 85 // Note that if Initialize() is pending or has finished successfully, Stop()
79 // must be called before destructing the decoder. 86 // must be called before destructing the decoder.
80 virtual void Stop() = 0; 87 virtual void Stop() = 0;
81 88
82 // Returns true if the decoder needs bitstream conversion before decoding. 89 // Returns true if the decoder needs bitstream conversion before decoding.
83 virtual bool NeedsBitstreamConversion() const; 90 virtual bool NeedsBitstreamConversion() const;
84 91
85 // Returns true if the decoder currently has the ability to decode and return 92 // Returns true if the decoder currently has the ability to decode and return
86 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence 93 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence
87 // this will always return true. Override and return false for decoders that 94 // this will always return true. Override and return false for decoders that
88 // use a fixed set of VideoFrames for decoding. 95 // use a fixed set of VideoFrames for decoding.
89 virtual bool CanReadWithoutStalling() const; 96 virtual bool CanReadWithoutStalling() const;
90 97
98 // Returns maximum number of parallel decode requests.
99 virtual int GetMaxDecodeRequests() const;
100
91 private: 101 private:
92 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); 102 DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
93 }; 103 };
94 104
95 } // namespace media 105 } // namespace media
96 106
97 #endif // MEDIA_BASE_VIDEO_DECODER_H_ 107 #endif // MEDIA_BASE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/video_decoder.cc » ('j') | media/filters/fake_video_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698