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

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

Issue 805193006: Fix VideoDecoderShim to return correct decode_id for all codecs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // depends on |this|. 48 // depends on |this|.
49 virtual ~VideoDecoder(); 49 virtual ~VideoDecoder();
50 50
51 // Returns the name of the decoder for logging purpose. 51 // Returns the name of the decoder for logging purpose.
52 virtual std::string GetDisplayName() const = 0; 52 virtual std::string GetDisplayName() const = 0;
53 53
54 // Initializes a VideoDecoder with the given |config|, executing the 54 // Initializes a VideoDecoder with the given |config|, executing the
55 // |status_cb| upon completion. |output_cb| is called for each output frame 55 // |status_cb| upon completion. |output_cb| is called for each output frame
56 // decoded by Decode(). 56 // decoded by Decode().
57 // 57 //
58 // If |low_delay| is true then the decoder is not allowed to queue frames
59 // internally, i.e. every frame must be returned as soon as it is decoded.
60 // Currently this flag is necessary only for FFmpegDecoder. Other decoders
61 // do not need to delay frames.
xhwang 2015/01/16 23:50:09 I am still a bit concerned about this change in th
Sergey Ulanov 2015/01/20 23:52:26 There are two separate issues: frame reordering an
xhwang 2015/01/21 23:05:04 Thanks for the detailed clarification. I think my
62 //
58 // Note: 63 // Note:
59 // 1) The VideoDecoder will be reinitialized if it was initialized before. 64 // 1) The VideoDecoder will be reinitialized if it was initialized before.
60 // Upon reinitialization, all internal buffered frames will be dropped. 65 // Upon reinitialization, all internal buffered frames will be dropped.
61 // 2) This method should not be called during pending decode or reset. 66 // 2) This method should not be called during pending decode or reset.
62 // 3) No VideoDecoder calls should be made before |status_cb| is executed. 67 // 3) No VideoDecoder calls should be made before |status_cb| is executed.
63 virtual void Initialize(const VideoDecoderConfig& config, 68 virtual void Initialize(const VideoDecoderConfig& config,
64 bool low_delay, 69 bool low_delay,
65 const PipelineStatusCB& status_cb, 70 const PipelineStatusCB& status_cb,
66 const OutputCB& output_cb) = 0; 71 const OutputCB& output_cb) = 0;
67 72
68 // Requests a |buffer| to be decoded. The status of the decoder and decoded 73 // Requests a |buffer| to be decoded. The status of the decoder and decoded
69 // frame are returned via the provided callback. Some decoders may allow 74 // frame are returned via the provided callback. Some decoders may allow
70 // decoding multiple buffers in parallel. Callers should call 75 // decoding multiple buffers in parallel. Callers should call
71 // GetMaxDecodeRequests() to get number of buffers that may be decoded in 76 // GetMaxDecodeRequests() to get number of buffers that may be decoded in
72 // parallel. Decoder must call |decode_cb| in the same order in which Decode() 77 // parallel. Decoder must call |decode_cb| in the same order in which Decode()
73 // is called. 78 // is called.
74 // 79 //
75 // Implementations guarantee that the callback will not be called from within 80 // Implementations guarantee that the callback will not be called from within
76 // this method and that |decode_cb| will not be blocked on the following 81 // this method and that |decode_cb| will not be blocked on the following
77 // Decode() calls (i.e. |decode_cb| will be called even if Decode() is never 82 // Decode() calls (i.e. |decode_cb| will be called even if Decode() is never
78 // called again). 83 // called again).
79 // 84 //
80 // After decoding is finished the decoder calls |output_cb| specified in 85 // After decoding is finished the decoder calls |output_cb| specified in
81 // Initialize() for each decoded frame. |output_cb| may be called before or 86 // Initialize() for each decoded frame. In general |output_cb| may be called
82 // after |decode_cb|. 87 // before or after |decode_cb|, but software decoders in low-delay mode must
88 // call |output_cb| for all frames in |buffer| before calling |decode_cb|.
xhwang 2015/01/16 23:50:09 I think it makes sense to require |decode_cb| to b
Sergey Ulanov 2015/01/20 23:52:26 Reworded this comment.
83 // 89 //
84 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e. 90 // If |buffer| is an EOS buffer then the decoder must be flushed, i.e.
85 // |output_cb| must be called for each frame pending in the queue and 91 // |output_cb| must be called for each frame pending in the queue and
86 // |decode_cb| must be called after that. Callers will not call Decode() 92 // |decode_cb| must be called after that. Callers will not call Decode()
87 // again until after the flush completes. 93 // again until after the flush completes.
88 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 94 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
89 const DecodeCB& decode_cb) = 0; 95 const DecodeCB& decode_cb) = 0;
90 96
91 // Resets decoder state. All pending Decode() requests will be finished or 97 // Resets decoder state. All pending Decode() requests will be finished or
92 // aborted before |closure| is called. 98 // aborted before |closure| is called.
(...skipping 12 matching lines...) Expand all
105 // Returns maximum number of parallel decode requests. 111 // Returns maximum number of parallel decode requests.
106 virtual int GetMaxDecodeRequests() const; 112 virtual int GetMaxDecodeRequests() const;
107 113
108 private: 114 private:
109 DISALLOW_COPY_AND_ASSIGN(VideoDecoder); 115 DISALLOW_COPY_AND_ASSIGN(VideoDecoder);
110 }; 116 };
111 117
112 } // namespace media 118 } // namespace media
113 119
114 #endif // MEDIA_BASE_VIDEO_DECODER_H_ 120 #endif // MEDIA_BASE_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698