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

Unified Diff: media/formats/mp2t/es_parser_h264.cc

Issue 364823008: Mpeg2TS - estimate duration for video frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MEDIA_EXPORT needed by the ES adapter unit test. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/mp2t/es_parser_h264.h ('k') | media/formats/mp2t/mp2t_stream_parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp2t/es_parser_h264.cc
diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc
index 691678ce81ebd49fb9b3a099c306de3412f11e99..f2c166cf8cc6e632c9c06d254e8b90daae747925 100644
--- a/media/formats/mp2t/es_parser_h264.cc
+++ b/media/formats/mp2t/es_parser_h264.cc
@@ -12,6 +12,7 @@
#include "media/base/video_frame.h"
#include "media/filters/h264_parser.h"
#include "media/formats/common/offset_byte_queue.h"
+#include "media/formats/mp2t/es_adapter_video.h"
#include "media/formats/mp2t/mp2t_common.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -26,12 +27,11 @@ const int kMinAUDSize = 4;
EsParserH264::EsParserH264(
const NewVideoConfigCB& new_video_config_cb,
const EmitBufferCB& emit_buffer_cb)
- : new_video_config_cb_(new_video_config_cb),
- emit_buffer_cb_(emit_buffer_cb),
- es_queue_(new media::OffsetByteQueue()),
- h264_parser_(new H264Parser()),
- current_access_unit_pos_(0),
- next_access_unit_pos_(0) {
+ : es_adapter_(new_video_config_cb, emit_buffer_cb),
+ es_queue_(new media::OffsetByteQueue()),
+ h264_parser_(new H264Parser()),
+ current_access_unit_pos_(0),
+ next_access_unit_pos_(0) {
}
EsParserH264::~EsParserH264() {
@@ -75,6 +75,8 @@ void EsParserH264::Flush() {
uint8 aud[] = { 0x00, 0x00, 0x01, 0x09 };
es_queue_->Push(aud, sizeof(aud));
ParseInternal();
+
+ es_adapter_.Flush();
}
void EsParserH264::Reset() {
@@ -85,6 +87,7 @@ void EsParserH264::Reset() {
next_access_unit_pos_ = 0;
timing_desc_list_.clear();
last_video_decoder_config_ = VideoDecoderConfig();
+ es_adapter_.Reset();
}
bool EsParserH264::FindAUD(int64* stream_pos) {
@@ -273,7 +276,7 @@ bool EsParserH264::EmitFrame(int64 access_unit_pos, int access_unit_size,
0);
stream_parser_buffer->SetDecodeTimestamp(current_timing_desc.dts);
stream_parser_buffer->set_timestamp(current_timing_desc.pts);
- emit_buffer_cb_.Run(stream_parser_buffer);
+ es_adapter_.OnNewBuffer(stream_parser_buffer);
return true;
}
@@ -321,7 +324,7 @@ bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps) {
DVLOG(1) << "SAR: width=" << sps->sar_width
<< " height=" << sps->sar_height;
last_video_decoder_config_ = video_decoder_config;
- new_video_config_cb_.Run(video_decoder_config);
+ es_adapter_.OnConfigChanged(video_decoder_config);
}
return true;
« no previous file with comments | « media/formats/mp2t/es_parser_h264.h ('k') | media/formats/mp2t/mp2t_stream_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698