| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gpu/android_video_decode_accelerator.h" | 5 #include "media/gpu/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 // shm block been deleted. Check that it is safe to flush the codec, i.e. | 1172 // shm block been deleted. Check that it is safe to flush the codec, i.e. |
| 1173 // |pending_bitstream_records_| is empty. | 1173 // |pending_bitstream_records_| is empty. |
| 1174 // TODO(timav): keep shm block for that buffer and remove this restriction. | 1174 // TODO(timav): keep shm block for that buffer and remove this restriction. |
| 1175 DCHECK(pending_bitstream_records_.empty()); | 1175 DCHECK(pending_bitstream_records_.empty()); |
| 1176 pending_input_buf_index_ = -1; | 1176 pending_input_buf_index_ = -1; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 // If we've just completed a flush don't reset the codec yet. Instead defer | 1179 // If we've just completed a flush don't reset the codec yet. Instead defer |
| 1180 // until the next decode call. This prevents us from unbacking frames that | 1180 // until the next decode call. This prevents us from unbacking frames that |
| 1181 // might be out for display at end of stream. | 1181 // might be out for display at end of stream. |
| 1182 codec_needs_reset_ = drain_type_ == DRAIN_FOR_FLUSH; | 1182 codec_needs_reset_ = |
| 1183 (drain_type_ == DRAIN_FOR_FLUSH) || (drain_type_ == DRAIN_FOR_RESET); |
| 1183 if (codec_needs_reset_) | 1184 if (codec_needs_reset_) |
| 1184 return; | 1185 return; |
| 1185 | 1186 |
| 1186 // Flush the codec if possible, or create a new one if not. | 1187 // Flush the codec if possible, or create a new one if not. |
| 1187 if (!MediaCodecUtil::CodecNeedsFlushWorkaround(media_codec_.get())) { | 1188 if (!MediaCodecUtil::CodecNeedsFlushWorkaround(media_codec_.get())) { |
| 1188 DVLOG(3) << __func__ << " Flushing MediaCodec."; | 1189 DVLOG(3) << __func__ << " Flushing MediaCodec."; |
| 1189 media_codec_->Flush(); | 1190 media_codec_->Flush(); |
| 1190 // Since we just flushed all the output buffers, make sure that nothing is | 1191 // Since we just flushed all the output buffers, make sure that nothing is |
| 1191 // using them. | 1192 // using them. |
| 1192 picture_buffer_manager_.CodecChanged(media_codec_.get()); | 1193 picture_buffer_manager_.CodecChanged(media_codec_.get()); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 if (!media_codec_) | 1628 if (!media_codec_) |
| 1628 return; | 1629 return; |
| 1629 | 1630 |
| 1630 picture_buffer_manager_.CodecChanged(nullptr); | 1631 picture_buffer_manager_.CodecChanged(nullptr); |
| 1631 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), | 1632 codec_allocator_->ReleaseMediaCodec(std::move(media_codec_), |
| 1632 codec_config_->task_type, | 1633 codec_config_->task_type, |
| 1633 codec_config_->surface_bundle); | 1634 codec_config_->surface_bundle); |
| 1634 } | 1635 } |
| 1635 | 1636 |
| 1636 } // namespace media | 1637 } // namespace media |
| OLD | NEW |