GST_DEBUG_OBJECT (amrparse, "AMR-WB detected");
amrparse->block_size = block_size_wb;
amrparse->wide = TRUE;
- *skipsize = 9;
+ *skipsize = amrparse->header = 9;
} else if (!memcmp (data, "#!AMR\n", 6)) {
GST_DEBUG_OBJECT (amrparse, "AMR-NB detected");
amrparse->block_size = block_size_nb;
amrparse->wide = FALSE;
- *skipsize = 6;
+ *skipsize = amrparse->header = 6;
} else
return FALSE;
amrparse = GST_AMRPARSE (parse);
GST_DEBUG ("start");
amrparse->need_header = TRUE;
+ amrparse->header = 0;
amrparse->sync = TRUE;
amrparse->eos = FALSE;
amrparse->framecount = 0;
amrparse = GST_AMRPARSE (parse);
GST_DEBUG ("stop");
amrparse->need_header = TRUE;
+ amrparse->header = 0;
amrparse->ts = -1;
return TRUE;
}
GST_DEBUG ("converting bytes -> time");
if (amrparse->framecount) {
- *dest_value = AMR_FRAME_DURATION * src_value / bpf;
+ *dest_value = AMR_FRAME_DURATION * (src_value - amrparse->header) / bpf;
GST_DEBUG ("conversion result: %lld ms", *dest_value / GST_MSECOND);
ret = TRUE;
}
GST_DEBUG ("converting time -> bytes");
if (dest_format == GST_FORMAT_BYTES) {
if (amrparse->framecount) {
- *dest_value = bpf * src_value / AMR_FRAME_DURATION;
+ *dest_value = bpf * src_value / AMR_FRAME_DURATION + amrparse->header;
GST_DEBUG ("time %lld ms in bytes = %lld",
src_value / GST_MSECOND, *dest_value);
ret = TRUE;