diff options
author | Joungkook Seo <jk7704.seo@samsung.com> | 2013-04-05 15:25:43 +0900 |
---|---|---|
committer | Joungkook Seo <jk7704.seo@samsung.com> | 2013-04-05 15:25:43 +0900 |
commit | e1a6d4b184f85d0346fc5fce6eb5b48c3e785ad8 (patch) | |
tree | fbd823b75d551c25400fc738a56334561355049f | |
parent | 0fa9f1d99b501496eb68ff31350979da5c5f0f95 (diff) | |
download | gst-plugins-good0.10-e1a6d4b184f85d0346fc5fce6eb5b48c3e785ad8.tar.gz gst-plugins-good0.10-e1a6d4b184f85d0346fc5fce6eb5b48c3e785ad8.tar.bz2 gst-plugins-good0.10-e1a6d4b184f85d0346fc5fce6eb5b48c3e785ad8.zip |
[gst-plugins-good] DCM-1243 : mp3 Seek bug fix on case of xing
Change-Id: I394003cce443b7e2d1b9e180b8f2d92bd0621674
-rw-r--r-- | gst/audioparsers/gstmpegaudioparse.c | 41 | ||||
-rw-r--r-- | gst/audioparsers/gstmpegaudioparse.h | 10 | ||||
-rw-r--r-- | packaging/gst-plugins-good.spec | 2 |
3 files changed, 34 insertions, 19 deletions
diff --git a/gst/audioparsers/gstmpegaudioparse.c b/gst/audioparsers/gstmpegaudioparse.c index dd49f84..3e33576 100644 --- a/gst/audioparsers/gstmpegaudioparse.c +++ b/gst/audioparsers/gstmpegaudioparse.c @@ -234,6 +234,7 @@ gst_mpeg_audio_parse_reset (GstMpegAudioParse * mp3parse) mp3parse->encoder_delay = 0; mp3parse->encoder_padding = 0; + mp3parse->encoded_file_size = 0; } static void @@ -633,6 +634,8 @@ gst_mpeg_audio_parse_handle_first_frame (GstMpegAudioParse * mp3parse, if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE (mp3parse)), &fmt, &upstream_total_bytes)) upstream_total_bytes = 0; + GST_INFO_OBJECT (mp3parse, "gst_pad_query_peer_duration -upstream_total_bytes (%"G_GUINT64_FORMAT")", upstream_total_bytes); + mp3parse->encoded_file_size = upstream_total_bytes; if (read_id_xing == xing_id || read_id_xing == info_id) { guint32 xing_flags; @@ -987,6 +990,9 @@ gst_mpeg_audio_parse_parse_frame (GstBaseParse * parse, guint bitrate, layer, rate, channels, version, mode, crc; g_return_val_if_fail (GST_BUFFER_SIZE (buf) >= 4, GST_FLOW_ERROR); + if(GST_BUFFER_SIZE (buf) < 4) { + GST_INFO_OBJECT (parse, "_parse_parse_frame() : buffer->size(%d)",GST_BUFFER_SIZE (buf)); + } if (!mp3_type_frame_length_from_header (mp3parse, GST_READ_UINT32_BE (GST_BUFFER_DATA (buf)), @@ -1402,34 +1408,43 @@ gst_mpeg_audio_parse_src_eventfunc (GstBaseParse * parse, GstEvent * event) gint64 total_file_size = 0, start_offset = 0; GstClockTime current_ts = GST_CLOCK_TIME_NONE; GstActivateMode pad_mode = GST_ACTIVATE_NONE; - gint64 encoded_file_size = 0; + + GST_DEBUG("gst_mpeg_audio_parse_src_eventfunc GST_EVENT_SEEK enter"); + + if(mp3parse->xing_frames > 0 && mp3parse->xing_bytes > 0) { + GST_INFO_OBJECT (mp3parse, "[SEEK] Xing header reported %u frames, time %" + GST_TIME_FORMAT ", %u bytes, vbr scale %u", mp3parse->xing_frames, + GST_TIME_ARGS (mp3parse->xing_total_time), mp3parse->xing_bytes, + mp3parse->xing_vbr_scale); + GST_INFO_OBJECT (mp3parse, "[SEEK] Xing header FOUND - we don't need SEEK TBL"); + break; + } + GST_INFO_OBJECT (mp3parse, "[SEEK] Xing header NOT FOUND - need SEEK TBL"); #ifdef GST_EXT_BASEPARSER_MODIFICATION /* check baseparse define these fuction */ gst_base_parse_get_pad_mode(parse, &pad_mode); if (pad_mode != GST_ACTIVATE_PULL) { - GST_INFO_OBJECT (parse, "mp3 parser is not pull mode. mp3 parser can not make index table."); + GST_INFO_OBJECT (mp3parse, "mp3 parser is not pull mode. mp3 parser can not make index table."); return FALSE; } - gst_base_parse_get_upstream_size(parse, &total_file_size); - gst_base_parse_get_encoded_size(parse, &encoded_file_size); - if (total_file_size > encoded_file_size) { - GST_INFO_OBJECT(parse, "[SEEK_EVENT] total_file_size (%"G_GINT64_FORMAT")= encoded_file_size(%"G_GINT64_FORMAT")+ ID3(%"G_GINT64_FORMAT")", - total_file_size, encoded_file_size, (total_file_size - encoded_file_size) ); - total_file_size = encoded_file_size; - } - gst_base_parse_get_index_last_offset(parse, &start_offset); gst_base_parse_get_index_last_ts(parse, ¤t_ts); + + if (mp3parse->encoded_file_size > 0) { + GST_INFO_OBJECT(parse, "[SEEK] total_file_size (%"G_GINT64_FORMAT")= encoded_file_size(%"G_GINT64_FORMAT")+ ID3(%"G_GINT64_FORMAT")", + total_file_size, mp3parse->encoded_file_size, (total_file_size - mp3parse->encoded_file_size) ); + total_file_size = mp3parse->encoded_file_size; + } else { + GST_INFO_OBJECT(parse, "[SEEK] encoded_file_siz (%"G_GINT64_FORMAT") is WRONG", mp3parse->encoded_file_size ); + } #else GST_ERROR("baseparser does not define get private param functions. can not make index table here."); break; #endif - GST_DEBUG("gst_mpeg_audio_parse_src_eventfunc GST_EVENT_SEEK enter"); - if (total_file_size == 0 || start_offset >= total_file_size) { - GST_ERROR("last index offset %d is larger than file size %d", start_offset, total_file_size); + GST_ERROR("last index offset (%"G_GUINT64_FORMAT") is larger than file size (%"G_GUINT64_FORMAT")", start_offset, total_file_size); break; } diff --git a/gst/audioparsers/gstmpegaudioparse.h b/gst/audioparsers/gstmpegaudioparse.h index 1bfefa0..7867300 100644 --- a/gst/audioparsers/gstmpegaudioparse.h +++ b/gst/audioparsers/gstmpegaudioparse.h @@ -60,11 +60,11 @@ struct _GstMpegAudioParse { /* samples per frame */ gint spf; - /* added for make seek table */
- guint32 lsf; /* added */
- guint32 frame_duration; /* added - duration per frame (msec) */
- guint32 frame_per_sec; /* added - frames per second (ea) */
-
+ /* added for make seek table */ + guint32 lsf; /* added */ + guint32 frame_duration; /* added - duration per frame (msec) */ + guint32 frame_per_sec; /* added - frames per second (ea) */
+ gint64 encoded_file_size; gboolean sent_codec_tag; guint last_posted_bitrate; gint last_posted_crc, last_crc; diff --git a/packaging/gst-plugins-good.spec b/packaging/gst-plugins-good.spec index 65d3afa..aa88ed5 100644 --- a/packaging/gst-plugins-good.spec +++ b/packaging/gst-plugins-good.spec @@ -2,7 +2,7 @@ Name: gst-plugins-good Summary: GStreamer plugins from the "good" set Version: 0.10.31 -Release: 22 +Release: 23 Group: Applications/Multimedia License: LGPLv2+ Source0: %{name}-%{version}.tar.gz |