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

Side by Side Diff: media/filters/ffmpeg_demuxer_unittest.cc

Issue 113619: Use av_rescale_q() for converting FFmpeg timestamps to base::TimeDelta (second attempt). (Closed)
Patch Set: Created 11 years, 7 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 | « media/filters/ffmpeg_demuxer.cc ('k') | third_party/ffmpeg/avutil-50.def » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <deque> 5 #include <deque>
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "base/tuple.h" 8 #include "base/tuple.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/base/filters.h" 10 #include "media/base/filters.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 *format = &g_format; 127 *format = &g_format;
128 } 128 }
129 return g_av_open_input_file; 129 return g_av_open_input_file;
130 } 130 }
131 131
132 int av_find_stream_info(AVFormatContext* format) { 132 int av_find_stream_info(AVFormatContext* format) {
133 EXPECT_EQ(&g_format, format); 133 EXPECT_EQ(&g_format, format);
134 return g_av_find_stream_info; 134 return g_av_find_stream_info;
135 } 135 }
136 136
137 int64 av_rescale_q(int64 a, AVRational bq, AVRational cq) {
awong 2009/05/20 18:17:42 Hah...cute. We do need a way to better mock these
scherkus (not reviewing) 2009/05/20 18:21:27 You should see the actual implementation. It's an
138 int64 num = bq.num * cq.den;
139 int64 den = cq.num * bq.den;
140 return a * num / den;
141 }
142
137 void av_free(void* ptr) { 143 void av_free(void* ptr) {
138 if (ptr) { 144 if (ptr) {
139 EXPECT_EQ(&g_format, ptr); 145 EXPECT_EQ(&g_format, ptr);
140 } 146 }
141 } 147 }
142 148
143 int av_read_frame(AVFormatContext* format, AVPacket* packet) { 149 int av_read_frame(AVFormatContext* format, AVPacket* packet) {
144 EXPECT_EQ(&g_format, format); 150 EXPECT_EQ(&g_format, format);
145 if (g_av_read_frame == 0) { 151 if (g_av_read_frame == 0) {
146 PacketQueue::get()->Dequeue(packet); 152 PacketQueue::get()->Dequeue(packet);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 EXPECT_FALSE(reader->WaitForRead()); 598 EXPECT_FALSE(reader->WaitForRead());
593 EXPECT_FALSE(reader->called()); 599 EXPECT_FALSE(reader->called());
594 EXPECT_FALSE(reader->buffer()); 600 EXPECT_FALSE(reader->buffer());
595 601
596 // Manually release buffer, which should release any remaining AVPackets. 602 // Manually release buffer, which should release any remaining AVPackets.
597 reader = NULL; 603 reader = NULL;
598 EXPECT_TRUE(PacketQueue::get()->WaitForOutstandingPackets(0)); 604 EXPECT_TRUE(PacketQueue::get()->WaitForOutstandingPackets(0));
599 } 605 }
600 606
601 } // namespace 607 } // namespace
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_demuxer.cc ('k') | third_party/ffmpeg/avutil-50.def » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698