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

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, 8 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/decoder_stream.h » ('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 frames in parallel. Callers should call
51 // GetMaxDecodeRequests() to get number of frames that may be decoded in
xhwang 2014/04/25 00:36:03 s/frames/buffers
Sergey Ulanov 2014/04/26 00:59:29 Done.
52 // parallel.
51 // 53 //
52 // Implementations guarantee that the callback will not be called from within 54 // Implementations guarantee that the callback will not be called from within
53 // this method. 55 // this method.
54 // 56 //
55 // If the returned status is kOk: 57 // If the returned status is kOk:
56 // - Non-EOS (end of stream) frame contains decoded video data. 58 // - Non-EOS (end of stream) frame contains decoded video data.
57 // - EOS frame indicates the end of the stream. 59 // - EOS frame indicates the end of the stream.
58 // Otherwise the returned frame must be NULL. 60 // Otherwise the returned frame must be NULL.
59 typedef base::Callback<void(Status, 61 typedef base::Callback<void(Status,
60 const scoped_refptr<VideoFrame>&)> DecodeCB; 62 const scoped_refptr<VideoFrame>&)> DecodeCB;
61 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 63 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
62 const DecodeCB& decode_cb) = 0; 64 const DecodeCB& decode_cb) = 0;
63 65
64 // Some VideoDecoders may queue up multiple VideoFrames from a single 66 // Some VideoDecoders may queue up multiple VideoFrames from a single
65 // DecoderBuffer, if we have any such queued frames this will return the next 67 // DecoderBuffer, if we have any such queued frames this will return the next
66 // one. Otherwise we return a NULL VideoFrame. 68 // one. Otherwise we return a NULL VideoFrame.
69 //
70 // TODO(xhwang): Remove this method.
xhwang 2014/04/25 00:36:03 s/Remove/Revisit Since we still have 1:1 mapping
Sergey Ulanov 2014/04/26 00:59:29 Done. I think the right way to fix it is to pass m
67 virtual scoped_refptr<VideoFrame> GetDecodeOutput(); 71 virtual scoped_refptr<VideoFrame> GetDecodeOutput();
68 72
69 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra 73 // Resets decoder state, fulfilling all pending DecodeCB and dropping extra
70 // queued decoded data. After this call, the decoder is back to an initialized 74 // queued decoded data. After this call, the decoder is back to an initialized
71 // clean state. 75 // clean state.
72 // Note: No VideoDecoder calls should be made before |closure| is executed. 76 // Note: No VideoDecoder calls should be made before |closure| is executed.
73 virtual void Reset(const base::Closure& closure) = 0; 77 virtual void Reset(const base::Closure& closure) = 0;
74 78
75 // Stops decoder, fires any pending callbacks and sets the decoder to an 79 // Stops decoder, fires any pending callbacks and sets the decoder to an
76 // uninitialized state. A VideoDecoder cannot be re-initialized after it has 80 // uninitialized state. A VideoDecoder cannot be re-initialized after it has
77 // been stopped. 81 // been stopped.
78 // Note that if Initialize() is pending or has finished successfully, Stop() 82 // Note that if Initialize() is pending or has finished successfully, Stop()
79 // must be called before destructing the decoder. 83 // must be called before destructing the decoder.
80 virtual void Stop() = 0; 84 virtual void Stop() = 0;
81 85
82 // Returns true if the decoder needs bitstream conversion before decoding. 86 // Returns true if the decoder needs bitstream conversion before decoding.
83 virtual bool NeedsBitstreamConversion() const; 87 virtual bool NeedsBitstreamConversion() const;
84 88
85 // Returns true if the decoder currently has the ability to decode and return 89 // 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 90 // a VideoFrame. Most implementations can allocate a new VideoFrame and hence
87 // this will always return true. Override and return false for decoders that 91 // this will always return true. Override and return false for decoders that
88 // use a fixed set of VideoFrames for decoding. 92 // use a fixed set of VideoFrames for decoding.
89 virtual bool CanReadWithoutStalling() const; 93 virtual bool CanReadWithoutStalling() const;
90 94
95 // Returns how many frames that may be decoded in parallel.
xhwang 2014/04/25 00:36:03 s/frame/buffer
Sergey Ulanov 2014/04/26 00:59:29 Done.
96 virtual int GetMaxDecodeRequests() const;
97
91 private: 98 private:
92 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); 99 DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
93 }; 100 };
94 101
95 } // namespace media 102 } // namespace media
96 103
97 #endif // MEDIA_BASE_VIDEO_DECODER_H_ 104 #endif // MEDIA_BASE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/video_decoder.cc » ('j') | media/filters/decoder_stream.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698