7 #include "packager/media/base/media_stream.h"
9 #include "packager/base/logging.h"
10 #include "packager/base/strings/stringprintf.h"
11 #include "packager/media/base/demuxer.h"
12 #include "packager/media/base/media_sample.h"
13 #include "packager/media/base/muxer.h"
14 #include "packager/media/base/stream_info.h"
16 namespace edash_packager {
20 : info_(info), demuxer_(demuxer), muxer_(NULL), state_(kIdle) {}
22 MediaStream::~MediaStream() {}
25 DCHECK_EQ(state_, kPulling);
28 while (samples_.empty()) {
34 *sample = samples_.front();
43 samples_.push_back(sample);
48 return muxer_->AddSample(
this, sample);
50 NOTREACHED() <<
"Unexpected State " << state_;
51 return Status::UNKNOWN;
64 DCHECK(operation == kPush || operation == kPull);
69 state_ = kDisconnected;
73 state_ = (operation == kPush) ? kPushing : kPulling;
74 if (operation == kPush) {
76 while (!samples_.empty()) {
77 Status status = muxer_->AddSample(
this, samples_.front());
85 for (
size_t i = 0; i < demuxer_->
streams().size(); ++i) {
93 DCHECK(operation == kPull);
96 NOTREACHED() <<
"Unexpected State " << state_;
97 return Status::UNKNOWN;
101 const scoped_refptr<StreamInfo> MediaStream::info()
const {
return info_; }
104 return base::StringPrintf(
"state: %d\n samples in the queue: %zu\n %s",
105 state_, samples_.size(), info_->ToString().c_str());