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

Side by Side Diff: chromecast/media/cma/test/media_component_device_feeder_for_test.cc

Issue 1267563003: [Chromecast] Add explicit task_runner in CMA test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove spurious changes Created 5 years, 4 months 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 | « no previous file | 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 "chromecast/media/cma/test/media_component_device_feeder_for_test.h" 5 #include "chromecast/media/cma/test/media_component_device_feeder_for_test.h"
6 6
7 #include <list> 7 #include <list>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/single_thread_task_runner.h"
17 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "chromecast/media/base/decrypt_context.h" 18 #include "chromecast/media/base/decrypt_context.h"
20 #include "chromecast/media/cma/backend/audio_pipeline_device.h" 19 #include "chromecast/media/cma/backend/audio_pipeline_device.h"
21 #include "chromecast/media/cma/backend/media_clock_device.h" 20 #include "chromecast/media/cma/backend/media_clock_device.h"
22 #include "chromecast/media/cma/backend/media_pipeline_device.h" 21 #include "chromecast/media/cma/backend/media_pipeline_device.h"
23 #include "chromecast/media/cma/backend/video_pipeline_device.h" 22 #include "chromecast/media/cma/backend/video_pipeline_device.h"
24 #include "chromecast/media/cma/base/decoder_buffer_adapter.h" 23 #include "chromecast/media/cma/base/decoder_buffer_adapter.h"
25 #include "chromecast/media/cma/base/decoder_buffer_base.h" 24 #include "chromecast/media/cma/base/decoder_buffer_base.h"
26 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" 25 #include "chromecast/media/cma/test/frame_segmenter_for_test.h"
27 #include "media/base/audio_decoder_config.h" 26 #include "media/base/audio_decoder_config.h"
27 #include "media/base/bind_to_current_loop.h"
28 #include "media/base/buffers.h" 28 #include "media/base/buffers.h"
29 #include "media/base/decoder_buffer.h" 29 #include "media/base/decoder_buffer.h"
30 #include "media/base/video_decoder_config.h" 30 #include "media/base/video_decoder_config.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 32
33 namespace chromecast { 33 namespace chromecast {
34 namespace media { 34 namespace media {
35 35
36 MediaComponentDeviceFeederForTest::MediaComponentDeviceFeederForTest( 36 MediaComponentDeviceFeederForTest::MediaComponentDeviceFeederForTest(
37 MediaComponentDevice *device, 37 MediaComponentDevice *device,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 if (rendering_frame_idx_ == 0) { 71 if (rendering_frame_idx_ == 0) {
72 media_component_device_->SetState(MediaComponentDevice::kStateRunning); 72 media_component_device_->SetState(MediaComponentDevice::kStateRunning);
73 } else { 73 } else {
74 rendering_frame_idx_--; 74 rendering_frame_idx_--;
75 } 75 }
76 76
77 // Possibly feed one frame 77 // Possibly feed one frame
78 DCHECK(!frames_.empty()); 78 DCHECK(!frames_.empty());
79 scoped_refptr<DecoderBufferBase> buffer = frames_.front(); 79 scoped_refptr<DecoderBufferBase> buffer = frames_.front();
80 80
81 MediaComponentDevice::FrameStatus status = 81 MediaComponentDevice::FrameStatus status = media_component_device_->PushFrame(
82 media_component_device_->PushFrame( 82 scoped_refptr<DecryptContext>(), buffer,
83 scoped_refptr<DecryptContext>(), 83 ::media::BindToCurrentLoop(
84 buffer,
85 base::Bind(&MediaComponentDeviceFeederForTest::OnFramePushed, 84 base::Bind(&MediaComponentDeviceFeederForTest::OnFramePushed,
86 base::Unretained(this))); 85 base::Unretained(this))));
87 EXPECT_NE(status, MediaComponentDevice::kFrameFailed); 86 EXPECT_NE(status, MediaComponentDevice::kFrameFailed);
88 frames_.pop_front(); 87 frames_.pop_front();
89 88
90 // Feeding is done, just wait for the end of stream callback. 89 // Feeding is done, just wait for the end of stream callback.
91 if (buffer->end_of_stream() || frames_.empty()) { 90 if (buffer->end_of_stream() || frames_.empty()) {
92 if (frames_.empty() && !buffer->end_of_stream()) { 91 if (frames_.empty() && !buffer->end_of_stream()) {
93 LOG(WARNING) << "Stream emptied without feeding EOS frame"; 92 LOG(WARNING) << "Stream emptied without feeding EOS frame";
94 } 93 }
95 94
96 feeding_completed_ = true; 95 feeding_completed_ = true;
(...skipping 25 matching lines...) Expand all
122 MediaComponentDevice::kStateUninitialized); 121 MediaComponentDevice::kStateUninitialized);
123 ASSERT_TRUE(success); 122 ASSERT_TRUE(success);
124 123
125 if (!eos_cb_.is_null()) { 124 if (!eos_cb_.is_null()) {
126 eos_cb_.Run(); 125 eos_cb_.Run();
127 } 126 }
128 } 127 }
129 128
130 } // namespace media 129 } // namespace media
131 } // namespace chromecast 130 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698