| 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_impl.h" | 5 #include "media/mojo/services/mojo_demuxer_stream_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 audio_config = | 89 audio_config = |
| 90 interfaces::AudioDecoderConfig::From(stream_->audio_decoder_config()); | 90 interfaces::AudioDecoderConfig::From(stream_->audio_decoder_config()); |
| 91 } else if (stream_->type() == media::DemuxerStream::VIDEO) { | 91 } else if (stream_->type() == media::DemuxerStream::VIDEO) { |
| 92 video_config = | 92 video_config = |
| 93 interfaces::VideoDecoderConfig::From(stream_->video_decoder_config()); | 93 interfaces::VideoDecoderConfig::From(stream_->video_decoder_config()); |
| 94 } else { | 94 } else { |
| 95 NOTREACHED() << "Unsupported config change encountered for type: " | 95 NOTREACHED() << "Unsupported config change encountered for type: " |
| 96 << stream_->type(); | 96 << stream_->type(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 callback.Run(interfaces::DemuxerStream::STATUS_CONFIG_CHANGED, | 99 callback.Run(interfaces::DemuxerStream::Status::CONFIG_CHANGED, |
| 100 interfaces::DecoderBufferPtr(), std::move(audio_config), | 100 interfaces::DecoderBufferPtr(), std::move(audio_config), |
| 101 std::move(video_config)); | 101 std::move(video_config)); |
| 102 return; | 102 return; |
| 103 } | 103 } |
| 104 | 104 |
| 105 if (status == media::DemuxerStream::kAborted) { | 105 if (status == media::DemuxerStream::kAborted) { |
| 106 callback.Run(interfaces::DemuxerStream::STATUS_ABORTED, | 106 callback.Run(interfaces::DemuxerStream::Status::ABORTED, |
| 107 interfaces::DecoderBufferPtr(), std::move(audio_config), | 107 interfaces::DecoderBufferPtr(), std::move(audio_config), |
| 108 std::move(video_config)); | 108 std::move(video_config)); |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 | 111 |
| 112 DCHECK_EQ(status, media::DemuxerStream::kOk); | 112 DCHECK_EQ(status, media::DemuxerStream::kOk); |
| 113 if (!buffer->end_of_stream()) { | 113 if (!buffer->end_of_stream()) { |
| 114 DCHECK_GT(buffer->data_size(), 0); | 114 DCHECK_GT(buffer->data_size(), 0); |
| 115 // Serialize the data section of the DecoderBuffer into our pipe. | 115 // Serialize the data section of the DecoderBuffer into our pipe. |
| 116 uint32_t num_bytes = buffer->data_size(); | 116 uint32_t num_bytes = buffer->data_size(); |
| 117 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &num_bytes, | 117 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &num_bytes, |
| 118 MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 118 MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
| 119 MOJO_RESULT_OK); | 119 MOJO_RESULT_OK); |
| 120 CHECK_EQ(num_bytes, static_cast<uint32_t>(buffer->data_size())); | 120 CHECK_EQ(num_bytes, static_cast<uint32_t>(buffer->data_size())); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via | 123 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via |
| 124 // the producer handle and then read more to keep the pipe full. Waiting for | 124 // the producer handle and then read more to keep the pipe full. Waiting for |
| 125 // space can be accomplished using an AsyncWaiter. | 125 // space can be accomplished using an AsyncWaiter. |
| 126 callback.Run(static_cast<interfaces::DemuxerStream::Status>(status), | 126 callback.Run(static_cast<interfaces::DemuxerStream::Status>(status), |
| 127 interfaces::DecoderBuffer::From(buffer), std::move(audio_config), | 127 interfaces::DecoderBuffer::From(buffer), std::move(audio_config), |
| 128 std::move(video_config)); | 128 std::move(video_config)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace media | 131 } // namespace media |
| OLD | NEW |