multimediacommscontroller/mmccfilesourcesink/src/mccfilesink.cpp
branchRCL_3
changeset 55 f72c4fccd381
parent 17 a5ac35ca6d81
child 59 b0e4b01681c5
equal deleted inserted replaced
46:4da1f672912e 55:f72c4fccd381
    31 
    31 
    32 // CONSTANTS
    32 // CONSTANTS
    33 
    33 
    34 const TInt KMccMaxNumTimestamps = 5;
    34 const TInt KMccMaxNumTimestamps = 5;
    35 
    35 
    36 const TInt KMccTimestampDifferenceMultiplier = 10;
    36 // used for Calculate Average Timestamp
       
    37 const TInt KMccDefaultAvgTimestampDiff = 66000;
    37 
    38 
    38 // ============================ MEMBER FUNCTIONS ===============================
    39 // ============================ MEMBER FUNCTIONS ===============================
    39 
    40 
    40 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    41 // CMccFileSink::NewSinkL
    42 // CMccFileSink::NewSinkL
    69 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    70 // CMccFileSink::CMccFileSink
    71 // CMccFileSink::CMccFileSink
    71 // -----------------------------------------------------------------------------
    72 // -----------------------------------------------------------------------------
    72 //
    73 //
    73 CMccFileSink::CMccFileSink() : 
    74 CMccFileSink::CMccFileSink() : 
    74     CMccDataSink( KMccFileSinkUid )
    75     CMccDataSink( KMccFileSinkUid ),
       
    76     iCurrAvgTimestampDifference( KMccDefaultAvgTimestampDiff )
    75     {
    77     {
    76     iVideoCodec.iFourCC = TFourCC( KMccFourCCIdH263 );
    78     iVideoCodec.iFourCC = TFourCC( KMccFourCCIdH263 );
    77     // FJKI-7J58CB no use case for audio in file, hence removing the audio track capability 
    79     // FJKI-7J58CB no use case for audio in file, hence removing the audio track capability 
    78     //             per request from customer
    80     //             per request from customer
    79     // iAudioFourCC = TFourCC( KMccFourCCIdAMRNB );
    81     // iAudioFourCC = TFourCC( KMccFourCCIdAMRNB );
   563                averageTimeStampDifference += ( iTimestamps[ i ] - iTimestamps[ i - 1 ] );
   565                averageTimeStampDifference += ( iTimestamps[ i ] - iTimestamps[ i - 1 ] );
   564                }
   566                }
   565                
   567                
   566        averageTimeStampDifference = averageTimeStampDifference / ( KMccMaxNumTimestamps - 1 );
   568        averageTimeStampDifference = averageTimeStampDifference / ( KMccMaxNumTimestamps - 1 );
   567        }
   569        }
       
   570     if ( averageTimeStampDifference > 0 )
       
   571 	   {
       
   572 	   iCurrAvgTimestampDifference = averageTimeStampDifference;
       
   573        }
   568     
   574     
   569     if ( aCurrentTimestamp > iPreviousTimestamp )
   575     if ( aCurrentTimestamp > iPreviousTimestamp )
   570        {
   576        {
   571        if ( iTimestamps.Count() >= KMccMaxNumTimestamps )
   577        if ( iTimestamps.Count() >= KMccMaxNumTimestamps )
   572            {
   578            {
   573            iTimestamps.Remove( 0 );
   579            iTimestamps.Remove( 0 );
   574            }
   580            }
   575        iTimestamps.AppendL( aCurrentTimestamp.Int64() );
   581        iTimestamps.AppendL( aCurrentTimestamp.Int64() );
   576        }
   582        }
       
   583     else if ( aCurrentTimestamp < iPreviousTimestamp )
       
   584        {
       
   585 	   TInt64 currDifference = iPreviousTimestamp.Int64() - aCurrentTimestamp.Int64();
       
   586        iAddToTimestamp += ( currDifference + iCurrAvgTimestampDifference );
       
   587        iTimestamps.Reset();
       
   588        iPausedDuration = 0;
       
   589            
       
   590        __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp )  
       
   591        }
   577     else
   592     else
   578        {
   593         {
   579        TInt64 currDifference = iPreviousTimestamp.Int64() - aCurrentTimestamp.Int64();
   594         // NOP
   580        if ( averageTimeStampDifference != 0 && 
   595         }
   581             currDifference > ( averageTimeStampDifference * KMccTimestampDifferenceMultiplier ) )
       
   582            {
       
   583            iAddToTimestamp += ( currDifference + averageTimeStampDifference );
       
   584            iTimestamps.Reset();
       
   585 		   iPausedDuration = 0;
       
   586            
       
   587            __FILESINK_CONTROLL_INT1("CMccFileSink::TimeToPlay, iAddToTimestamp=", iAddToTimestamp )  
       
   588            }
       
   589        }
       
   590     }
   596     }
   591 
   597 
   592 // -----------------------------------------------------------------------------
   598 // -----------------------------------------------------------------------------
   593 // CMccFileSink::ResetTimers
   599 // CMccFileSink::ResetTimers
   594 // -----------------------------------------------------------------------------
   600 // -----------------------------------------------------------------------------