| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/cma/base/demuxer_stream_for_test.h" | 5 #include "chromecast/media/cma/base/demuxer_stream_for_test.h" |
| 6 | 6 |
| 7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
| 8 #include "media/base/media_util.h" | 8 #include "media/base/media_util.h" |
| 9 | 9 |
| 10 namespace chromecast { | 10 namespace chromecast { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool DemuxerStreamForTest::SupportsConfigChanges() { | 73 bool DemuxerStreamForTest::SupportsConfigChanges() { |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 ::media::VideoRotation DemuxerStreamForTest::video_rotation() { | 77 ::media::VideoRotation DemuxerStreamForTest::video_rotation() { |
| 78 return ::media::VIDEO_ROTATION_0; | 78 return ::media::VIDEO_ROTATION_0; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool DemuxerStreamForTest::enabled() const { |
| 82 return true; |
| 83 } |
| 84 |
| 85 void DemuxerStreamForTest::set_enabled(bool enabled, base::TimeDelta time) { |
| 86 NOTIMPLEMENTED(); |
| 87 } |
| 88 |
| 89 void DemuxerStreamForTest::SetStreamRestartedCB(const StreamRestartedCB& cb) { |
| 90 NOTIMPLEMENTED(); |
| 91 } |
| 92 |
| 81 void DemuxerStreamForTest::DoRead(const ReadCB& read_cb) { | 93 void DemuxerStreamForTest::DoRead(const ReadCB& read_cb) { |
| 82 has_pending_read_ = false; | 94 has_pending_read_ = false; |
| 83 | 95 |
| 84 if (total_frame_count_ != -1 && frame_count_ >= total_frame_count_) { | 96 if (total_frame_count_ != -1 && frame_count_ >= total_frame_count_) { |
| 85 // End of stream | 97 // End of stream |
| 86 read_cb.Run(kOk, ::media::DecoderBuffer::CreateEOSBuffer()); | 98 read_cb.Run(kOk, ::media::DecoderBuffer::CreateEOSBuffer()); |
| 87 return; | 99 return; |
| 88 } | 100 } |
| 89 | 101 |
| 90 scoped_refptr<::media::DecoderBuffer> buffer(new ::media::DecoderBuffer(16)); | 102 scoped_refptr<::media::DecoderBuffer> buffer(new ::media::DecoderBuffer(16)); |
| 91 buffer->set_timestamp(frame_count_ * base::TimeDelta::FromMilliseconds( | 103 buffer->set_timestamp(frame_count_ * base::TimeDelta::FromMilliseconds( |
| 92 kDemuxerStreamForTestFrameDuration)); | 104 kDemuxerStreamForTestFrameDuration)); |
| 93 frame_count_++; | 105 frame_count_++; |
| 94 read_cb.Run(kOk, buffer); | 106 read_cb.Run(kOk, buffer); |
| 95 } | 107 } |
| 96 | 108 |
| 97 } // namespace media | 109 } // namespace media |
| 98 } // namespace chromecast | 110 } // namespace chromecast |
| OLD | NEW |