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

Side by Side Diff: media/mojo/services/mojo_demuxer_stream_impl.cc

Issue 796143003: Fix EOS buffer handling in spork. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « media/mojo/services/mojo_demuxer_stream_adapter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "media/base/audio_decoder_config.h" 9 #include "media/base/audio_decoder_config.h"
10 #include "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
(...skipping 28 matching lines...) Expand all
39 // Status obtained via Run() below. 39 // Status obtained via Run() below.
40 if (stream_->type() == media::DemuxerStream::AUDIO) { 40 if (stream_->type() == media::DemuxerStream::AUDIO) {
41 client()->OnAudioDecoderConfigChanged( 41 client()->OnAudioDecoderConfigChanged(
42 mojo::AudioDecoderConfig::From(stream_->audio_decoder_config())); 42 mojo::AudioDecoderConfig::From(stream_->audio_decoder_config()));
43 } else if (stream_->type() == media::DemuxerStream::VIDEO) { 43 } else if (stream_->type() == media::DemuxerStream::VIDEO) {
44 client()->OnVideoDecoderConfigChanged( 44 client()->OnVideoDecoderConfigChanged(
45 mojo::VideoDecoderConfig::From(stream_->video_decoder_config())); 45 mojo::VideoDecoderConfig::From(stream_->video_decoder_config()));
46 } 46 }
47 } 47 }
48 48
49 // Serialize the data section of the DecoderBuffer into our pipe. 49 if (!buffer->end_of_stream()) {
50 uint32_t num_bytes = buffer->data_size(); 50 // Serialize the data section of the DecoderBuffer into our pipe.
51 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &num_bytes, 51 uint32_t num_bytes = buffer->data_size();
52 MOJO_READ_DATA_FLAG_ALL_OR_NONE), 52 CHECK_EQ(WriteDataRaw(stream_pipe_.get(), buffer->data(), &num_bytes,
53 MOJO_RESULT_OK); 53 MOJO_READ_DATA_FLAG_ALL_OR_NONE),
54 CHECK_EQ(num_bytes, static_cast<uint32_t>(buffer->data_size())); 54 MOJO_RESULT_OK);
55 CHECK_EQ(num_bytes, static_cast<uint32_t>(buffer->data_size()));
56 }
55 57
56 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via 58 // TODO(dalecurtis): Once we can write framed data to the DataPipe, fill via
57 // the producer handle and then read more to keep the pipe full. Waiting for 59 // the producer handle and then read more to keep the pipe full. Waiting for
58 // space can be accomplished using an AsyncWaiter. 60 // space can be accomplished using an AsyncWaiter.
59 callback.Run(static_cast<mojo::DemuxerStream::Status>(status), 61 callback.Run(static_cast<mojo::DemuxerStream::Status>(status),
60 mojo::MediaDecoderBuffer::From(buffer)); 62 mojo::MediaDecoderBuffer::From(buffer));
61 } 63 }
62 64
63 void MojoDemuxerStreamImpl::DidConnect() { 65 void MojoDemuxerStreamImpl::DidConnect() {
64 // This is called when our DemuxerStreamClient has connected itself and is 66 // This is called when our DemuxerStreamClient has connected itself and is
(...skipping 22 matching lines...) Expand all
87 // Other types don't require a lot of room, so use a smaller pipe. 89 // Other types don't require a lot of room, so use a smaller pipe.
88 options.capacity_num_bytes = 512 * 1024; 90 options.capacity_num_bytes = 512 * 1024;
89 } 91 }
90 92
91 mojo::DataPipe data_pipe(options); 93 mojo::DataPipe data_pipe(options);
92 stream_pipe_ = data_pipe.producer_handle.Pass(); 94 stream_pipe_ = data_pipe.producer_handle.Pass();
93 client()->OnStreamReady(data_pipe.consumer_handle.Pass()); 95 client()->OnStreamReady(data_pipe.consumer_handle.Pass());
94 } 96 }
95 97
96 } // namespace media 98 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_demuxer_stream_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698