Skip to main content

Rtp Packet size (again)

6 replies [Last post]
opu
Offline
Joined: 2007-12-10

Thanks ti Kulikoff for his helpful reply.

But now i need to know another thing.
I am using Netbeans IDE.
when i want to record voice for 100ms then it size is about 1044 for PCMA/PCMU.
when i want to record voice for 20ms then it size is about 512 for PCMA/PCMU

i got advised to record 20ms for 160 bytes....but i am getting arround 512 for 20ms....

can anyone plz help me in this regard including kulikoff...

Thanks
opu

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kulikoff
Offline
Joined: 2005-11-30

How do you measure data size? I guess you are recoding media into wav or other type of file and checking file size, right? If yes you should take into account that media files have its own format and add specific metadata to media data.

Regards,
Oleg

opu
Offline
Joined: 2007-12-10

Hi Oleg,
By this code i am getting arround 512 bytes data for 20ms. i think there is is lot of
unuseful bytes which create noise...just have a look on this....

Player p;
RecordControl rc;
ByteArrayOutputStream output;

p=Manager.createPlayer("capture://audio?encoding=pcm&rate=8000&bits=8&channels=1"); p.realize();
rc = (RecordControl)p.getControl("RecordControl");
output = new ByteArrayOutputStream();
byte temp[]=new byte[1200];
rc.setRecordStream(output);
rc.startRecord();
p.start();
Thread.sleep(20);
rc.commit();
temp=output.toByteArray();
p.stop();
rc.stopRecord();
System.out.println("length: "+output.size());

Thanks
Opu

kulikoff
Offline
Joined: 2005-11-30

hi Opu

I am not shure that that you are receording excatly 20ms audio. It depends on the source. Source stream may push more media while you "sleeping"

Regards,
Oleg

opu
Offline
Joined: 2007-12-10

Hi kulikoff,
i think this is the point. do u think the pc configuration is the matter for that?or the netbean version i am using?
please mention a configuration from which i can get exact bytes.

Thanks
Opu

kulikoff
Offline
Joined: 2005-11-30

You should write your own DataSink and use Buffer.getTimestamp() for time measuring

Regards,
Oleg

opu
Offline
Joined: 2007-12-10

Hi

as j2me has no built in Datasink so that u told me to create an own Datasink .
right?
any help about Datasink in j2me?plz mention.

Regards
Opu