| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo/services/mojo_demuxer_stream_adapter.h" | 5 #include "media/mojo/services/mojo_demuxer_stream_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "media/base/decoder_buffer.h" | 9 #include "media/base/decoder_buffer.h" |
| 10 #include "media/mojo/services/media_type_converters.h" | 10 #include "media/mojo/services/media_type_converters.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 if (type_ == DemuxerStream::AUDIO) { | 127 if (type_ == DemuxerStream::AUDIO) { |
| 128 audio_config_queue_.pop(); | 128 audio_config_queue_.pop(); |
| 129 if (audio_config_queue_.empty()) | 129 if (audio_config_queue_.empty()) |
| 130 return; | 130 return; |
| 131 } else if (type_ == DemuxerStream::VIDEO) { | 131 } else if (type_ == DemuxerStream::VIDEO) { |
| 132 video_config_queue_.pop(); | 132 video_config_queue_.pop(); |
| 133 if (video_config_queue_.empty()) | 133 if (video_config_queue_.empty()) |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 } else if (status == mojo::DemuxerStream::STATUS_OK) { | 136 } else if (status == mojo::DemuxerStream::STATUS_OK && |
| 137 !media_buffer->end_of_stream()) { |
| 137 DCHECK_GT(media_buffer->data_size(), 0); | 138 DCHECK_GT(media_buffer->data_size(), 0); |
| 138 | 139 |
| 139 // Read the inner data for the DecoderBuffer from our DataPipe. | 140 // Read the inner data for the DecoderBuffer from our DataPipe. |
| 140 uint32_t num_bytes = media_buffer->data_size(); | 141 uint32_t num_bytes = media_buffer->data_size(); |
| 141 CHECK_EQ(ReadDataRaw(stream_pipe_.get(), media_buffer->writable_data(), | 142 CHECK_EQ(ReadDataRaw(stream_pipe_.get(), media_buffer->writable_data(), |
| 142 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 143 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
| 143 MOJO_RESULT_OK); | 144 MOJO_RESULT_OK); |
| 144 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size())); | 145 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size())); |
| 145 } | 146 } |
| 146 | 147 |
| 147 read_cb_.Run(media_status, media_buffer); | 148 read_cb_.Run(media_status, media_buffer); |
| 148 read_cb_.Reset(); | 149 read_cb_.Reset(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 } // namespace media | 152 } // namespace media |
| OLD | NEW |