Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "media/filters/ffmpeg_video_decoder.h" | 5 #include "media/filters/ffmpeg_video_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 DCHECK_EQ(MessageLoop::current(), message_loop_); | 168 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 169 DCHECK(!seek_cb_.is_null()); | 169 DCHECK(!seek_cb_.is_null()); |
| 170 | 170 |
| 171 ResetAndRunCB(&seek_cb_, PIPELINE_OK); | 171 ResetAndRunCB(&seek_cb_, PIPELINE_OK); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void FFmpegVideoDecoder::OnError() { | 174 void FFmpegVideoDecoder::OnError() { |
| 175 VideoFrameReady(NULL); | 175 VideoFrameReady(NULL); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void FFmpegVideoDecoder::OnReadComplete(Buffer* buffer_in) { | 178 void FFmpegVideoDecoder::OnReadComplete(const scoped_refptr<Buffer>& buffer) { |
| 179 scoped_refptr<Buffer> buffer(buffer_in); | |
| 180 message_loop_->PostTask(FROM_HERE, base::Bind( | 179 message_loop_->PostTask(FROM_HERE, base::Bind( |
| 181 &FFmpegVideoDecoder::OnReadCompleteTask, this, buffer)); | 180 &FFmpegVideoDecoder::OnReadCompleteTask, this, buffer)); |
| 182 } | 181 } |
| 183 | 182 |
| 184 void FFmpegVideoDecoder::OnReadCompleteTask(scoped_refptr<Buffer> buffer) { | 183 void FFmpegVideoDecoder::OnReadCompleteTask( |
|
Ami GONE FROM CHROMIUM
2011/11/01 19:30:58
Elsewhere (i.e. FFmpegVideoDecoder::Seek) this fil
| |
| 184 const scoped_refptr<Buffer>& buffer) { | |
| 185 DCHECK_EQ(MessageLoop::current(), message_loop_); | 185 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 186 DCHECK_NE(state_, kStopped); // because of Flush() before Stop(). | 186 DCHECK_NE(state_, kStopped); // because of Flush() before Stop(). |
| 187 | 187 |
| 188 // During decode, because reads are issued asynchronously, it is possible to | 188 // During decode, because reads are issued asynchronously, it is possible to |
| 189 // receive multiple end of stream buffers since each read is acked. When the | 189 // receive multiple end of stream buffers since each read is acked. When the |
| 190 // first end of stream buffer is read, FFmpeg may still have frames queued | 190 // first end of stream buffer is read, FFmpeg may still have frames queued |
| 191 // up in the decoder so we need to go through the decode loop until it stops | 191 // up in the decoder so we need to go through the decode loop until it stops |
| 192 // giving sensible data. After that, the decoder should output empty | 192 // giving sensible data. After that, the decoder should output empty |
| 193 // frames. There are three states the decoder can be in: | 193 // frames. There are three states the decoder can be in: |
| 194 // | 194 // |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 decode_engine_->ProduceVideoFrame(video_frame); | 311 decode_engine_->ProduceVideoFrame(video_frame); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( | 315 void FFmpegVideoDecoder::SetVideoDecodeEngineForTest( |
| 316 VideoDecodeEngine* engine) { | 316 VideoDecodeEngine* engine) { |
| 317 decode_engine_.reset(engine); | 317 decode_engine_.reset(engine); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace media | 320 } // namespace media |
| OLD | NEW |