| 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 "chromecast/media/cma/test/frame_segmenter_for_test.h" | 5 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 BufferList H264SegmenterForTest(const uint8_t* data, size_t data_size) { | 134 BufferList H264SegmenterForTest(const uint8_t* data, size_t data_size) { |
| 135 BufferList video_frames; | 135 BufferList video_frames; |
| 136 std::list<H264AccessUnit> access_unit_list; | 136 std::list<H264AccessUnit> access_unit_list; |
| 137 H264AccessUnit access_unit; | 137 H264AccessUnit access_unit; |
| 138 | 138 |
| 139 int prev_pic_order_cnt_lsb = 0; | 139 int prev_pic_order_cnt_lsb = 0; |
| 140 int pic_order_cnt_msb = 0; | 140 int pic_order_cnt_msb = 0; |
| 141 | 141 |
| 142 scoped_ptr< ::media::H264Parser> h264_parser(new ::media::H264Parser()); | 142 std::unique_ptr<::media::H264Parser> h264_parser(new ::media::H264Parser()); |
| 143 h264_parser->SetStream(data, data_size); | 143 h264_parser->SetStream(data, data_size); |
| 144 | 144 |
| 145 while (true) { | 145 while (true) { |
| 146 bool is_eos = false; | 146 bool is_eos = false; |
| 147 ::media::H264NALU nalu; | 147 ::media::H264NALU nalu; |
| 148 switch (h264_parser->AdvanceToNextNALU(&nalu)) { | 148 switch (h264_parser->AdvanceToNextNALU(&nalu)) { |
| 149 case ::media::H264Parser::kOk: | 149 case ::media::H264Parser::kOk: |
| 150 break; | 150 break; |
| 151 case ::media::H264Parser::kInvalidStream: | 151 case ::media::H264Parser::kInvalidStream: |
| 152 case ::media::H264Parser::kUnsupportedStream: | 152 case ::media::H264Parser::kUnsupportedStream: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 return video_frames; | 265 return video_frames; |
| 266 } | 266 } |
| 267 | 267 |
| 268 void OnEncryptedMediaInitData(::media::EmeInitDataType init_data_type, | 268 void OnEncryptedMediaInitData(::media::EmeInitDataType init_data_type, |
| 269 const std::vector<uint8_t>& init_data) { | 269 const std::vector<uint8_t>& init_data) { |
| 270 LOG(FATAL) << "Unexpected test failure: file is encrypted."; | 270 LOG(FATAL) << "Unexpected test failure: file is encrypted."; |
| 271 } | 271 } |
| 272 | 272 |
| 273 void OnMediaTracksUpdated(scoped_ptr<::media::MediaTracks> tracks) { | 273 void OnMediaTracksUpdated(std::unique_ptr<::media::MediaTracks> tracks) {} |
| 274 } | |
| 275 | 274 |
| 276 void OnNewBuffer(BufferList* buffer_list, | 275 void OnNewBuffer(BufferList* buffer_list, |
| 277 const base::Closure& finished_cb, | 276 const base::Closure& finished_cb, |
| 278 ::media::DemuxerStream::Status status, | 277 ::media::DemuxerStream::Status status, |
| 279 const scoped_refptr< ::media::DecoderBuffer>& buffer) { | 278 const scoped_refptr< ::media::DecoderBuffer>& buffer) { |
| 280 CHECK_EQ(status, ::media::DemuxerStream::kOk); | 279 CHECK_EQ(status, ::media::DemuxerStream::kOk); |
| 281 CHECK(buffer.get()); | 280 CHECK(buffer.get()); |
| 282 CHECK(buffer_list); | 281 CHECK(buffer_list); |
| 283 buffer_list->push_back(new DecoderBufferAdapter(buffer)); | 282 buffer_list->push_back(new DecoderBufferAdapter(buffer)); |
| 284 finished_cb.Run(); | 283 finished_cb.Run(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 CHECK(!demux_result.frames.empty()); | 342 CHECK(!demux_result.frames.empty()); |
| 344 end_of_stream = demux_result.frames.back()->end_of_stream(); | 343 end_of_stream = demux_result.frames.back()->end_of_stream(); |
| 345 } | 344 } |
| 346 | 345 |
| 347 demuxer.Stop(); | 346 demuxer.Stop(); |
| 348 return demux_result; | 347 return demux_result; |
| 349 } | 348 } |
| 350 | 349 |
| 351 } // namespace media | 350 } // namespace media |
| 352 } // namespace chromecast | 351 } // namespace chromecast |
| OLD | NEW |